Class M3Node<T extends M3Node>
- All Implemented Interfaces:
ClassifierInstance<Concept>
,HasFeatureValues
,HasSettableParent
,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.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.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) int
hashCode()
void
removeChild
(Node child) Remove the given child from the list of children associated with the Node, making it a dangling Node.setParent
(ClassifierInstance<?> parent) Set a new parent.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.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.model.ClassifierInstance
addAnnotation, getAnnotations, getAnnotations, removeAnnotation
Methods inherited from interface io.lionweb.model.HasFeatureValues
removeChild, removeReferenceValue, removeReferenceValue
Methods inherited from interface io.lionweb.model.Node
getClassifier, getContainmentFeature, getRoot, isRoot, thisAndAllDescendants
-
Constructor Details
-
M3Node
protected M3Node() -
M3Node
-
-
Method Details
-
setID
-
setParent
Description copied from interface:HasSettableParent
Set a new parent.- Specified by:
setParent
in interfaceHasSettableParent
- Parameters:
parent
- the new parent to be assigned- Returns:
- the element itself
-
getParent
Description copied from interface:ClassifierInstance
The immediate parent of the Node. This should be null only for root nodes. -
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()
-