public class ModelFactory extends AbstractFactory
ModelFactory also offers an API for extracting parts of model types, expressed as possibly nested types in the expression language. As well as extracting the value-type of lists and the key- and value-types of maps, it is possible to extract the cognate pair-type for map entries.
Constructor and Description |
---|
ModelFactory() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
createExternalObject(java.lang.String value,
java.lang.String type)
Creates an instance of an uninterpreted external type, with the given
value.
|
java.lang.Object |
createObject(java.lang.String type)
Creates a default instance of any kind of model Object with the given
model type.
|
java.lang.Object |
createObject(java.lang.String value,
java.lang.String type)
Creates an instance of any kind of model Object with the given printed
representation and model type.
|
java.lang.String |
getBaseType(java.lang.String paramType)
Extracts the base-type name from any parametric type.
|
java.lang.String |
getKeyType(java.lang.String paramType)
Extracts the search key-type name from any parametric type.
|
protected java.lang.Object |
getNextList(java.util.List<?> list,
java.lang.String type,
boolean more)
Creates the successor, or predecessor of a list, depending on a flag.
|
protected java.lang.Object |
getNextMap(java.util.Map<?,?> map,
java.lang.String type,
boolean more)
Creates the successor, or predecessor of a map, depending on a flag.
|
protected java.lang.Object |
getNextPair(java.util.Map.Entry<?,?> pair,
java.lang.String type,
boolean more)
Creates the successor, or predecessor of a pair, depending on a flag.
|
protected java.lang.Object |
getNextSet(java.util.Set<?> set,
java.lang.String type,
boolean more)
Creates the successor, or predecessor of a set, depending on a flag.
|
java.lang.String |
getPairType(java.lang.String paramType)
Extracts the tuple pair-type name from any parametric type.
|
java.lang.Object |
getPredecessor(java.lang.Object value,
java.lang.String type)
Returns the predecessor of a value of the given type.
|
java.lang.Object |
getSuccessor(java.lang.Object value,
java.lang.String type)
Returns the successor of a value of the given type.
|
java.lang.String |
getValueType(java.lang.String paramType)
Extracts the value-type name from any parametric type.
|
create, createDefaultObject, createListObject, createMapObject, createPairObject, createSetObject, createSimpleObject, error, makeEntityId, safeIndexOf, safeSplit
public java.lang.Object createObject(java.lang.String type)
type
- the model type, as a String.public java.lang.Object createObject(java.lang.String value, java.lang.String type)
value
- the value, as a String.type
- the model type, as a String.protected java.lang.Object createExternalObject(java.lang.String value, java.lang.String type)
createExternalObject
in class AbstractFactory
value
- an identifier String.type
- an external type, as a String.public java.lang.String getBaseType(java.lang.String paramType)
paramType
- the parametric type name.public java.lang.String getValueType(java.lang.String paramType)
paramType
- the parametric type name.public java.lang.String getKeyType(java.lang.String paramType)
paramType
- the parametric type name.public java.lang.String getPairType(java.lang.String paramType)
paramType
- the parametric type name.public java.lang.Object getSuccessor(java.lang.Object value, java.lang.String type)
value
- a non-null value.type
- the model type.public java.lang.Object getPredecessor(java.lang.Object value, java.lang.String type)
value
- a non-null value.type
- the model type.protected java.lang.Object getNextList(java.util.List<?> list, java.lang.String type, boolean more)
list
- the original list.type
- the parametric type of the list.more
- indicates the successor (true) or predecessor (false).protected java.lang.Object getNextSet(java.util.Set<?> set, java.lang.String type, boolean more)
set
- the original set.type
- the parametric type of the set.more
- indicates the successor (true) or predecessor (false).protected java.lang.Object getNextMap(java.util.Map<?,?> map, java.lang.String type, boolean more)
map
- the original map.type
- the parametric type of the map.more
- indicates the successor (true) or predecessor (false).protected java.lang.Object getNextPair(java.util.Map.Entry<?,?> pair, java.lang.String type, boolean more)
pair
- the original pair.type
- the parametric type of the pair.more
- indicates the successor (true) or predecessor (false).