Brooklyn

brooklyn.entity.proxying
[Java] Class EntitySpec

java.lang.Object
  brooklyn.entity.proxying.EntitySpec
All Implemented Interfaces:
java.io.Serializable

public class EntitySpec

Gives details of an entity to be created. It describes the entity's configuration, and is reusable to create multiple entities with the same configuration. To create an EntitySpec, it is strongly encouraged to use create(Class) etc. Users who need to implement this are strongly encouraged to extend EntitySpec.

Parameters:
- The type of entity to be created
Authors:
aled


Constructor Summary
EntitySpec(java.lang.Class type)

 
Method Summary
EntitySpec addInitializer(EntityInitializer initializer)

EntitySpec addInitializer(java.lang.Class initializerType)

The supplied class must have a public no-arg constructor.

EntitySpec addInitializers(java.util.Collection initializer)

EntitySpec additionalInterfaces(java.lang.Class... vals)

EntitySpec additionalInterfaces(java.lang.Iterable val)

EntitySpec configure(java.util.Map val)

EntitySpec configure(java.lang.CharSequence key, java.lang.Object val)

EntitySpec configure(ConfigKey key, java.lang.Object val)

EntitySpec configure(ConfigKey key, Task val)

EntitySpec configure(HasConfigKey key, java.lang.Object val)

EntitySpec configure(HasConfigKey key, Task val)

static EntitySpec create(java.lang.Class type)

Creates a new EntitySpec instance for an entity of the given type.

static EntitySpec create(java.lang.Class type, java.lang.Class implType)

Creates a new EntitySpec instance for an entity of the given type.

static EntitySpec create(java.util.Map config, java.lang.Class type)

Creates a new EntitySpec instance with the given config, for an entity of the given type.

static EntitySpec create(EntitySpec spec)

Wraps an entity spec so its configuration can be overridden without modifying the original entity spec.

EntitySpec displayName(java.lang.String val)

EntitySpec enricher(Enricher val)

adds a policy to the spec

EntitySpec enricher(EnricherSpec val)

adds a policy to the spec

EntitySpec enricherSpecs(java.lang.Iterable val)

adds the supplied policies to the spec

EntitySpec enrichers(java.lang.Iterable val)

adds the supplied policies to the spec

java.util.Set getAdditionalInterfaces()

@return Additional interfaces (other than just getType()) that this entity implements; important for when accessing entity through a proxy to determine which interfaces the proxy exposes.

java.util.Map getConfig()

@return Read-only configuration values

java.lang.String getDisplayName()

@return The display name of the entity

java.util.List getEnricherSpecs()

java.util.List getEnrichers()

java.util.Map getFlags()

@return Read-only construction flags

java.lang.Class getImplementation()

@return The implementation of the entity; if not null. this overrides any defaults or other configuration

java.util.List getInitializers()

@return EntityInitializer objects which customize the entity to be created

Entity getParent()

@return The entity's parent

java.util.List getPolicies()

java.util.List getPolicySpecs()

java.lang.Class getType()

@return The type of the entity

EntitySpec immutable()

"seals" this spec, preventing any future changes

EntitySpec impl(java.lang.Class val)

static EntitySpec newInstance(java.lang.Class type)

EntitySpec parent(Entity val)

EntitySpec policies(java.lang.Iterable val)

adds the supplied policies to the spec

EntitySpec policy(Policy val)

adds a policy to the spec

EntitySpec policy(PolicySpec val)

adds a policy to the spec

EntitySpec policySpecs(java.lang.Iterable val)

adds the supplied policies to the spec

java.lang.String toString()

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

EntitySpec

public EntitySpec(java.lang.Class type)


 
Method Detail

addInitializer

public EntitySpec addInitializer(EntityInitializer initializer)


addInitializer

public EntitySpec addInitializer(java.lang.Class initializerType)
The supplied class must have a public no-arg constructor.


addInitializers

public EntitySpec addInitializers(java.util.Collection initializer)


additionalInterfaces

public EntitySpec additionalInterfaces(java.lang.Class... vals)


additionalInterfaces

public EntitySpec additionalInterfaces(java.lang.Iterable val)


configure

public EntitySpec configure(java.util.Map val)


configure

public EntitySpec configure(java.lang.CharSequence key, java.lang.Object val)


configure

public EntitySpec configure(ConfigKey key, java.lang.Object val)


configure

public EntitySpec configure(ConfigKey key, Task val)


configure

public EntitySpec configure(HasConfigKey key, java.lang.Object val)


configure

public EntitySpec configure(HasConfigKey key, Task val)


create

public static EntitySpec create(java.lang.Class type)
Creates a new EntitySpec instance for an entity of the given type. The returned EntitySpec can then be customized.
Parameters:
type - An Entity interface


create

public static EntitySpec create(java.lang.Class type, java.lang.Class implType)
Creates a new EntitySpec instance for an entity of the given type. The returned EntitySpec can then be customized.
Parameters:
type - An Entity interface
implType - An Entity implementation, which implements the type interface


create

public static EntitySpec create(java.util.Map config, java.lang.Class type)
Creates a new 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).
Parameters:
config - The spec's configuration (see EntitySpec#configure(Map)#configure(Map)).
type - An Entity interface


create

public static EntitySpec create(EntitySpec spec)
Wraps an entity spec so its configuration can be overridden without modifying the original entity spec.


displayName

public EntitySpec displayName(java.lang.String val)


enricher

public EntitySpec enricher(Enricher val)
adds a policy to the spec


enricher

public EntitySpec enricher(EnricherSpec val)
adds a policy to the spec


enricherSpecs

public EntitySpec enricherSpecs(java.lang.Iterable val)
adds the supplied policies to the spec


enrichers

public EntitySpec enrichers(java.lang.Iterable val)
adds the supplied policies to the spec


getAdditionalInterfaces

public java.util.Set getAdditionalInterfaces()
Returns:
Additional interfaces (other than just getType()) that this entity implements; important for when accessing entity through a proxy to determine which interfaces the proxy exposes.


getConfig

public java.util.Map getConfig()
Returns:
Read-only configuration values


getDisplayName

public java.lang.String getDisplayName()
Returns:
The display name of the entity


getEnricherSpecs

public java.util.List getEnricherSpecs()


getEnrichers

public java.util.List getEnrichers()


getFlags

public java.util.Map getFlags()
Returns:
Read-only construction flags
See Also:
SetFromFlag


getImplementation

@Nullable
public java.lang.Class getImplementation()
Returns:
The implementation of the entity; if not null. this overrides any defaults or other configuration
See Also:
ImplementedBy
EntityTypeRegistry


getInitializers

public java.util.List getInitializers()
Returns:
EntityInitializer objects which customize the entity to be created


getParent

public Entity getParent()
Returns:
The entity's parent


getPolicies

public java.util.List getPolicies()


getPolicySpecs

public java.util.List getPolicySpecs()


getType

public java.lang.Class getType()
Returns:
The type of the entity


immutable

public EntitySpec immutable()
"seals" this spec, preventing any future changes


impl

public EntitySpec impl(java.lang.Class val)


newInstance

public static EntitySpec newInstance(java.lang.Class type)


parent

public EntitySpec parent(Entity val)


policies

public EntitySpec policies(java.lang.Iterable val)
adds the supplied policies to the spec


policy

public EntitySpec policy(Policy val)
adds a policy to the spec


policy

public EntitySpec policy(PolicySpec val)
adds a policy to the spec


policySpecs

public EntitySpec policySpecs(java.lang.Iterable val)
adds the supplied policies to the spec


toString

@Override
public java.lang.String toString()


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.