org.intermine.xml.full
Class ItemFactory

java.lang.Object
  extended by org.intermine.xml.full.ItemFactory

public class ItemFactory
extends java.lang.Object

ItemFactory class


Field Summary
static ItemFactory NULL_MODEL_ITEM_FACTORY
          An ItemFactory constructed with no Model, so the Items it creates do no type checking.
 
Constructor Summary
ItemFactory()
          Create an ItemFactory that isn't specific to a particular model.
ItemFactory(Model model)
          Create an ItemFactory specific to a particular model.
ItemFactory(Model model, java.lang.String identifierPrefix)
          Create an ItemFactory specific to a particular model.
 
Method Summary
protected static java.lang.String getImplements(java.lang.Object obj, Model model)
          Get all interfaces that an object implements.
 Item makeItem()
          Make an empty Item with a unique identifier.
 Item makeItem(FastPathObject obj)
          Convert an Object to Item format.
 Item makeItem(java.lang.String identifier)
          Make an empty Item with the given identifier.
 Item makeItem(java.lang.String identifier, java.lang.String className, java.lang.String implementations)
          Construct an item from an identifier, a class name and the names of implemented classes
 Item makeItemForClass(java.lang.String className)
          Construct an item from a class name.
 Item makeItemImpl(FastPathObject obj, java.util.Set<java.lang.String> includeFields)
          Convert an Object to Item format, writing the fields provided in includeFields.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_MODEL_ITEM_FACTORY

public static final ItemFactory NULL_MODEL_ITEM_FACTORY
An ItemFactory constructed with no Model, so the Items it creates do no type checking.

Constructor Detail

ItemFactory

public ItemFactory()
Create an ItemFactory that isn't specific to a particular model. Items created by this ItemFactory will not be checked against a model.


ItemFactory

public ItemFactory(Model model)
Create an ItemFactory specific to a particular model. Items created by this ItemFactory will be checked against the given model. ie. the set methods in Item will check that the operation is valid for the given model.

Parameters:
model - the Model to use when checking

ItemFactory

public ItemFactory(Model model,
                   java.lang.String identifierPrefix)
Create an ItemFactory specific to a particular model. Items created by this ItemFactory will be checked against the given model. ie. the set methods in Item will check that the operation is valid for the given model.

Parameters:
model - the Model to use when checking - can be null to indicate that no checking should be done
identifierPrefix - the prefix to add to automatically created Item identifiers
Method Detail

makeItem

public Item makeItem()
Make an empty Item with a unique identifier. The identifier will be prefixed by the identifierPrefix argument to the constructor, or "" if identifierPrefix was not set.

Returns:
the new Item

makeItem

public Item makeItem(java.lang.String identifier)
Make an empty Item with the given identifier.

Parameters:
identifier - the identifier of the new Item
Returns:
the new Item

makeItem

public Item makeItem(java.lang.String identifier,
                     java.lang.String className,
                     java.lang.String implementations)
Construct an item from an identifier, a class name and the names of implemented classes

Parameters:
identifier - item identifier - if null create a unique identifier prefixed with the prefix argument to the constructor
className - name of described class
implementations - names of implemented classes
Returns:
the new Item

makeItemForClass

public Item makeItemForClass(java.lang.String className)
Construct an item from a class name. A new unique identifier will be created for the object by the ItemFactory.

Parameters:
className - name of described class
Returns:
the new Item

makeItem

public Item makeItem(FastPathObject obj)
Convert an Object to Item format.

Parameters:
obj - object to convert
Returns:
a new Full Data Item

makeItemImpl

public Item makeItemImpl(FastPathObject obj,
                         java.util.Set<java.lang.String> includeFields)
Convert an Object to Item format, writing the fields provided in includeFields.

Parameters:
obj - object to convert
includeFields - the field names to write
Returns:
a new Full Data Item

getImplements

protected static java.lang.String getImplements(java.lang.Object obj,
                                                Model model)
Get all interfaces that an object implements.

Parameters:
obj - the object
model - the parent model
Returns:
space separated list of extended/implemented classes/interfaces