Class ModelMapper
java.lang.Object
org.jfuncmachine.sexprlang.translate.ModelMapper
- All Implemented Interfaces:
SexprMapper
An S-expression mapper that maps S-expression to model classes that are
annotated with the @ModelItem annotation.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionModelMapper(String packageName) Create a model mapper for a particular package (including sub-packages) -
Method Summary
Modifier and TypeMethodDescriptionMap an S-expression double value to an objectMap an S-expression int to an objectMap an S-expression list to an objectMap an S-expression string to an objectmapSymbol(SexprSymbol symbol) Map an S-expression symbol to an objectmapSymbolToClass(SexprSymbol symbol) Map an S-expression symbol to a class
-
Field Details
-
packageName
The package containing the model to be mapped
-
-
Constructor Details
-
ModelMapper
Create a model mapper for a particular package (including sub-packages)- Parameters:
packageName- The package containing the classes to map S-expressions to- Throws:
MappingException- If there is an error performing the mapping
-
-
Method Details
-
mapSymbol
Map an S-expression symbol to an object- Specified by:
mapSymbolin interfaceSexprMapper- Parameters:
symbol- The symbol to map- Returns:
- The value the symbol maps to
- Throws:
MappingException- If there is an error performing the mapping
-
mapSymbolToClass
Map an S-expression symbol to a class- Specified by:
mapSymbolToClassin interfaceSexprMapper- Parameters:
symbol- The symbol to map- Returns:
- The class the symbol maps to
- Throws:
MappingException- If there is an error performing the mapping
-
mapDouble
Map an S-expression double value to an object- Specified by:
mapDoublein interfaceSexprMapper- Parameters:
d- The double value to map- Returns:
- The object the value maps to
- Throws:
MappingException- If there is an error performing the mapping
-
mapInt
Map an S-expression int to an object- Specified by:
mapIntin interfaceSexprMapper- Parameters:
i- The S-expression int that should be mapped- Returns:
- The object the int maps to
- Throws:
MappingException- If there is an error performing the mapping
-
mapString
Map an S-expression string to an object- Specified by:
mapStringin interfaceSexprMapper- Parameters:
s- The string to map- Returns:
- The object the string maps to
- Throws:
MappingException- If there is an error performing the mapping
-
mapList
Map an S-expression list to an object- Specified by:
mapListin interfaceSexprMapper- Parameters:
l- The list to maptargetClass- The class that the object is expected to map to- Returns:
- The object that the list has been mapped into
- Throws:
MappingException- If there is an error performing the mapping
-