public class MetafacadeBase extends Object implements Serializable, Comparable
Modifier and Type | Field and Description |
---|---|
protected boolean |
contextRoot
The flag indicating whether or not this metafacade is a context root.
|
protected Logger |
logger
The metafacade logger instance.
|
Constructor and Description |
---|
MetafacadeBase(Object metaObjectIn,
String contextIn)
Constructs a new instance of this class with the given
metaObject
and context . |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Object object)
Allow sorting and use in TreeSet.
|
boolean |
equals(Object object) |
Object |
getConfiguredProperty(String property)
Gets a configured property from the container.
|
(package private) String |
getContext()
Gets the context for this metafacade.
|
String |
getDebug()
For debug purposes, when we need more than just class and metaclass name
|
String |
getMetafacadeContext()
Gets the
context for this metafacade. |
(package private) String |
getMetafacadeName()
Gets the name for this metafacade.
|
(package private) String |
getMetafacadeNamespace()
Gets the current namespace for this metafacade
|
Object |
getMetaObject()
Gets the current meta model object for this metafacade.
|
String |
getValidationName()
Retrieves the
name of this metafacade used within the validation messages. |
Object |
getValidationOwner()
Retrieves the
owner of this metafacade (for example: an operation owns its parameters, a class owns
its attributes). |
int |
hashCode() |
void |
initialize()
A lifecycle method, providing the ability for sub classes to take any action after the factory has completely
initialized a metafacade, but before it has been validated for completeness.
|
protected boolean |
isConfiguredProperty(String property)
Returns true or false depending on whether the
property is registered or not. |
(package private) boolean |
isInitialized()
Indicates if this metafacade has been initialized.
|
boolean |
isMetafacadePropertyCachingEnabled()
A check to verify whether or not to make use of metafacade property caching.
|
void |
resetMetafacadeContext(String contextIn)
Resets the metafacade context after the metafacade was retrieved from the metafacade cache.
|
(package private) void |
setContextRoot(boolean contextRootIn)
Sets whether or not this metafacade represents a contextRoot.
|
(package private) void |
setInitialized()
Sets the flag indicating this metafacade has been initialized.
|
(package private) void |
setLogger(Logger loggerIn)
Package-local setter, called by facade factory.
|
void |
setMetafacadeContext(String contextIn)
Sets the context for this metafacade.
|
(package private) void |
setNamespace(String namespaceIn)
Sets the namespace for this metafacade.
|
protected void |
setProperty(String nameIn,
Object value)
Attempts to set the property with
name having the specified value on this metafacade. |
protected MetafacadeBase |
shieldedElement(Object metaObjectIn)
Returns one facade for a particular metaObject.
|
protected List |
shieldedElements(Collection metaobjects)
Returns a collection of facades for a collection of metaobjects.
|
protected MetafacadeBase |
THIS()
The metafacade instance of
this . |
String |
toString() |
void |
validate(Collection<ModelValidationMessage> validationMessages)
Validates that this facade's meta object is in a valid state.
|
void |
validateInvariants(Collection<ModelValidationMessage> messages)
The logic of modeled OCL invariants from derived metafacades will be generated into this method and validation
messages created and collected into the
messages collection. |
protected boolean contextRoot
public MetafacadeBase(Object metaObjectIn, String contextIn)
metaObject
and context
. The metaObject is the meta model element which
this metafacade insulates. The context
is the name of the
context for this metafacade instance.metaObjectIn
- the meta object.contextIn
- the context of this meta object.public Object getValidationOwner()
owner
of this metafacade (for example: an operation owns its parameters, a class owns
its attributes).
By default null
is returned, however this method is overridden by subclasses which have a
parent
or owner
. This is used to give the model validation messages more context as to
where the validation error occurred.
public String getValidationName()
name
of this metafacade used within the validation messages.
By default null
is returned, however this method is overridden by subclasses model elements that do
have a name.
final void setInitialized()
final boolean isInitialized()
public final void validate(Collection<ModelValidationMessage> validationMessages)
Validate is called during metafacade creation by the factory. In the lifecycle of a metafacade it is validated only once, this is enforced by the caching within the metafacade factory.
validationMessages
- any messages generated during validation.public void validateInvariants(Collection<ModelValidationMessage> messages)
The logic of modeled OCL invariants from derived metafacades will be generated into this method and validation
messages created and collected into the messages
collection. This method is called by validate(Collection validationMessages)
messages
- Collection of org.andromda.core.metafacade.ModelValidationMessagepublic void initialize()
protected MetafacadeBase shieldedElement(Object metaObjectIn)
metaObject
can also be a metafacade instance; in that case the actual
meta model element is retrieved from the metafacade and a metafacade is constructed from that.metaObjectIn
- the underlying meta model element. A metafacade is created for each.MetafacadeFactory
protected List shieldedElements(Collection metaobjects)
metaobjects
- the objects to decorateMetafacadeFactory
final String getContext()
public void setMetafacadeContext(String contextIn)
contextIn
- the metafacade interface name representing the context.MetafacadeMapping.isContextRoot()
public void resetMetafacadeContext(String contextIn)
contextIn
- the context defined by MetafacadeFactoryMetafacadeFactory
final String getMetafacadeNamespace()
final void setNamespace(String namespaceIn)
namespaceIn
- protected boolean isConfiguredProperty(String property)
property
is registered or not.property
- the name of the property to check.public Object getConfiguredProperty(String property)
property
- the property nameprotected void setProperty(String nameIn, Object value)
name
having the specified value
on this metafacade.nameIn
- value
- public final Object getMetaObject()
MetafacadeFactory
when
attempting to construct a metafacade from a metafacade. This allows us to get the meta object for this metafacade
so that the meta object can be used instead.final void setLogger(Logger loggerIn)
loggerIn
- the logger to setfinal void setContextRoot(boolean contextRootIn)
getMetafacadeContext()
returns the metafacade interface for this metafacade, otherwise the regular
context
is returned.contextRootIn
- public String getMetafacadeContext()
context
for this metafacade. This is either the contextRoot
(if one exists),
or the regular context
.final String getMetafacadeName()
public boolean equals(Object object)
equals
in class Object
Object.equals(Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public final boolean isMetafacadePropertyCachingEnabled()
MetafacadeProperties.ENABLE_METAFACADE_PROPERTY_CACHING
namespace property has been set, if this is not the case
then the caching will be enabled by default.protected final MetafacadeBase THIS()
this
. This should be used when
you'd need to check if this
was an instance of a given metafacade.
For example: THIS() instanceof SomeMetafacade
.
This MUST be used instead of this in order to access the correct
metafacade instance in the hierarchy (since we use delegate inheritance).public String toString()
toString
in class Object
Object.toString()
public int compareTo(Object object)
compareTo
in interface Comparable
Comparable.compareTo(Object)
public String getDebug()
Object.toString()
Copyright © 2003–2014 AndroMDA.org. All rights reserved.