public class BasicConfigKey<T> extends java.lang.Object implements ConfigKeySelfExtracting<T>, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
BasicConfigKey.BasicConfigKeyOverwriting<T>
used to record a key which overwrites another; only needed at disambiguation time
if a class declares a key and an equivalent one (often inherited) which overwrites it.
|
static class |
BasicConfigKey.Builder<T> |
ConfigKey.HasConfigKey<T>
Constructor and Description |
---|
BasicConfigKey() |
BasicConfigKey(java.lang.Class<T> type,
java.lang.String name) |
BasicConfigKey(java.lang.Class<T> type,
java.lang.String name,
java.lang.String description) |
BasicConfigKey(java.lang.Class<T> type,
java.lang.String name,
java.lang.String description,
T defaultValue) |
BasicConfigKey(com.google.common.reflect.TypeToken<T> type,
java.lang.String name) |
BasicConfigKey(com.google.common.reflect.TypeToken<T> type,
java.lang.String name,
java.lang.String description) |
BasicConfigKey(com.google.common.reflect.TypeToken<T> type,
java.lang.String name,
java.lang.String description,
T defaultValue) |
Modifier and Type | Method and Description |
---|---|
static <T> BasicConfigKey.Builder<T> |
builder(java.lang.Class<T> type) |
static <T> BasicConfigKey.Builder<T> |
builder(java.lang.Class<T> type,
java.lang.String name) |
static <T> BasicConfigKey.Builder<T> |
builder(ConfigKey<T> key) |
static <T> BasicConfigKey.Builder<T> |
builder(com.google.common.reflect.TypeToken<T> type) |
static <T> BasicConfigKey.Builder<T> |
builder(com.google.common.reflect.TypeToken<T> type,
java.lang.String name) |
boolean |
equals(java.lang.Object obj) |
T |
extractValue(java.util.Map<?,?> vals,
ExecutionContext exec)
Retrieves the value corresponding to this config key from the given map.
|
T |
getDefaultValue()
Returns the default value of the configuration parameter.
|
java.lang.String |
getDescription()
Returns the description of the configuration parameter, for display.
|
ConfigInheritance |
getInheritance() |
java.lang.String |
getName()
Returns the name of the configuration parameter, in a dot-separated namespace (FQN).
|
java.util.Collection<java.lang.String> |
getNameParts()
Returns the constituent parts of the configuration parameter name as a
Collection . |
java.lang.Class<? super T> |
getType()
Returns the type of the configuration parameter data.
|
java.lang.String |
getTypeName()
Returns the name of of the configuration parameter data type, as a
String . |
com.google.common.reflect.TypeToken<T> |
getTypeToken()
Returns the Guava TypeToken, including info on generics.
|
boolean |
hasDefaultValue()
Returns true if a default configuration value has been set.
|
int |
hashCode() |
boolean |
isReconfigurable() |
boolean |
isSet(java.util.Map<?,?> vals) |
java.lang.String |
toString() |
public BasicConfigKey()
public BasicConfigKey(java.lang.Class<T> type, java.lang.String name)
public BasicConfigKey(java.lang.Class<T> type, java.lang.String name, java.lang.String description)
public BasicConfigKey(java.lang.Class<T> type, java.lang.String name, java.lang.String description, T defaultValue)
public BasicConfigKey(com.google.common.reflect.TypeToken<T> type, java.lang.String name)
public BasicConfigKey(com.google.common.reflect.TypeToken<T> type, java.lang.String name, java.lang.String description)
public static <T> BasicConfigKey.Builder<T> builder(com.google.common.reflect.TypeToken<T> type)
public static <T> BasicConfigKey.Builder<T> builder(java.lang.Class<T> type)
public static <T> BasicConfigKey.Builder<T> builder(com.google.common.reflect.TypeToken<T> type, java.lang.String name)
public static <T> BasicConfigKey.Builder<T> builder(java.lang.Class<T> type, java.lang.String name)
public static <T> BasicConfigKey.Builder<T> builder(ConfigKey<T> key)
public java.lang.String getName()
ConfigKey
getName
in interface ConfigKey<T>
ConfigKey.getName()
public java.lang.String getTypeName()
ConfigKey
String
.getTypeName
in interface ConfigKey<T>
ConfigKey.getTypeName()
public java.lang.Class<? super T> getType()
ConfigKey
This returns a "super" of T only in the case where T is generified,
and in such cases it returns the Class instance for the unadorned T ---
i.e. for List ---
this is of course because there is no actual Class
> instance.
getType
in interface ConfigKey<T>
ConfigKey.getType()
public com.google.common.reflect.TypeToken<T> getTypeToken()
ConfigKey
getTypeToken
in interface ConfigKey<T>
ConfigKey.getTypeToken()
public java.lang.String getDescription()
ConfigKey
getDescription
in interface ConfigKey<T>
ConfigKey.getDescription()
public T getDefaultValue()
ConfigKey
getDefaultValue
in interface ConfigKey<T>
ConfigKey.getDefaultValue()
public boolean hasDefaultValue()
ConfigKey
hasDefaultValue
in interface ConfigKey<T>
ConfigKey.hasDefaultValue()
public boolean isReconfigurable()
isReconfigurable
in interface ConfigKey<T>
@Nullable public ConfigInheritance getInheritance()
getInheritance
in interface ConfigKey<T>
null
for the default in any context.public java.util.Collection<java.lang.String> getNameParts()
ConfigKey
Collection
.getNameParts
in interface ConfigKey<T>
ConfigKey.getNameParts()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public T extractValue(java.util.Map<?,?> vals, ExecutionContext exec)
extractValue
in interface ConfigKeySelfExtracting<T>
public boolean isSet(java.util.Map<?,?> vals)
isSet
in interface ConfigKeySelfExtracting<T>