public abstract class ProxyEntity extends ParamsEntity
Each instance of a subclass keeps a reference to an implementation of the interface associated with the type of entity that it represents.
Modifier and Type | Class and Description |
---|---|
static class |
ProxyEntity.Builder
Builder.
|
UUID_COMPARATOR
Modifier | Constructor and Description |
---|---|
protected |
ProxyEntity(Optional<String> name,
Optional<UUID> uuid,
Optional<KeyedGroups> attributes,
Optional<Map<String,Text>> texts,
Optional<Params> params,
Optional<ClassDefEntity> classDef,
Optional<Proxied> instance)
Constructs an instance.
|
Modifier and Type | Method and Description |
---|---|
void |
clearInstance()
Clears the proxied instance.
|
protected Proxied |
createDefaultInstance()
Creates a default instance.
|
boolean |
equals(Object other)
|
Optional<ClassDefEntity> |
getClassDef()
Gets the class definition.
|
protected Optional<? extends Proxied> |
getInstance()
Gets the proxied instance.
|
ProxyEntity |
getProxy(Proxied instance)
Gets a proxy for the supplied instance.
|
int |
hashCode() |
boolean |
is(Class<?> classObject)
Asks if the proxied entity implements an interface.
|
boolean |
is(String className)
Asks if the proxied entity implements an interface.
|
void |
setInstance(Proxied instance)
Sets the proxied instance.
|
boolean |
setUp(Metadata metadata)
Sets up the proxied object.
|
void |
tearDown()
Tears down what has been set up.
|
getParams, setParams
addText, getAttributes, getAttributes, getTexts, setAttributes
compareTo, getName, getNameInUpperCase, getThisLogger, getUUID, setName, setUUID, toString
copy, getElementName, getPrefix, getReferenceName
protected ProxyEntity(@Nonnull Optional<String> name, @Nonnull Optional<UUID> uuid, @Nonnull Optional<KeyedGroups> attributes, @Nonnull Optional<Map<String,Text>> texts, @Nonnull Optional<Params> params, @Nonnull Optional<ClassDefEntity> classDef, @Nonnull Optional<Proxied> instance)
name
- The optional entity name.uuid
- The optional entity UUID.attributes
- The optional attributes.texts
- The optional texts.params
- The optional params.classDef
- The optional class definition.instance
- The optional proxied instance.public final void clearInstance()
public boolean equals(Object other)
For two Entity
to be equal, they must at least be instances of
the same class, have the same UUID
and name.
For two Metadata
Entity
to be equal, they must at
least be instances of the same class, have the same UUID
,
Attributes
, name and descriptive texts.
equals
in class ParamsEntity
@Nonnull @CheckReturnValue public final Optional<ClassDefEntity> getClassDef()
@Nonnull @CheckReturnValue public final ProxyEntity getProxy(@Nonnull Proxied instance)
instance
- The instance to be proxied.public int hashCode()
hashCode
in class ParamsEntity
@CheckReturnValue public final boolean is(Class<?> classObject) throws UndefinedEntityException
classObject
- A class object.UndefinedEntityException
- When the interface is undefined.@CheckReturnValue public final boolean is(String className) throws UndefinedEntityException
className
- The name of the class or interface.UndefinedEntityException
- When the interface is undefined.public final void setInstance(@Nonnull Proxied instance)
instance
- The proxied instance.@CheckReturnValue public boolean setUp(@Nonnull Metadata metadata)
Note: this method must be prepared to be called redundantly. Such calls happen during the normal setup of the points in a processor.
metadata
- The metadata.public void tearDown()
@Nonnull @CheckReturnValue protected Proxied createDefaultInstance()
This must be overriden by the subclass when the 'classDef' attribute is optional; otherwise, it will always fail.
@Nonnull @CheckReturnValue protected final Optional<? extends Proxied> getInstance()
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.