org.andromda.core.metafacade
Class MetafacadeMapping

java.lang.Object
  extended by org.andromda.core.metafacade.MetafacadeMapping

public class MetafacadeMapping
extends Object

A meta facade mapping class. This class is a child of MetafacadeMappings (that is: instances of this class below to an instance of MetafacadeMappings).

Author:
Chad Brandon, Bob Fields

Nested Class Summary
(package private) static class MetafacadeMapping.Property
          Stores and provides access to the mapping element's nested <property/>.
(package private) static class MetafacadeMapping.PropertyGroup
          Represents a group of properties.
 
Constructor Summary
MetafacadeMapping()
           
 
Method Summary
 void addMappingProperty(String name, String value)
          Adds a mapping property.
(package private)  void addMappingPropertyGroup(MetafacadeMapping.PropertyGroup propertyGroup)
          Adds the propertyGroup to the existing mapping property groups within this mapping.
 void addPropertyReference(String reference)
          Adds a mapping property reference.
 void addPropertyReferences(Collection<String> propertyReferences)
          Adds all propertyReferences to the property references contained in this MetafacadeMapping instance.
 void addStereotype(String stereotype)
          Adds a stereotype to the stereotypes.
(package private)  String getContext()
          Gets the context to which this mapping applies.
protected  Set<String> getMappingClassNames()
          Gets the names of the metaobject classes used for this mapping.
(package private)  MetafacadeMapping.PropertyGroup getMappingProperties()
          Gets the mapping properties associated this this mapping directly (contained within a MetafacadeMapping.PropertyGroupinstance).
(package private)  Collection<MetafacadeMapping.PropertyGroup> getMappingPropertyGroups()
          Returns all mapping property groups for this MetafacadeMapping instance.
 Class getMetafacadeClass()
          Gets the metafacadeClass for this mapping.
(package private)  MetafacadeMappings getMetafacadeMappings()
          Gets the "parent" MetafacadeMappings instance to which this mapping belongs.
 Collection<String> getPropertyReferences()
          Returns all mapping references for this MetafacadeMapping instance.
(package private)  List<String> getStereotypes()
          Gets the stereotypes which apply to this mapping.
(package private)  boolean hasContext()
          Indicates whether or not this mapping has a context.
(package private)  boolean hasMappingProperties()
          Indicates whether or not this mapping contains any mapping properties.
(package private)  boolean hasStereotypes()
          Indicates whether or not this mapping has any stereotypes defined.
 boolean isContextRoot()
          

Gets whether or not this mapping represents a contextRoot, by default a mapping is NOT a contextRoot.

(package private)  boolean isMappingClassNamePresent()
          Indicates whether or not the mapping class has been present.
(package private)  boolean match(MetafacadeMapping mapping)
          Indicates whether or not the mapping matches this mapping.
 void setContext(String context)
          Sets the context to which this mapping applies.
 void setContextRoot(boolean contextRoot)
          Sets the name of the contextRoot for this mapping.
 void setMappingClassName(String mappingClassName)
          The name of the metaobject class to use for this mapping.
 void setMetafacadeClassName(String metafacadeClassName)
          Sets the metafacadeClassName for this mapping.
(package private)  void setMetafacadeMappings(MetafacadeMappings mappings)
          Sets the metafacade mappings instance to which this particular mapping belongs.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MetafacadeMapping

public MetafacadeMapping()
Method Detail

getMetafacadeClass

public Class getMetafacadeClass()
Gets the metafacadeClass for this mapping.

Returns:
Returns the metafacadeClass.

setMetafacadeClassName

public void setMetafacadeClassName(String metafacadeClassName)
Sets the metafacadeClassName for this mapping.

Parameters:
metafacadeClassName - The name of the metafacade class to set.

getMappingClassNames

protected Set<String> getMappingClassNames()
Gets the names of the metaobject classes used for this mapping.

Returns:
Returns the mappingClassNames.

isMappingClassNamePresent

final boolean isMappingClassNamePresent()
Indicates whether or not the mapping class has been present.

