Class DefinedObjectBuilder
java.lang.Object
edu.uky.cs.nil.sabre.io.DefinedObjectBuilder
- All Implemented Interfaces:
Builder
A
builder which returns a defined
object. This builder assumes the parse tree given to its
build method has exactly one
child and that the child can be built as a String. That string and the
provided type will be used to find a defined object. Defined object
builders are typically used for referencing named things defined in a universe, such as entities, or variables defined in the current
context.- Author:
- Stephen G. Ware
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefinedObjectBuilder(Class<?> type) Constructs a new defined object builder. -
Method Summary
Modifier and TypeMethodDescriptionbuild(Parser parser, ParseTree tree, Definitions definitions) Convert aparse treeinto an object.
-
Field Details
-
type
The type of the defined object
-
-
Constructor Details
-
DefinedObjectBuilder
Constructs a new defined object builder.- Parameters:
type- the type of the defined object
-
-
Method Details
-
build
Description copied from interface:BuilderConvert aparse treeinto an object.- Specified by:
buildin interfaceBuilder- Parameters:
parser- the parser which called this method, in case it is needed tobuildand of theparse tree's childrentree- the parse tree to be converted into an objectdefinitions- a set of other objects which have already been defined in the same context and which may be referenced by this parse tree- Returns:
- an object created according to the parse tree
- Throws:
ParseException- if the parse tree does not define a valid object
-