Class ValueFactory
- java.lang.Object
-
- net.ssehub.easy.varModel.model.values.ValueFactory
-
public class ValueFactory extends java.lang.ObjectThe ValueFactory provides easy access to the Values. Object values passed in must match the value instance to be created for the specified data types. Object values may be- constants, such as integer values, doubles, strings
- instances of
Value - instances of
ConstraintSyntaxTreedenoting entire expressions - object arrays for
- container: just containing the values
- compounds: containing name-value pairs (first entry name, second value)
denoting the values for individual slots. A special value is
CompoundValue.SPECIAL_SLOT_NAME_TYPEwhere the value contains an object ofIDatatypedenoting the actual type of the compound in case of refined compounds).
- Author:
- lueder, Holger Eichelberger, El-Sharkawy
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static interfaceValueFactory.IValueCreatorPrivate interface for calling the constructor of the right value type.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Object[]EMPTYprivate static java.util.Map<java.lang.Class<? extends IDatatype>,ValueFactory.IValueCreator>mapThis map values associated to the origin datatype.
-
Constructor Summary
Constructors Modifier Constructor Description privateValueFactory()Prevent external initialization, allow subclassing.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static voidassignBooleanValue()This method assigns the constructor forBooleanValuesto the IDatatypeBooleanType.private static voidassignCompoundValue()This method assigns the constructor forCompoundValuesto the IDatatypeCompound.private static voidassignConstraintValue()This method assigns the constructor forConstraintValuesto the IDatatypeBooleanType.private static voidassignContainerValue()This method assigns the constructor forContainerValueto the IDatatypeCompound.private static voidassignDerivedDatypeValue()This method assigns the constructor forDerivedDatatypeValuesto the IDatatypeDerivedDatatype.private static voidassignEnumValue()This method assigns the constructor forEnumValuesto the IDatatypeEnumandOrderedEnum.private static voidassignIntegerValue()This method assigns the constructor forIntValuesto the IDatatypeIntegerType.private static voidassignMetaTypeValue()This method assigns the constructor forMetaTypeValueto the IDatatypeMetaType.private static voidassignRealValue()This method assigns the constructor forRealValuesto the IDatatypeRealType.private static voidassignReferenceValue()This method assigns the constructor forReferenceValueto the IDatatypeReference.private static voidassignStringValue()This method assigns the constructor forStringValuesto the IDatatypeStringType.private static voidassignVersionTypeValue()This method assigns the constructor forVersionValueto the IDatatypeVersionType.static ValuecreateValue(IDatatype type, java.lang.Object... value)Creates and returns a Value.
-
-
-
Field Detail
-
EMPTY
public static final java.lang.Object[] EMPTY
-
map
private static java.util.Map<java.lang.Class<? extends IDatatype>,ValueFactory.IValueCreator> map
This map values associated to the origin datatype.
-
-
Method Detail
-
assignStringValue
private static void assignStringValue()
This method assigns the constructor forStringValuesto the IDatatypeStringType.
-
assignIntegerValue
private static void assignIntegerValue()
This method assigns the constructor forIntValuesto the IDatatypeIntegerType.
-
assignRealValue
private static void assignRealValue()
This method assigns the constructor forRealValuesto the IDatatypeRealType.
-
assignDerivedDatypeValue
private static void assignDerivedDatypeValue()
This method assigns the constructor forDerivedDatatypeValuesto the IDatatypeDerivedDatatype. Since there do not exist anyDerivedDatatypeValues, this method calls thecreateValue(IDatatype, Object...)for the basis datatype of theDerivedDatatype.
-
assignMetaTypeValue
private static void assignMetaTypeValue()
This method assigns the constructor forMetaTypeValueto the IDatatypeMetaType.
-
assignVersionTypeValue
private static void assignVersionTypeValue()
This method assigns the constructor forVersionValueto the IDatatypeVersionType.
-
assignBooleanValue
private static void assignBooleanValue()
This method assigns the constructor forBooleanValuesto the IDatatypeBooleanType.
-
assignConstraintValue
private static void assignConstraintValue()
This method assigns the constructor forConstraintValuesto the IDatatypeBooleanType.
-
assignEnumValue
private static void assignEnumValue()
This method assigns the constructor forEnumValuesto the IDatatypeEnumandOrderedEnum.
-
assignCompoundValue
private static void assignCompoundValue()
This method assigns the constructor forCompoundValuesto the IDatatypeCompound.
-
assignContainerValue
private static void assignContainerValue()
This method assigns the constructor forContainerValueto the IDatatypeCompound.
-
assignReferenceValue
private static void assignReferenceValue()
This method assigns the constructor forReferenceValueto the IDatatypeReference.
-
createValue
public static Value createValue(IDatatype type, java.lang.Object... value) throws ValueDoesNotMatchTypeException
Creates and returns a Value.- Parameters:
type- The IDatatype of the valuevalue- the string formatted value(s)- Returns:
- A suitable value related to the given
IDatatypeor null if no suitable Value exists, but should not occur. - Throws:
ValueDoesNotMatchTypeException- in case ofvaluecannot be converted totype
-
-