Class ArtifactCreatorNode
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.artifactModel.ArtifactCreatorNode
-
class ArtifactCreatorNode extends java.lang.ObjectStores an artifact creator and its subordinate (more specific) creators according to the inheritance hierarchy.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<ArtifactCreatorNode>childrenprivate IArtifactCreatorcreator
-
Constructor Summary
Constructors Constructor Description ArtifactCreatorNode(IArtifactCreator creator)Creates a new artifact creator node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddChild(IArtifactCreator creator)Adds a new child.(package private) voidconfigure(java.util.Properties properties, java.util.List<Message> messages)Configures the attached artifact creator.(package private) java.lang.StringgetArtifactName()Returns the name of the artifact.ArtifactCreatorNodegetChild(int index)Returns the specified child.intgetChildrenCount()Returns the number of children.IArtifactCreatorgetCreator()Returns the attached creator.(package private) java.lang.StringgetCreatorClassName()Returns the name of the class of the attached creator.booleanhandlesArtifact(java.lang.Class<? extends IArtifact> kind, java.lang.Object real)Returns whether the attached creator handles the givenrealartifact instance.booleanisMoreGeneralThan(java.lang.Class<? extends IArtifactCreator> cls)Returns whether this creator node is more general than the givencls.(package private) voidsetCreator(IArtifactCreator creator)Replaces the current creator.booleansubtreeMayHandle(java.lang.Class<? extends IArtifact> kind)Returns whether the subtree represented by this node may handle the givenkindof artifact.
-
-
-
Field Detail
-
creator
private IArtifactCreator creator
-
children
private java.util.List<ArtifactCreatorNode> children
-
-
Constructor Detail
-
ArtifactCreatorNode
public ArtifactCreatorNode(IArtifactCreator creator)
Creates a new artifact creator node.- Parameters:
creator- the artifact creator
-
-
Method Detail
-
isMoreGeneralThan
public boolean isMoreGeneralThan(java.lang.Class<? extends IArtifactCreator> cls)
Returns whether this creator node is more general than the givencls.- Parameters:
cls- the class of the creator to be compared- Returns:
trueif this creator is more general thancls,falseelse, in particular the relation is unclear
-
getChildrenCount
public int getChildrenCount()
Returns the number of children.- Returns:
- the number of children
-
getChild
public ArtifactCreatorNode getChild(int index)
Returns the specified child.- Parameters:
index- the index of the child to be returned- Returns:
- the specified child
- Throws:
java.lang.IndexOutOfBoundsException- in case ofindex < 0 || index >={getChildrenCount()}
-
addChild
void addChild(IArtifactCreator creator)
Adds a new child.- Parameters:
creator- the creator to be stored in the new child
-
setCreator
void setCreator(IArtifactCreator creator)
Replaces the current creator. This shall only happen if the related artifact also replaces an existing artifact.- Parameters:
creator- the new creator.
-
getCreator
public IArtifactCreator getCreator()
Returns the attached creator.- Returns:
- the attached creator
-
handlesArtifact
public boolean handlesArtifact(java.lang.Class<? extends IArtifact> kind, java.lang.Object real)
Returns whether the attached creator handles the givenrealartifact instance.- Parameters:
kind- the kind of artifact in terms of a class (typically the top-level interfaces)real- the real artifact- Returns:
trueif the attached creator handlesreal,falseelse
-
getCreatorClassName
java.lang.String getCreatorClassName()
Returns the name of the class of the attached creator.- Returns:
- the name of the attached creator
-
configure
void configure(java.util.Properties properties, java.util.List<Message> messages)Configures the attached artifact creator.- Parameters:
properties- the properties used to configure the creatormessages- configuration messages (to be modified as a side effect)
-
getArtifactName
java.lang.String getArtifactName()
Returns the name of the artifact.- Returns:
- the name of the artifact
-
subtreeMayHandle
public boolean subtreeMayHandle(java.lang.Class<? extends IArtifact> kind)
Returns whether the subtree represented by this node may handle the givenkindof artifact.- Parameters:
kind- the kind to be tested (may be null)- Returns:
trueif it may handle,falseif not (in particularkindis null)
-
-