Package de.monticore.values
Class MCValueObject
java.lang.Object
de.monticore.values.MCValueObject
- All Implemented Interfaces:
MCValue
A value that is a Java Object.
Note: we deliberately do not interpret Objects based on Symbols alone; We assume that all (Object-)Types are already available as Java classes, as the use-cases for runtime-definition of types are rather rare.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConverts the array value to a list ofObject.booleanbyteasByte()charasChar()doubleasDouble()floatasFloat()intasInt()longasLong()Used to pass the value to native Java classes and similar, e.g., collections.<T> TasNativeObject(Class<T> clazz) asObject()cf.shortasShort()asString()booleancheckEqualityOperator(MCValue other) basically implements==protected IllegalStateExceptionbooleanisArray()booleanbooleanisByte()booleanisChar()booleanisDouble()booleanisFloat()booleanisInt()booleanisLong()booleanisObject()booleanisShort()booleanisString()helper for String specificallyPrint the type of the MIValue in human-readable formPrint the value in human-readable form<T> TMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.monticore.values.MCValue
asError, asFunction, isError, isFunction, isPrimitive, isSIUnit, isVoid
-
Field Details
-
value
-
-
Constructor Details
-
MCValueObject
-
-
Method Details
-
isObject
public boolean isObject() -
asObject
Description copied from interface:MCValue- Specified by:
asObjectin interfaceMCValue- Returns:
- The value as an
MCValueObject, iff it is one.
-
asNativeObject
-
unsafeCast
public <T> T unsafeCast() -
asNativeObject
Description copied from interface:MCValueUsed to pass the value to native Java classes and similar, e.g., collections.Note: not all values can have a native representation, as such, their native version is the MIValue itself.
- Specified by:
asNativeObjectin interfaceMCValue- Returns:
- The value as a Java native Object.
-
asString
-
isBoolean
public boolean isBoolean() -
asBoolean
public boolean asBoolean() -
isByte
public boolean isByte() -
asByte
public byte asByte() -
isChar
public boolean isChar() -
asChar
public char asChar() -
isShort
public boolean isShort() -
asShort
public short asShort() -
isInt
public boolean isInt() -
asInt
public int asInt() -
isLong
public boolean isLong() -
asLong
public long asLong() -
isFloat
public boolean isFloat() -
asFloat
public float asFloat() -
isDouble
public boolean isDouble() -
asDouble
public double asDouble() -
isString
public boolean isString()Description copied from interface:MCValuehelper for String specifically -
isArray
public boolean isArray() -
arrayToObjectList
- Returns:
- the list of objects.
-
checkEqualityOperator
Description copied from interface:MCValuebasically implements==- Specified by:
checkEqualityOperatorin interfaceMCValue- Parameters:
other- the value to check against this- Returns:
- whether they are considered equal
-
printType
Description copied from interface:MCValuePrint the type of the MIValue in human-readable form -
printValue
Description copied from interface:MCValuePrint the value in human-readable form- Specified by:
printValuein interfaceMCValue
-
createIllegalConversionException
-