T
- The type of entity to be createdpublic class EntitySpec<T extends Entity> extends AbstractBrooklynObjectSpec<T,EntitySpec<T>>
create(Class)
etc.
Users who need to implement this are strongly encouraged to extend
EntitySpec
.Constructor and Description |
---|
EntitySpec(java.lang.Class<T> type) |
Modifier and Type | Method and Description |
---|---|
EntitySpec<T> |
addInitializer(java.lang.Class<? extends EntityInitializer> initializerType)
The supplied class must have a public no-arg constructor.
|
EntitySpec<T> |
addInitializer(EntityInitializer initializer) |
EntitySpec<T> |
addInitializers(java.lang.Iterable<? extends EntityInitializer> initializers) |
EntitySpec<T> |
additionalInterfaces(java.lang.Class<?>... vals) |
EntitySpec<T> |
additionalInterfaces(java.lang.Iterable<java.lang.Class<?>> val) |
EntitySpec<T> |
child(EntitySpec<?> child)
The supplied class must have a public no-arg constructor.
|
EntitySpec<T> |
children(java.lang.Iterable<? extends EntitySpec<?>> children) |
void |
clearConfig()
Clears the config map, removing any config previously set.
|
EntitySpec<T> |
configure(java.lang.CharSequence key,
java.lang.Object val) |
<V> EntitySpec<T> |
configure(ConfigKey.HasConfigKey<V> key,
Task<? extends V> val) |
<V> EntitySpec<T> |
configure(ConfigKey.HasConfigKey<V> key,
V val) |
<V> EntitySpec<T> |
configure(ConfigKey<V> key,
com.google.common.base.Supplier<? extends V> val) |
<V> EntitySpec<T> |
configure(ConfigKey<V> key,
Task<? extends V> val) |
<V> EntitySpec<T> |
configure(ConfigKey<V> key,
V val) |
EntitySpec<T> |
configure(java.util.Map<?,?> val)
strings inserted as flags, config keys inserted as config keys;
if you want to force one or the other, create a ConfigBag and convert to the appropriate map type
|
static <T extends Entity> |
create(java.lang.Class<T> type)
Creates a new
EntitySpec instance for an entity of the given type. |
static <T extends Entity,U extends T> |
create(java.lang.Class<T> type,
java.lang.Class<U> implType)
Creates a new
EntitySpec instance for an entity of the given type. |
static <T extends Entity> |
create(EntitySpec<T> spec)
Copies entity spec so its configuration can be overridden without modifying the
original entity spec.
|
static <T extends Entity> |
create(java.util.Map<?,?> config,
java.lang.Class<T> type)
Creates a new
EntitySpec instance with the given config, for an entity of the given type. |
<V> EntitySpec<T> |
enricher(Enricher val)
adds a policy to the spec
|
<V> EntitySpec<T> |
enricher(EnricherSpec<?> val)
adds a policy to the spec
|
<V> EntitySpec<T> |
enrichers(java.lang.Iterable<? extends Enricher> val)
adds the supplied policies to the spec
|
<V> EntitySpec<T> |
enricherSpecs(java.lang.Iterable<? extends EnricherSpec<?>> val)
adds the supplied policies to the spec
|
java.util.Set<java.lang.Class<?>> |
getAdditionalInterfaces() |
java.util.List<EntitySpec<?>> |
getChildren() |
java.util.Map<ConfigKey<?>,java.lang.Object> |
getConfig() |
java.util.List<Enricher> |
getEnrichers() |
java.util.List<EnricherSpec<?>> |
getEnricherSpecs() |
java.util.Map<java.lang.String,?> |
getFlags() |
java.util.List<Group> |
getGroups() |
java.lang.String |
getId()
Deprecated.
since 0.7.0; instead let the management context pick a random+unique id
|
java.lang.Class<? extends T> |
getImplementation() |
java.util.List<EntityInitializer> |
getInitializers() |
java.util.List<Location> |
getLocations() |
java.util.List<Entity> |
getMembers() |
Entity |
getParent() |
java.util.List<Policy> |
getPolicies() |
java.util.List<PolicySpec<?>> |
getPolicySpecs() |
java.lang.Class<T> |
getType() |
EntitySpec<T> |
group(Group group) |
EntitySpec<T> |
groups(java.lang.Iterable<? extends Group> groups) |
EntitySpec<T> |
id(java.lang.String val)
Deprecated.
since 0.7.0; instead let the management context pick a random+unique id
|
EntitySpec<T> |
immutable()
"seals" this spec, preventing any future changes
|
EntitySpec<T> |
impl(java.lang.Class<? extends T> val) |
<V> EntitySpec<T> |
location(Location val)
adds a location to the spec
|
<V> EntitySpec<T> |
locations(java.lang.Iterable<? extends Location> val)
adds the supplied locations to the spec
|
EntitySpec<T> |
member(Entity member) |
EntitySpec<T> |
members(java.lang.Iterable<? extends Entity> members) |
static <T extends Entity> |
newInstance(java.lang.Class<T> type) |
EntitySpec<T> |
parent(Entity val) |
<V> EntitySpec<T> |
policies(java.lang.Iterable<? extends Policy> val)
adds the supplied policies to the spec
|
<V> EntitySpec<T> |
policy(Policy val)
adds a policy to the spec
|
<V> EntitySpec<T> |
policy(PolicySpec<?> val)
adds a policy to the spec
|
<V> EntitySpec<T> |
policySpecs(java.lang.Iterable<? extends PolicySpec<?>> val)
adds the supplied policies to the spec
|
catalogItemId, displayName, equals, getCatalogItemId, getDisplayName, getTags, hashCode, tag, tags, toString
public EntitySpec(java.lang.Class<T> type)
public static <T extends Entity> EntitySpec<T> create(java.lang.Class<T> type)
EntitySpec
instance for an entity of the given type. The returned
EntitySpec
can then be customized.type
- An Entity
interfacepublic static <T extends Entity,U extends T> EntitySpec<T> create(java.lang.Class<T> type, java.lang.Class<U> implType)
EntitySpec
instance for an entity of the given type. The returned
EntitySpec
can then be customized.public static <T extends Entity> EntitySpec<T> create(java.util.Map<?,?> config, java.lang.Class<T> type)
EntitySpec
instance with the given config, for an entity of the given type.
This is primarily for groovy code; equivalent to EntitySpec.create(type).configure(config)
.config
- The spec's configuration (see configure(Map)
).type
- An Entity
interfacepublic static <T extends Entity> EntitySpec<T> create(EntitySpec<T> spec)
public static <T extends Entity> EntitySpec<T> newInstance(java.lang.Class<T> type)
public java.lang.Class<T> getType()
getType
in class AbstractBrooklynObjectSpec<T extends Entity,EntitySpec<T extends Entity>>
@Deprecated public java.lang.String getId()
@Nullable public java.lang.Class<? extends T> getImplementation()
on the entity interface classes for how defaults are defined.
,
for how implementations can be defined globally
public java.util.Set<java.lang.Class<?>> getAdditionalInterfaces()
getType()
) that this entity implements;
important for when accessing entity through a proxy to determine which interfaces the proxy exposes.public java.util.List<EntityInitializer> getInitializers()
EntityInitializer
objects which customize the entity to be createdpublic java.util.List<EntitySpec<?>> getChildren()
public java.util.List<Entity> getMembers()
public java.util.List<Group> getGroups()
public Entity getParent()
public java.util.Map<java.lang.String,?> getFlags()
declarations on the entity type
public java.util.Map<ConfigKey<?>,java.lang.Object> getConfig()
public void clearConfig()
public java.util.List<PolicySpec<?>> getPolicySpecs()
public java.util.List<Policy> getPolicies()
public java.util.List<EnricherSpec<?>> getEnricherSpecs()
public java.util.List<Enricher> getEnrichers()
public java.util.List<Location> getLocations()
@Deprecated public EntitySpec<T> id(java.lang.String val)
public EntitySpec<T> impl(java.lang.Class<? extends T> val)
public EntitySpec<T> additionalInterfaces(java.lang.Class<?>... vals)
public EntitySpec<T> additionalInterfaces(java.lang.Iterable<java.lang.Class<?>> val)
public EntitySpec<T> addInitializer(EntityInitializer initializer)
public EntitySpec<T> addInitializers(java.lang.Iterable<? extends EntityInitializer> initializers)
public EntitySpec<T> addInitializer(java.lang.Class<? extends EntityInitializer> initializerType)
public EntitySpec<T> children(java.lang.Iterable<? extends EntitySpec<?>> children)
public EntitySpec<T> child(EntitySpec<?> child)
public EntitySpec<T> members(java.lang.Iterable<? extends Entity> members)
public EntitySpec<T> member(Entity member)
public EntitySpec<T> groups(java.lang.Iterable<? extends Group> groups)
public EntitySpec<T> group(Group group)
public EntitySpec<T> parent(Entity val)
public EntitySpec<T> configure(java.util.Map<?,?> val)
public EntitySpec<T> configure(java.lang.CharSequence key, java.lang.Object val)
public <V> EntitySpec<T> configure(ConfigKey<V> key, V val)
public <V> EntitySpec<T> configure(ConfigKey<V> key, Task<? extends V> val)
public <V> EntitySpec<T> configure(ConfigKey<V> key, com.google.common.base.Supplier<? extends V> val)
public <V> EntitySpec<T> configure(ConfigKey.HasConfigKey<V> key, V val)
public <V> EntitySpec<T> configure(ConfigKey.HasConfigKey<V> key, Task<? extends V> val)
public <V> EntitySpec<T> policy(Policy val)
public <V> EntitySpec<T> policy(PolicySpec<?> val)
public <V> EntitySpec<T> policySpecs(java.lang.Iterable<? extends PolicySpec<?>> val)
public <V> EntitySpec<T> policies(java.lang.Iterable<? extends Policy> val)
public <V> EntitySpec<T> enricher(Enricher val)
public <V> EntitySpec<T> enricher(EnricherSpec<?> val)
public <V> EntitySpec<T> enricherSpecs(java.lang.Iterable<? extends EnricherSpec<?>> val)
public <V> EntitySpec<T> enrichers(java.lang.Iterable<? extends Enricher> val)
public <V> EntitySpec<T> location(Location val)
public <V> EntitySpec<T> locations(java.lang.Iterable<? extends Location> val)
public EntitySpec<T> immutable()