Class Value
- java.lang.Object
-
- net.ssehub.easy.varModel.model.values.Value
-
- Direct Known Subclasses:
BasisDatatypeValue,EnumValue,ListWrapperValue,MetaTypeValue,NullValue,ReferenceValue,StructuredValue
public abstract class Value extends java.lang.ObjectBasis value class.- Author:
- Marcel Lueder, El-Sharkawy, Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private static EASyLoggerFactory.EASyLoggerLOGGERprivate IDatatypeorigin
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaccept(IValueVisitor visitor)Abstract accept method.Valueclone()Clones the this value.booleanequals(java.lang.Object other)static booleanequals(Value v1, Value v2)Returns whetherv1andv2are#equals(Value)equal considering the case thatv1may be null.abstract booleanequalsPartially(Value value)Returns whether the providedvalueis partially equal to this value, i.e., whether the nested elements ofvalue(if they exist) have the same contents as in this value.static booleanequalsPartially(Value v1, Value v2)Returns whetherv1andv2areequalsPartially(Value)partially equal considering the case thatv1may be null.IDatatypegetContainedType()Returns the data type explicitly contained in this value.IDatatypegetType()Returns the Datatype of this Value.abstract java.lang.ObjectgetValue()Abstract getValue method.IValueParentgetValueParent()Returns the value parent.inthashCode()abstract booleanisConfigured()Abstract Method to check whether a value is configured.abstract voidsetValue(java.lang.Object value)Abstract setValue-method.voidsetValueParent(IValueParent parent)Changes the value parent.protected java.lang.StringstringValueOf(java.lang.Object object)Converts a object value to a string.java.lang.StringtoString()
-
-
-
Field Detail
-
LOGGER
private static final EASyLoggerFactory.EASyLogger LOGGER
-
origin
private IDatatype origin
-
-
Constructor Detail
-
Value
Value()
Constructor for serialization.
-
Value
protected Value(IDatatype origin)
Constructor.- Parameters:
origin- the origin datatype.
-
-
Method Detail
-
getValue
public abstract java.lang.Object getValue()
Abstract getValue method. The result of this method must comply to the input conventions ofValueFactoryand the constructor of the respective implementing class.- Returns:
- the Value of the Datatype
-
accept
public abstract void accept(IValueVisitor visitor)
Abstract accept method.- Parameters:
visitor- The visitor
-
setValue
public abstract void setValue(java.lang.Object value) throws ValueDoesNotMatchTypeExceptionAbstract setValue-method.- Parameters:
value- the value to set.- Throws:
ValueDoesNotMatchTypeException- if the given value does not match this type
-
getType
public IDatatype getType()
Returns the Datatype of this Value. The datatype should match to the type of this value.- Returns:
- Related datatype of this value.
-
isConfigured
public abstract boolean isConfigured()
Abstract Method to check whether a value is configured.- Returns:
- true = it is configured / false = it is not
-
stringValueOf
protected java.lang.String stringValueOf(java.lang.Object object)
Converts a object value to a string.- Parameters:
object- the object to convert- Returns:
- the converted object
-
clone
public Value clone()
Clones the this value.- Overrides:
clonein classjava.lang.Object- Returns:
- the clone of the value
-
getContainedType
public IDatatype getContainedType()
Returns the data type explicitly contained in this value. This is typically a meta value, i.e. a type expression.- Returns:
- the contained type or null if there is none
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equalsPartially
public abstract boolean equalsPartially(Value value)
Returns whether the providedvalueis partially equal to this value, i.e., whether the nested elements ofvalue(if they exist) have the same contents as in this value. Other values of this value are not considered. The check is transitive on nested elements. Please consider that this method is not symmetric as opposed toequals. This method is important to cope with default values.- Parameters:
value- the value to be checked for partial equality.- Returns:
trueifvalueis partially equal to this,falseelse
-
equalsPartially
public static boolean equalsPartially(Value v1, Value v2)
Returns whetherv1andv2areequalsPartially(Value)partially equal considering the case thatv1may be null.- Parameters:
v1- the first value (may be null)v2- the second value (may be null)- Returns:
trueifv1andv2are considered to be partially equal,falseelse, i.e., whetherv2is a partial value ofv1
-
equals
public static boolean equals(Value v1, Value v2)
Returns whetherv1andv2are#equals(Value)equal considering the case thatv1may be null.- Parameters:
v1- the first value (may be null)v2- the second value (may be null)- Returns:
trueifv1andv2are considered to be equal,falseelse, i.e., whetherv2is the same value asv1
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
setValueParent
public void setValueParent(IValueParent parent)
Changes the value parent.- Parameters:
parent- the parent
-
getValueParent
public IValueParent getValueParent()
Returns the value parent.- Returns:
- the parent (may be null for none)
-
-