@Override public PropertyValue evaluteRawValue(String key, ConfigurationContext context) { PropertyValue unfilteredValue = null; for (PropertySource propertySource : context.getPropertySources()) { unfilteredValue = context.getPropertyValueCombinationPolicy(). collect(unfilteredValue, key, propertySource); } if(unfilteredValue==null || unfilteredValue.getValue()==null){ return unfilteredValue; } return unfilteredValue; }
/** * Get all currently available formats, ordered by priority. * * @return the currently available formats, never null. */ public static List<ConfigurationFormat> getFormats() { return ServiceContextManager.getServiceContext().getServices(ConfigurationFormat.class); }
@Override public ConfigurationContextBuilder getConfigurationContextBuilder() { ConfigurationContextBuilder contextBuilder = ServiceContextManager.getServiceContext().getService(ConfigurationContextBuilder.class); return contextBuilder; }
public DefaultConfigurationContextBuilder addDefaultPropertySources() { checkBuilderState(); for(PropertySource ps:ServiceContextManager.getServiceContext().getServices(PropertySource.class)){ addPropertySources(ps); } for(PropertySourceProvider pv:ServiceContextManager.getServiceContext().getServices(PropertySourceProvider.class)){ for(PropertySource ps:pv.getPropertySources()){ addPropertySources(ps); } } return this; }
public DefaultConfigurationContextBuilder addDefaultPropertyFilters() { checkBuilderState(); for(PropertyFilter pf:ServiceContextManager.getServiceContext().getServices(PropertyFilter.class)){ addPropertyFilters(pf); } return this; }
/** * Creates a new builder instance based on this item. * @return a new builder, never null. */ public PropertyValueBuilder toBuilder() { return new PropertyValueBuilder(this.getKey(), this.getSource()) .setValue(this.getValue()) .setMetaEntries(this.metaEntries); }
@Override public String toString() { return "ValueMappedPropertySource{" + "source=" + source.getName() + ", name='" + name + '\'' + ", valueFilter=" + valueFilter + '}'; } }
@Override public PropertyValue collect(PropertyValue currentValue, String key, PropertySource propertySource) { PropertyValue value = propertySource.get(key); return value!=null?value:currentValue; }
@Override public PropertyValue filterProperty(PropertyValue valueToBeFiltered, org.apache.tamaya.spi.FilterContext context) { for(PropertyFilter filter:filters){ valueToBeFiltered = filter.filterProperty(valueToBeFiltered, context); } return valueToBeFiltered; }
@Override public boolean isScannable() { return basePropertySource.isScannable(); } }
/** * Access the current configuration. * * @return the corresponding Configuration instance, never null. */ public static Configuration getConfiguration() { return PROVIDER_SPI.getConfiguration(); }
/** * Method that determines if filtering is done for a single property accessed, or as part of call to * {@code getProperties()}. * @return true, if its scoped to a single property accessed. */ @Experimental public boolean isSinglePropertyScoped(){ return singlePropertyScoped; }
/** * Builds a new context instance. * @return a new context, never null. */ public ConversionContext build(){ return new ConversionContext(this); }
/** * Creates a new immutable {@link PropertyValue}. * @return a new immutable {@link PropertyValue}, never {@code null}. */ public PropertyValue build(){ return new PropertyValue(this); }
/** * Get the current injector instance. * * @return the current injector, not null. */ public static ConfigurationInjector getConfigurationInjector() { return ServiceContextManager.getServiceContext().getService(ConfigurationInjector.class); } }
@Override public Collection<ResourceLocator> getResourceLocators() { return ServiceContextManager.getServiceContext().getServices(ResourceLocator.class); }
@Override public PropertyValue evaluteRawValue(String key, ConfigurationContext context) { PropertyValue unfilteredValue = null; for (PropertySource propertySource : context.getPropertySources()) { unfilteredValue = context.getPropertyValueCombinationPolicy(). collect(unfilteredValue, key, propertySource); } if(unfilteredValue==null || unfilteredValue.getValue()==null){ return unfilteredValue; } return unfilteredValue; }
@Override public String getName() { return delegate.getName(); }
private final ExpressionEvaluator evaluator(){ ExpressionEvaluator evaluator = ServiceContextManager.getServiceContext().getService(ExpressionEvaluator.class); if(evaluator==null){ throw new ConfigException("No ExpressionEvaluator registered."); } return evaluator; }
@Override public ConfigurationContextBuilder addDefaultPropertyFilters() { checkBuilderState(); for(PropertyFilter pf:ServiceContextManager.getServiceContext().getServices(PropertyFilter.class)){ addPropertyFilters(pf); } return this; }