001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.camel.model; 018 019import java.util.Map; 020import java.util.function.Consumer; 021import java.util.function.Supplier; 022 023import org.apache.camel.CamelContext; 024import org.apache.camel.model.placeholder.DefinitionPropertiesPlaceholderProviderHelper; 025import org.apache.camel.spi.PropertyPlaceholderConfigurer; 026 027/** 028 * To be used for configuring property placeholder options on the EIP models. 029 */ 030public interface DefinitionPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer { 031 032 /** 033 * Gets the options on the model definition which supports property 034 * placeholders and can be resolved. This will be all the string based 035 * options. 036 * 037 * @return key/values of options 038 */ 039 default Map<String, Supplier<String>> getReadPropertyPlaceholderOptions(CamelContext camelContext) { 040 PropertyPlaceholderConfigurer configurer = DefinitionPropertiesPlaceholderProviderHelper.provider(this).orElse(null); 041 return configurer != null ? configurer.getReadPropertyPlaceholderOptions(camelContext) : null; 042 } 043 044 /** 045 * To update an existing property using the function with the key/value and 046 * returning the changed value This will be all the string based options. 047 */ 048 default Map<String, Consumer<String>> getWritePropertyPlaceholderOptions(CamelContext camelContext) { 049 PropertyPlaceholderConfigurer configurer = DefinitionPropertiesPlaceholderProviderHelper.provider(this).orElse(null); 050 return configurer != null ? configurer.getWritePropertyPlaceholderOptions(camelContext) : null; 051 } 052 053}