public final class PropertySourceFunctions extends Object
Modifier and Type | Method and Description |
---|---|
static org.apache.tamaya.spi.PropertySource |
addItems(org.apache.tamaya.spi.PropertySource propertySource,
Map<String,String> items)
Creates an operator that adds items to the instance.
|
static org.apache.tamaya.spi.PropertySource |
addItems(org.apache.tamaya.spi.PropertySource propertySource,
Map<String,String> items,
boolean override)
Creates a ConfigOperator that adds the given items.
|
static org.apache.tamaya.spi.PropertySource |
emptyPropertySource()
Accesses an empty PropertySource.
|
static Collection<? extends org.apache.tamaya.spi.PropertySource> |
findPropertySourcesByName(String expression)
Find all
PropertySource instances managed by the current
ConfigurationContext that are assignable to the given type. |
static <T> T |
getPropertySource(Class<T> type)
Get a list of all
PropertySource instances managed by the current
ConfigurationContext that are assignable to the given type. |
static <T> Collection<T> |
getPropertySources(Class<T> type)
Get a list of all
PropertySource instances managed by the current
ConfigurationContext that are assignable to the given type. |
static boolean |
isKeyInSection(String key,
String sectionKey)
Calculates the current section key and compares it to the given key.
|
static boolean |
isKeyInSections(String key,
String... sectionKeys)
Calculates the current section key and compares it to the given section keys.
|
static org.apache.tamaya.spi.PropertySource |
replaceItems(org.apache.tamaya.spi.PropertySource propertySource,
Map<String,String> items)
Creates an operator that replaces the given items.
|
static Map<String,String> |
sectionRecursive(Map<String,String> properties,
boolean stripKeys,
String... sectionKeys)
Creates a ConfigOperator that creates a Configuration containing only keys
that are contained in the given section (recursive).
|
static Set<String> |
sections(Map<String,String> properties)
Return a query to evaluate the set with all fully qualified section names.
|
static Set<String> |
sections(Map<String,String> properties,
Predicate<String> predicate)
Return a query to evaluate the set with all fully qualified section names, containing only the
sections that match the predicate and have properties attached.
|
static Map<String,String> |
sectionsRecursive(Map<String,String> properties,
String... sectionKeys)
Creates a ConfigOperator that creates a Configuration containing only keys
that are contained in the given section (recursive).
|
static Set<String> |
transitiveSections(Map<String,String> properties)
Return a query to evaluate the set with all fully qualified section names, containing the transitive closure also including all
subarea names, regardless if properties are accessible or not.
|
static Set<String> |
transitiveSections(Map<String,String> properties,
Predicate<String> predicate)
Return a query to evaluate the set with all fully qualified section names, containing the transitive closure also including all
subarea names, regardless if properties are accessible or not.
|
public static boolean isKeyInSection(String key, String sectionKey)
key
- the fully qualified entry key, not nullsectionKey
- the section key, not nullpublic static boolean isKeyInSections(String key, String... sectionKeys)
key
- the fully qualified entry key, not nullsectionKeys
- the section keys, not nullpublic static Set<String> sections(Map<String,String> properties)
properties
- properties to find sections in.null
.public static Set<String> transitiveSections(Map<String,String> properties)
properties
- properties to find transitive sections in.null
.public static Set<String> sections(Map<String,String> properties, Predicate<String> predicate)
properties
- properties to find sections in.predicate
- A predicate to determine, which sections should be returned, not null
.null
.public static Set<String> transitiveSections(Map<String,String> properties, Predicate<String> predicate)
properties
- properties to find transitive sections in.predicate
- A predicate to determine, which sections should be returned, not null
.null
.public static Map<String,String> sectionsRecursive(Map<String,String> properties, String... sectionKeys)
properties
- properties to find recursive sections in.sectionKeys
- the section keys, not nullpublic static Map<String,String> sectionRecursive(Map<String,String> properties, boolean stripKeys, String... sectionKeys)
properties
- properties to find sections in.sectionKeys
- the section keys, not nullstripKeys
- if set to true, the section key is stripped away fromMap the resulting key.public static org.apache.tamaya.spi.PropertySource addItems(org.apache.tamaya.spi.PropertySource propertySource, Map<String,String> items, boolean override)
propertySource
- source property source that is changed.items
- the items to be added/replaced.override
- if true, all items existing are overridden by the new ones passed.public static org.apache.tamaya.spi.PropertySource addItems(org.apache.tamaya.spi.PropertySource propertySource, Map<String,String> items)
propertySource
- source property source that is changed.items
- the items, not null.public static org.apache.tamaya.spi.PropertySource replaceItems(org.apache.tamaya.spi.PropertySource propertySource, Map<String,String> items)
propertySource
- source property source that is changed.items
- the items.public static org.apache.tamaya.spi.PropertySource emptyPropertySource()
public static Collection<? extends org.apache.tamaya.spi.PropertySource> findPropertySourcesByName(String expression)
PropertySource
instances managed by the current
ConfigurationContext
that are assignable to the given type.expression
- the regular expression to match the source's name.PropertySource
instances matching, never null.public static <T> Collection<T> getPropertySources(Class<T> type)
PropertySource
instances managed by the current
ConfigurationContext
that are assignable to the given type.T
- the type of the property source instances requestedtype
- target type to filter for property sources.PropertySource
instances matching, never null.public static <T> T getPropertySource(Class<T> type)
PropertySource
instances managed by the current
ConfigurationContext
that are assignable to the given type.T
- the type of the property source instances requestedtype
- target type to filter for property sources.PropertySource
instances matching, never null.Copyright © 2014–2016 Apache Software Foundation. All rights reserved.