Returns:
whether or not the mapping class is present in this mapping.

setMappingClassName

public void setMappingClassName(String mappingClassName)
The name of the metaobject class to use for this mapping.

Parameters:
mappingClassName - The mappingClassName to set.

isContextRoot

public boolean isContextRoot()

Gets whether or not this mapping represents a contextRoot, by default a mapping is NOT a contextRoot. You'll want to specify this as true when other metafacades need to be created within the context of this metafacade.

Returns:
Returns the contextRoot.

setContextRoot

public void setContextRoot(boolean contextRoot)
Sets the name of the contextRoot for this mapping.

Parameters:
contextRoot - The contextRoot to set.
See Also:
isContextRoot()

addStereotype

public void addStereotype(String stereotype)
Adds a stereotype to the stereotypes.

Parameters:
stereotype -

getStereotypes

final List<String> getStereotypes()
Gets the stereotypes which apply to this mapping.

Returns:
the names of the stereotypes

hasStereotypes

final boolean hasStereotypes()
Indicates whether or not this mapping has any stereotypes defined.

Returns:
true/false

addPropertyReference

public void addPropertyReference(String reference)
Adds a mapping property reference. These are used to populate metafacade impl classes with mapping files, etc. The property reference applies to the given mapping.

Parameters:
reference - the name of the reference.
See Also:
MetafacadeMappings.addPropertyReference(String)

getPropertyReferences

public Collection<String> getPropertyReferences()
Returns all mapping references for this MetafacadeMapping instance.

Returns:
this.propertyReferences

addMappingProperty

public void addMappingProperty(String name,
                               String value)
Adds a mapping property. This are used to narrow the metafacade to which the mapping can apply. The properties must exist and must evaluate to the specified value if given for the mapping to match.

Parameters:
name - the name of the reference.
value - the default value of the property reference.

addMappingPropertyGroup

final void addMappingPropertyGroup(MetafacadeMapping.PropertyGroup propertyGroup)
Adds the propertyGroup to the existing mapping property groups within this mapping.

Parameters:
propertyGroup - a property group for this mapping

getMappingPropertyGroups

final Collection<MetafacadeMapping.PropertyGroup> getMappingPropertyGroups()
Returns all mapping property groups for this MetafacadeMapping instance.

Returns:
this.mappingPropertyGroups

getMappingProperties

final MetafacadeMapping.PropertyGroup getMappingProperties()
Gets the mapping properties associated this this mapping directly (contained within a MetafacadeMapping.PropertyGroupinstance).

Returns:
the mapping property group.

hasMappingProperties

final boolean hasMappingProperties()
Indicates whether or not this mapping contains any mapping properties.

Returns:
true/false

addPropertyReferences

public void addPropertyReferences(Collection<String> propertyReferences)
Adds all propertyReferences to the property references contained in this MetafacadeMapping instance.

Parameters:
propertyReferences - the property references to add.

setContext

public void setContext(String context)
Sets the context to which this mapping applies.

Parameters:
context - The metafacade context name to set.

getContext

final String getContext()
Gets the context to which this mapping applies.

Returns:
the name of the context

hasContext

final boolean hasContext()
Indicates whether or not this mapping has a context.

Returns:
true/false

setMetafacadeMappings

final void setMetafacadeMappings(MetafacadeMappings mappings)
Sets the metafacade mappings instance to which this particular mapping belongs. (i.e. the parent) Note, that this is populated during the call to MetafacadeMappings.addMapping(MetafacadeMapping).

Parameters:
mappings - the MetacadeMappings instance to which this mapping belongs.

getMetafacadeMappings

final MetafacadeMappings getMetafacadeMappings()
Gets the "parent" MetafacadeMappings instance to which this mapping belongs.

Returns:
the parent metafacade mappings instance.

match

final boolean match(MetafacadeMapping mapping)
Indicates whether or not the mapping matches this mapping. It matches on the following:

Parameters:
mapping -
Returns:
match this.getMappingClassName().equals(mapping.getMappingClassName())

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2003-2012 AndroMDA.org. All Rights Reserved.