Class SimpleDataNodeBuilder
java.lang.Object
uk.ac.starlink.datanode.factory.DataNodeBuilder
uk.ac.starlink.datanode.factory.SimpleDataNodeBuilder
An abstract DataNodeBuilder providing a template for builders which
build nodes from instances of a given class. This class doesn't
do anything clever, it's just a convenience for subclasses.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSimpleDataNodeBuilder(Class nodeClass, Class argClass) Construct a new builder which will turn out DataNode of a given class from objects of a given class.protectedSimpleDataNodeBuilder(String name, Class argClass) Construct a new builder which will turn out DataNodes from objects of a given class (or its subclasses). -
Method Summary
Modifier and TypeMethodDescriptionabstract DataNodeBuilds a DataNode from a given object.Returns the class which all nodes returned by theDataNodeBuilder.buildNode(Object)method will belong to.booleanDetermine whether this builder can be used to work on an object of a given class.toString()Methods inherited from class DataNodeBuilder
getBuilders
-
Constructor Details
-
SimpleDataNodeBuilder
Construct a new builder which will turn out DataNodes from objects of a given class (or its subclasses).- Parameters:
name- the name of this builder - this should normally be the classname of the DataNodes it will produceargClass- the class on which this node builder will operate
-
SimpleDataNodeBuilder
Construct a new builder which will turn out DataNode of a given class from objects of a given class. Just invokesSimpleDataNodeBuilder(nodeClass.getName(),argClass).- Parameters:
nodeClass- the class of DataNode objects which this builder will be buildingargClass- the class on which this node bulider will operate
-
-
Method Details
-
buildNode
Description copied from class:DataNodeBuilderBuilds a DataNode from a given object.- Specified by:
buildNodein classDataNodeBuilder- Parameters:
obj- the object to build a datanode from- Returns:
- a new DataNode made from
obj - Throws:
NoSuchDataException- if no new node can be created
-
getNodeClass
Description copied from class:DataNodeBuilderReturns the class which all nodes returned by theDataNodeBuilder.buildNode(Object)method will belong to. DataNodeBuilder's implementation of this returnsDataNode.class, but implementations which can be more specific should override this method.- Overrides:
getNodeClassin classDataNodeBuilder- Returns:
- superclass of all the classes of DataNode this builder can build
-
suitable
Description copied from class:DataNodeBuilderDetermine whether this builder can be used to work on an object of a given class.- Specified by:
suitablein classDataNodeBuilder- Parameters:
objClass- the class of an object which might be passed as the argument ofbuildNode- Returns:
- whether it's OK to do that
-
toString
-