Package uk.ac.starlink.datanode.factory
Class DataNodeBuilder
java.lang.Object
uk.ac.starlink.datanode.factory.DataNodeBuilder
- Direct Known Subclasses:
DocumentDataNodeBuilder
,FileDataNodeBuilder
,SimpleDataNodeBuilder
,SourceDataNodeBuilder
,StringDataNodeBuilder
,VODataNodeBuilder
,XMLDataNodeBuilder
Constructs a DataNode from an Object using a particular method or
constructor. Instances of this class are the basic building blocks
used by DataNodeFactory to do its DataNode construction.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract DataNode
Builds a DataNode from a given object.static DataNodeBuilder[]
getBuilders
(Class clazz) Returns an array of DataNodeBuilder objects which are all the ones that can be found by reflection in the supplied class.Returns the class which all nodes returned by thebuildNode(java.lang.Object)
method will belong to.abstract boolean
Determine whether this builder can be used to work on an object of a given class.
-
Constructor Details
-
DataNodeBuilder
public DataNodeBuilder()
-
-
Method Details
-
suitable
Determine whether this builder can be used to work on an object of a given class.- Parameters:
objClass
- the class of an object which might be passed as the argument ofbuildNode
- Returns:
- whether it's OK to do that
-
buildNode
Builds a DataNode from a given object.- 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
Returns the class which all nodes returned by thebuildNode(java.lang.Object)
method will belong to. DataNodeBuilder's implementation of this returnsDataNode.class
, but implementations which can be more specific should override this method.- Returns:
- superclass of all the classes of DataNode this builder can build
-
getBuilders
Returns an array of DataNodeBuilder objects which are all the ones that can be found by reflection in the supplied class.- Parameters:
clazz
- a class to reflect on- Returns:
- an array of builder objects found in
clazz
-