brooklyn.policy
Class PolicySpec<T extends Policy>
java.lang.Object
brooklyn.policy.PolicySpec<T>
- Type Parameters:
T - The type of policy to be created
- All Implemented Interfaces:
- Serializable
public class PolicySpec<T extends Policy>
- extends Object
- implements Serializable
Gives details of a policy to be created. It describes the policy's configuration, and is
reusable to create multiple policies with the same configuration.
To create a PolicySpec, it is strongly encouraged to use create(...) methods.
- See Also:
- Serialized Form
|
Method Summary |
PolicySpec<T> |
configure(CharSequence key,
Object val)
|
|
configure(brooklyn.config.ConfigKey.HasConfigKey<V> key,
Task<? extends V> val)
|
|
configure(brooklyn.config.ConfigKey.HasConfigKey<V> key,
V val)
|
|
configure(brooklyn.config.ConfigKey<V> key,
Task<? extends V> val)
|
|
configure(brooklyn.config.ConfigKey<V> key,
V val)
|
PolicySpec<T> |
configure(Map<?,?> val)
|
|
configureIfNotNull(brooklyn.config.ConfigKey<V> key,
V val)
|
static
|
create(Class<T> type)
Creates a new PolicySpec instance for a policy of the given type. |
static
|
create(Map<?,?> config,
Class<T> type)
Creates a new PolicySpec instance with the given config, for a policy of the given type. |
PolicySpec<T> |
displayName(String val)
|
Map<brooklyn.config.ConfigKey<?>,Object> |
getConfig()
|
String |
getDisplayName()
|
Map<String,?> |
getFlags()
|
Class<T> |
getType()
|
String |
toString()
|
PolicySpec
protected PolicySpec(Class<T> type)
create
public static <T extends Policy> PolicySpec<T> create(Class<T> type)
- Creates a new
PolicySpec instance for a policy of the given type. The returned
PolicySpec can then be customized.
- Parameters:
type - A Policy class
create
public static <T extends Policy> PolicySpec<T> create(Map<?,?> config,
Class<T> type)
- Creates a new
PolicySpec instance with the given config, for a policy of the given type.
This is primarily for groovy code; equivalent to PolicySpec.create(type).configure(config).
- Parameters:
config - The spec's configuration (see configure(Map)).type - A Policy class
displayName
public PolicySpec<T> displayName(String val)
configure
public PolicySpec<T> configure(Map<?,?> val)
configure
public PolicySpec<T> configure(CharSequence key,
Object val)
configure
public <V> PolicySpec<T> configure(brooklyn.config.ConfigKey<V> key,
V val)
configureIfNotNull
public <V> PolicySpec<T> configureIfNotNull(brooklyn.config.ConfigKey<V> key,
V val)
configure
public <V> PolicySpec<T> configure(brooklyn.config.ConfigKey<V> key,
Task<? extends V> val)
configure
public <V> PolicySpec<T> configure(brooklyn.config.ConfigKey.HasConfigKey<V> key,
V val)
configure
public <V> PolicySpec<T> configure(brooklyn.config.ConfigKey.HasConfigKey<V> key,
Task<? extends V> val)
getType
public Class<T> getType()
- Returns:
- The type of the policy
getDisplayName
public String getDisplayName()
- Returns:
- The display name of the policy
getFlags
public Map<String,?> getFlags()
- Returns:
- Read-only construction flags
- See Also:
declarations on the policy type
getConfig
public Map<brooklyn.config.ConfigKey<?>,Object> getConfig()
- Returns:
- Read-only configuration values
toString
public String toString()
- Overrides:
toString in class Object
Copyright © 2013. All Rights Reserved.