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,B extends BasicConfigKey.Builder<T,B>> |
ConfigKey.HasConfigKey<T>
Constructor and Description |
---|
BasicConfigKey() |
BasicConfigKey(<any> type,
java.lang.String name) |
BasicConfigKey(<any> type,
java.lang.String name,
java.lang.String description) |
BasicConfigKey(<any> type,
java.lang.String name,
java.lang.String description,
T defaultValue) |
BasicConfigKey(BasicConfigKey.Builder<T,?> builder) |
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) |
Modifier and Type | Method and Description |
---|---|
static <T> BasicConfigKey.Builder<T,?> |
builder(<any> type) |
static <T> BasicConfigKey.Builder<T,?> |
builder(<any> type,
java.lang.String name) |
static <T> BasicConfigKey.Builder<T,?> |
builder(java.lang.String newName,
ConfigKey<T> key) |
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.
|
<any> |
getConstraint() |
T |
getDefaultValue()
Returns the default value of the configuration parameter.
|
java.util.Collection<java.lang.String> |
getDeprecatedNames()
Returns deprecated names that will could also be used, but that are discouraged and will
likely not be supported for the given config key in future versions.
|
java.lang.String |
getDescription()
Returns the description of the configuration parameter, for display.
|
ConfigInheritance |
getInheritance()
Deprecated.
|
java.util.Map<ConfigInheritance.ConfigInheritanceContext,ConfigInheritance> |
getInheritanceByContext() |
ConfigInheritance |
getInheritanceByContext(ConfigInheritance.ConfigInheritanceContext context) |
java.lang.String |
getName()
Returns the name of the configuration parameter, in a dot-separated namespace (FQN).
|
java.util.Collection<java.lang.String> |
getNameParts()
Deprecated.
|
ConfigInheritance |
getParentInheritance()
Deprecated.
|
java.lang.Class<? super T> |
getType()
Returns the type of the configuration parameter data.
|
ConfigInheritance |
getTypeInheritance()
Deprecated.
|
java.lang.String |
getTypeName()
Returns the name of of the configuration parameter data type, as a
String . |
<any> |
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) |
boolean |
isValueValid(T value) |
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(<any> type, java.lang.String name)
public BasicConfigKey(<any> type, java.lang.String name, java.lang.String description)
public BasicConfigKey(<any> type, java.lang.String name, java.lang.String description, T defaultValue)
public BasicConfigKey(BasicConfigKey.Builder<T,?> builder)
public static <T> BasicConfigKey.Builder<T,?> builder(<any> type)
public static <T> BasicConfigKey.Builder<T,?> builder(<any> type, java.lang.String name)
public static <T> BasicConfigKey.Builder<T,?> builder(java.lang.String newName, ConfigKey<T> key)
public java.lang.String getName()
ConfigKey
getName
in interface ConfigKey<T>
ConfigKey.getName()
public java.util.Collection<java.lang.String> getDeprecatedNames()
ConfigKey
getDeprecatedNames
in interface ConfigKey<T>
ConfigKey.getDeprecatedNames()
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<String> this returns Class<List> --- this is of course because there is no actual Class<List<String>> instance.
getType
in interface ConfigKey<T>
ConfigKey.getType()
public <any> 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>
ConfigKey.isReconfigurable()
@Nullable public ConfigInheritance getInheritanceByContext(ConfigInheritance.ConfigInheritanceContext context)
getInheritanceByContext
in interface ConfigKey<T>
ConfigInheritance.ConfigInheritanceContext
public java.util.Map<ConfigInheritance.ConfigInheritanceContext,ConfigInheritance> getInheritanceByContext()
getInheritanceByContext
in interface ConfigKey<T>
ConfigInheritance.ConfigInheritanceContext
instances.
Implementations may have a simple map, whereas others could be more sophisticated.
#getInheritanceByContext(ConfigInheritanceContext)
may be preferred if inheritance contexts are complex
(but usually, and in brooklyn, they aren't).@Deprecated @Nullable public ConfigInheritance getInheritance()
getInheritance
in interface ConfigKey<T>
null
for the default in any context.@Deprecated @Nullable public ConfigInheritance getTypeInheritance()
getTypeInheritance
in interface ConfigKey<T>
null
for the default in any context.@Deprecated @Nullable public ConfigInheritance getParentInheritance()
getParentInheritance
in interface ConfigKey<T>
null
for the default in any context.@Nonnull public <any> getConstraint()
getConstraint
in interface ConfigKey<T>
ConfigKey.getConstraint()
public boolean isValueValid(T value)
isValueValid
in interface ConfigKey<T>
value
- The value to testconstraints
on this key.ConfigKey#isValueValid(T)
@Deprecated 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>