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 TypeMethodDescriptionvoidaddChild(Containment containment, Node child) Add a child to the specified list of children associated with the given Containment relation.protected booleanaddContainmentMultipleValue(String linkName, Node value) Adding a null value or a value already contained, do not produce any change.protected voidaddReferenceMultipleValue(String linkName, ReferenceValue value) voidaddReferenceValue(Reference reference, ReferenceValue referenceValue) Add the Node to the list of Nodes referred to from this Node under the given Reference.booleangetChildren(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> VgetPropertyValue(String propertyName, Class<V> clazz) protected <V> VgetPropertyValue(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) inthashCode()voidremoveChild(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.voidsetPropertyValue(Property property, Object value) protected voidsetPropertyValue(String propertyName, Object value) protected voidsetReferenceSingleValue(String linkName, ReferenceValue value) voidsetReferenceValues(Reference reference, List<? extends ReferenceValue> values) toString()Methods inherited from class io.lionweb.model.impl.AbstractClassifierInstance
addAnnotation, getAnnotations, getAnnotations, removeAnnotation, removeChild, removeReferenceValue, removeReferenceValueMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.lionweb.model.ClassifierInstance
addAnnotation, getAnnotations, getAnnotations, removeAnnotationMethods inherited from interface io.lionweb.model.HasFeatureValues
removeChild, removeReferenceValue, removeReferenceValueMethods 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:HasSettableParentSet a new parent.- Specified by:
setParentin interfaceHasSettableParent- Parameters:
parent- the new parent to be assigned- Returns:
- the element itself
-
getParent
Description copied from interface:ClassifierInstanceThe immediate parent of the Node. This should be null only for root nodes. -
getPropertyValue
Description copied from interface:HasFeatureValuesGet the property value associated with the specified property.- Specified by:
getPropertyValuein 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:
setPropertyValuein interfaceHasFeatureValues
-
setPropertyValue
-
getChildren
Description copied from interface:HasFeatureValuesThis return all the Nodes directly contained into this Node under the specific Containment relation specified.- Specified by:
getChildrenin interfaceHasFeatureValues
-
addChild
Description copied from interface:HasFeatureValuesAdd 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:
addChildin interfaceHasFeatureValues
-
removeChild
Description copied from interface:HasFeatureValuesRemove 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:
removeChildin interfaceHasFeatureValues- Overrides:
removeChildin classAbstractClassifierInstance<Concept>
-
getReferenceValues
- Specified by:
getReferenceValuesin interfaceHasFeatureValues
-
addReferenceValue
public void addReferenceValue(@Nonnull Reference reference, @Nullable ReferenceValue referenceValue) Description copied from interface:HasFeatureValuesAdd 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:
addReferenceValuein interfaceHasFeatureValues
-
setReferenceValues
public void setReferenceValues(@Nonnull Reference reference, @Nonnull List<? extends ReferenceValue> values) - Specified by:
setReferenceValuesin interfaceHasFeatureValues
-
getID
Description copied from interface:NodeThis 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()
-