public interface PropertyRepository
| Modifier and Type | Method and Description |
|---|---|
<T> Property<T> |
get(java.lang.String key,
java.lang.Class<T> type)
Fetch a property of a specific type.
|
<T> Property<T> |
get(java.lang.String key,
java.lang.reflect.Type type)
Fetch a property of a specific type.
|
default <V> Property<java.util.List<V>> |
getList(java.lang.String key,
java.lang.Class<V> listElementType)
Fetch a property with a
List value. |
default <K,V> Property<java.util.Map<K,V>> |
getMap(java.lang.String key,
java.lang.Class<K> mapKeyType,
java.lang.Class<V> mapValueType)
Fetch a property with a
Map value. |
default <V> Property<java.util.Set<V>> |
getSet(java.lang.String key,
java.lang.Class<V> setElementType)
Fetch a property with a
Set value. |
<T> Property<T> get(java.lang.String key, java.lang.Class<T> type)
Property object is returned regardless of
whether a key for it exists in the backing configuration. The Property is attached
to a dynamic configuration system and will have its value automatically updated
whenever the backing configuration is updated. Fallback properties and default values
may be specified through the Property API.
This method does not handle polymorphic return types such as collections. Use get(String, Type) or one
of the specialized utility methods in the interface for that case.
key - Property nametype - The type for the property value. This *can* be an array type, but not a primitive array
(ie, you can use Integer[].class but not int[].class)<T> Property<T> get(java.lang.String key, java.lang.reflect.Type type)
Property object is returned regardless of
whether a key for it exists in the backing configuration. The Property is attached
to a dynamic configuration system and will have its value automatically updated
whenever the backing configuration is updated. Fallback properties and default values
may be specified through the Property API.
Use this method to request polymorphic return types such as collections. See the utility methods in
ArchaiusType to get types for lists, sets and maps, or call the utility methods in this interface directly.
key - Property nametype - Type of property value.ArchaiusType.forListOf(Class),
ArchaiusType.forSetOf(Class),
ArchaiusType.forMapOf(Class, Class)default <V> Property<java.util.List<V>> getList(java.lang.String key, java.lang.Class<V> listElementType)
List value. This is just an utility wrapper around get(String, Type).
See that method's documentation for more details.default <V> Property<java.util.Set<V>> getSet(java.lang.String key, java.lang.Class<V> setElementType)
Set value. This is just an utility wrapper around get(String, Type).
See that method's documentation for more details.default <K,V> Property<java.util.Map<K,V>> getMap(java.lang.String key, java.lang.Class<K> mapKeyType, java.lang.Class<V> mapValueType)
Map value. This is just an utility wrapper around get(String, Type).
See that method's documentation for more details.