Package org.intermine.xml.full
Class ItemFactory
- java.lang.Object
-
- org.intermine.xml.full.ItemFactory
-
public class ItemFactory extends java.lang.Object
ItemFactory class- Author:
- Kim Rutherford
-
-
Field Summary
Fields Modifier and Type Field Description static ItemFactory
NULL_MODEL_ITEM_FACTORY
An ItemFactory constructed with no Model, so the Items it creates do no type checking.
-
Constructor Summary
Constructors Constructor Description 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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(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 classesItem
makeItem(FastPathObject obj)
Convert an Object to Item format.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.
-
-
-
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 doneidentifierPrefix
- 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 constructorclassName
- name of described classimplementations
- 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 convertincludeFields
- 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 objectmodel
- the parent model- Returns:
- space separated list of extended/implemented classes/interfaces
-
-