Class M3Node<T extends M3Node>
- All Implemented Interfaces:
ClassifierInstance<Concept>
,HasFeatureValues
,Node
- Direct Known Subclasses:
EnumerationLiteral
,Feature
,Field
,Language
,LanguageEntity
Other libraries could implement Node differently, for example based on reflection. However, this is outside the scope of this library. This library should provide a solid, basic dependency to be used by other implementation and it should be as reusable, basic, and unopinionated as possible.
Each M3Node is connected to a specific version of lionWebVersion, as these elements may behave differently depending on the version of LionWeb they are representing.
-
Field Summary
Fields inherited from class io.lionweb.lioncore.java.model.impl.AbstractClassifierInstance
annotations
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChild
(Containment containment, Node child) Add a child to the specified list of children associated with the given Containment relation.protected boolean
addContainmentMultipleValue
(String linkName, Node value) Adding a null value or a value already contained, do not produce any change.protected void
addReferenceMultipleValue
(String linkName, ReferenceValue value) void
addReferenceValue
(Reference reference, ReferenceValue referenceValue) Add the Node to the list of Nodes referred to from this Node under the given Reference.boolean
getChildren
(Containment containment) This return all the Nodes directly contained into this Node under the specific Containment relation specified.Return the Containment feature used to hold this Node within its parent.getContainmentMultipleValue
(String linkName) protected <V extends Node>
VgetContainmentSingleValue
(String linkName) getID()
This return the Node ID.The immediate parent of the Node.getPropertyValue
(Property property) Get the property value associated with the specified property.protected <V> V
getPropertyValue
(String propertyName, Class<V> clazz) protected <V> V
getPropertyValue
(String propertyName, Class<V> clazz, V defaultValue) This internal method uses a property name and not a property or the property id because of a circular dependency problem present for nodes representing M3 elements.getReferenceMultipleValue
(String linkName) protected <V extends Node>
VgetReferenceSingleValue
(String linkName) getReferenceValues
(Reference reference) getRoot()
If a Node is a root node in a Model, this method returns the node itself.int
hashCode()
void
removeChild
(Node child) Remove the given child from the list of children associated with the Node, making it a dangling Node.void
setPropertyValue
(Property property, Object value) protected void
setPropertyValue
(String propertyName, Object value) protected void
setReferenceSingleValue
(String linkName, ReferenceValue value) void
setReferenceValues
(Reference reference, List<? extends ReferenceValue> values) toString()
Methods inherited from class io.lionweb.lioncore.java.model.impl.AbstractClassifierInstance
addAnnotation, getAnnotations, getAnnotations, removeAnnotation, removeChild, removeReferenceValue, removeReferenceValue
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.lionweb.lioncore.java.model.ClassifierInstance
addAnnotation, getAnnotations, getAnnotations, removeAnnotation
Methods inherited from interface io.lionweb.lioncore.java.model.HasFeatureValues
removeChild, removeReferenceValue, removeReferenceValue
Methods inherited from interface io.lionweb.lioncore.java.model.Node
getClassifier, isRoot, thisAndAllDescendants
-
Constructor Details
-
M3Node
protected M3Node() -
M3Node
-
-
Method Details
-
setID
-
setParent
-
getRoot
Description copied from interface:Node
If a Node is a root node in a Model, this method returns the node itself. Otherwise it returns the ancestor which is a root node. This method should return null only if the Node is not inserted in a Model and it is therefore considered a dangling Node. -
getParent
Description copied from interface:ClassifierInstance
The immediate parent of the Node. This should be null only for root nodes. -
getContainmentFeature
Description copied from interface:Node
Return the Containment feature used to hold this Node within its parent. This will be null only for root nodes or dangling nodes (which are not distinguishable by looking at the node itself).- Specified by:
getContainmentFeature
in interfaceNode
- See Also:
-
getPropertyValue
Description copied from interface:HasFeatureValues
Get the property value associated with the specified property.- Specified by:
getPropertyValue
in interfaceHasFeatureValues
-
getPropertyValue
@Nullable protected <V> V getPropertyValue(@Nonnull String propertyName, @Nonnull Class<V> clazz, @Nullable V defaultValue) This internal method uses a property name and not a property or the property id because of a circular dependency problem present for nodes representing M3 elements. -
getPropertyValue
-
setPropertyValue
- Specified by:
setPropertyValue
in interfaceHasFeatureValues
-
setPropertyValue
-
getChildren
Description copied from interface:HasFeatureValues
This return all the Nodes directly contained into this Node under the specific Containment relation specified.- Specified by:
getChildren
in interfaceHasFeatureValues
-
addChild
Description copied from interface:HasFeatureValues
Add a child to the specified list of children associated with the given Containment relation. If the specified Containment does not allow for multiple values, and if a value is already set than the exception IllegalStateException will be thrown.If the child has not a Concept compatible with the target of the Containement, the exception IllegalArgumentException will be thrown.
- Specified by:
addChild
in interfaceHasFeatureValues
-
removeChild
Description copied from interface:HasFeatureValues
Remove the given child from the list of children associated with the Node, making it a dangling Node. If the specified Node is not currently a child of this Node the exception IllegalArgumentException will be thrown.- Specified by:
removeChild
in interfaceHasFeatureValues
- Overrides:
removeChild
in classAbstractClassifierInstance<Concept>
-
getReferenceValues
- Specified by:
getReferenceValues
in interfaceHasFeatureValues
-
addReferenceValue
public void addReferenceValue(@Nonnull Reference reference, @Nullable ReferenceValue referenceValue) Description copied from interface:HasFeatureValues
Add the Node to the list of Nodes referred to from this Node under the given Reference.If the Reference is not multiple, any previous value will be replaced.
The Node specified should be either part of this Node's Model or of Models imported by this Node's Model. If that is not the case the exception IllegalArgumentException will be thrown.
If the referredNode has not a Concept compatible with the target of the Reference, the exception IllegalArgumentException will be thrown.
- Specified by:
addReferenceValue
in interfaceHasFeatureValues
-
setReferenceValues
public void setReferenceValues(@Nonnull Reference reference, @Nonnull List<? extends ReferenceValue> values) - Specified by:
setReferenceValues
in interfaceHasFeatureValues
-
getID
Description copied from interface:Node
This return the Node ID.A valid Node ID should not be null, but this method can return a null value in case the Node is in invalid state.
-
toString
-
getContainmentSingleValue
-
getReferenceSingleValue
-
getContainmentMultipleValue
-
getReferenceMultipleValue
-
setReferenceSingleValue
-
addContainmentMultipleValue
Adding a null value or a value already contained, do not produce any change.- Returns:
- return true if the addition produced a change
-
addReferenceMultipleValue
-
getLionWebVersion
-
equals
-
hashCode
public int hashCode()
-