LinkEndFacadeLogic.java
// license-header java merge-point
//
// Attention: generated code (by MetafacadeLogic.vsl) - do not modify!
//
package org.andromda.metafacades.emf.uml22;
import java.util.Collection;
import java.util.List;
import org.andromda.core.metafacade.MetafacadeBase;
import org.andromda.core.metafacade.ModelValidationMessage;
import org.andromda.metafacades.uml.AssociationEndFacade;
import org.andromda.metafacades.uml.InstanceFacade;
import org.andromda.metafacades.uml.LinkEndFacade;
import org.andromda.metafacades.uml.LinkFacade;
import org.apache.log4j.Logger;
/**
* Can be an AttributeLinkImpl or LinkEndImpl. A representation of the model object 'Slot'. A slot
* specifies that an entity modeled by an instance specification has a value or values for a
* specific structural feature.
* MetafacadeLogic for LinkEndFacade
*
* @see LinkEndFacade
*/
public abstract class LinkEndFacadeLogic
extends ModelElementFacadeLogicImpl
implements LinkEndFacade
{
/**
* The underlying UML object
* @see LinkEnd
*/
protected LinkEnd metaObject;
/** Create Metafacade implementation instance using the MetafacadeFactory from the context
* @param metaObjectIn
* @param context
*/
protected LinkEndFacadeLogic(LinkEnd metaObjectIn, String context)
{
super(metaObjectIn, getContext(context));
this.metaObject = metaObjectIn;
}
/**
* The logger instance.
*/
private static final Logger logger = Logger.getLogger(LinkEndFacadeLogic.class);
/**
* Gets the context for this metafacade logic instance.
* @param context String. Set to LinkEndFacade if null
* @return context String
*/
private static String getContext(String context)
{
if (context == null)
{
context = "org.andromda.metafacades.uml.LinkEndFacade";
}
return context;
}
/** Reset context only for non-root metafacades
* @param context
*/
@Override
public void resetMetafacadeContext(String context)
{
if (!this.contextRoot) // reset context only for non-root metafacades
{
context = getContext(context); // to have same value as in original constructor call
setMetafacadeContext (context);
}
}
/**
* @return boolean true always
* @see LinkEndFacade
*/
public boolean isLinkEndFacadeMetaType()
{
return true;
}
// ------------- associations ------------------
private LinkFacade __getLink1r;
private boolean __getLink1rSet = false;
/**
* The two links ends owned by this link.
* @return (LinkFacade)handleGetLink()
*/
public final LinkFacade getLink()
{
LinkFacade getLink1r = this.__getLink1r;
if (!this.__getLink1rSet)
{
// linkEnds has no pre constraints
Object result = handleGetLink();
MetafacadeBase shieldedResult = this.shieldedElement(result);
try
{
getLink1r = (LinkFacade)shieldedResult;
}
catch (ClassCastException ex)
{
// Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
LinkEndFacadeLogic.logger.warn("incorrect metafacade cast for LinkEndFacadeLogic.getLink LinkFacade " + result + ": " + shieldedResult);
}
// linkEnds has no post constraints
this.__getLink1r = getLink1r;
if (isMetafacadePropertyCachingEnabled())
{
this.__getLink1rSet = true;
}
}
return getLink1r;
}
/**
* UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
* @return Object
*/
protected abstract Object handleGetLink();
private AssociationEndFacade __getAssociationEnd2r;
private boolean __getAssociationEnd2rSet = false;
/**
* Can be an AttributeLinkImpl or LinkEndImpl. A representation of the model object 'Slot'. A
* slot
* specifies that an entity modeled by an instance specification has a value or values for a
* specific
* structural feature.
* @return (AssociationEndFacade)handleGetAssociationEnd()
*/
public final AssociationEndFacade getAssociationEnd()
{
AssociationEndFacade getAssociationEnd2r = this.__getAssociationEnd2r;
if (!this.__getAssociationEnd2rSet)
{
// linkEndFacade has no pre constraints
Object result = handleGetAssociationEnd();
MetafacadeBase shieldedResult = this.shieldedElement(result);
try
{
getAssociationEnd2r = (AssociationEndFacade)shieldedResult;
}
catch (ClassCastException ex)
{
// Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
LinkEndFacadeLogic.logger.warn("incorrect metafacade cast for LinkEndFacadeLogic.getAssociationEnd AssociationEndFacade " + result + ": " + shieldedResult);
}
// linkEndFacade has no post constraints
this.__getAssociationEnd2r = getAssociationEnd2r;
if (isMetafacadePropertyCachingEnabled())
{
this.__getAssociationEnd2rSet = true;
}
}
return getAssociationEnd2r;
}
/**
* UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
* @return Object
*/
protected abstract Object handleGetAssociationEnd();
private InstanceFacade __getInstance3r;
private boolean __getInstance3rSet = false;
/**
* Those slots that map onto association ends.
* @return (InstanceFacade)handleGetInstance()
*/
public final InstanceFacade getInstance()
{
InstanceFacade getInstance3r = this.__getInstance3r;
if (!this.__getInstance3rSet)
{
// linkEnds has no pre constraints
Object result = handleGetInstance();
MetafacadeBase shieldedResult = this.shieldedElement(result);
try
{
getInstance3r = (InstanceFacade)shieldedResult;
}
catch (ClassCastException ex)
{
// Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
LinkEndFacadeLogic.logger.warn("incorrect metafacade cast for LinkEndFacadeLogic.getInstance InstanceFacade " + result + ": " + shieldedResult);
}
// linkEnds has no post constraints
this.__getInstance3r = getInstance3r;
if (isMetafacadePropertyCachingEnabled())
{
this.__getInstance3rSet = true;
}
}
return getInstance3r;
}
/**
* UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
* @return Object
*/
protected abstract Object handleGetInstance();
private Collection<InstanceFacade> __getInstances4r;
private boolean __getInstances4rSet = false;
/**
* Can be an AttributeLinkImpl or LinkEndImpl. A representation of the model object 'Slot'. A
* slot
* specifies that an entity modeled by an instance specification has a value or values for a
* specific
* structural feature.
* @return (Collection<InstanceFacade>)handleGetInstances()
*/
public final Collection<InstanceFacade> getInstances()
{
Collection<InstanceFacade> getInstances4r = this.__getInstances4r;
if (!this.__getInstances4rSet)
{
// linkEndFacade has no pre constraints
Collection result = handleGetInstances();
List shieldedResult = this.shieldedElements(result);
try
{
getInstances4r = (Collection<InstanceFacade>)shieldedResult;
}
catch (ClassCastException ex)
{
// Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
LinkEndFacadeLogic.logger.warn("incorrect metafacade cast for LinkEndFacadeLogic.getInstances Collection<InstanceFacade> " + result + ": " + shieldedResult);
}
// linkEndFacade has no post constraints
this.__getInstances4r = getInstances4r;
if (isMetafacadePropertyCachingEnabled())
{
this.__getInstances4rSet = true;
}
}
return getInstances4r;
}
/**
* UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
* @return Collection
*/
protected abstract Collection handleGetInstances();
/**
* @param validationMessages Collection<ModelValidationMessage>
* @see ModelElementFacadeLogicImpl#validateInvariants(Collection validationMessages)
*/
@Override
public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
{
super.validateInvariants(validationMessages);
}
}