|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jcrom.Jcrom
public class Jcrom
This is the main entry class for JCROM. To use JCROM, you create an instance of this class, and add the classes you want to be mapped to it. Jcrom will validate that the classes you add can be mapped to/from JCR.
Instances of this class are thread-safe.
| Constructor Summary | |
|---|---|
Jcrom()
Create a new Jcrom instance that cleans node names, but with dynamic instantiation turned off. |
|
Jcrom(boolean cleanNames)
Create a new Jcrom instance with dynamic instantiation turned off. |
|
Jcrom(boolean cleanNames,
boolean dynamicInstantiation)
Create a new Jcrom instance. |
|
Jcrom(boolean cleanNames,
boolean dynamicInstantiation,
java.util.Set<java.lang.Class> classesToMap)
Create a new Jcrom instance. |
|
Jcrom(boolean cleanNames,
java.util.Set<java.lang.Class> classesToMap)
Create a new Jcrom instance with dynamic instantiation turned off. |
|
Jcrom(java.util.Set<java.lang.Class> classesToMap)
Create a new Jcrom instance with name cleaning set to true, and dynamic instantiation off. |
|
| Method Summary | ||
|---|---|---|
javax.jcr.Node |
addNode(javax.jcr.Node parentNode,
java.lang.Object entity)
Maps the entity supplied to a JCR node, and adds that node as a child to the parent node supplied. |
|
javax.jcr.Node |
addNode(javax.jcr.Node parentNode,
java.lang.Object entity,
java.lang.String[] mixinTypes)
Maps the entity supplied to a JCR node, and adds that node as a child to the parent node supplied. |
|
|
fromNode(java.lang.Class<T> entityClass,
javax.jcr.Node node)
Maps the node supplied to an instance of the entity class. |
|
|
fromNode(java.lang.Class<T> entityClass,
javax.jcr.Node node,
NodeFilter nodeFilter)
Maps the node supplied to an instance of the entity class. |
|
|
fromNode(java.lang.Class<T> entityClass,
javax.jcr.Node node,
java.lang.String childNodeFilter,
int maxDepth)
Maps the node supplied to an instance of the entity class. |
|
java.util.Set<java.lang.Class> |
getMappedClasses()
Get a set of all classes that are mapped by this instance. |
|
java.lang.String |
getName(java.lang.Object object)
|
|
java.lang.String |
getPath(java.lang.Object object)
|
|
boolean |
isMapped(java.lang.Class entityClass)
Check whether a specific class is mapped by this instance. |
|
Jcrom |
map(java.lang.Class entityClass)
Add a class that this instance can map to/from JCR nodes. |
|
Jcrom |
mapPackage(java.lang.String packageName)
Tries to map all classes in the package specified. |
|
Jcrom |
mapPackage(java.lang.String packageName,
boolean ignoreInvalidClasses)
Tries to map all classes in the package specified. |
|
void |
setBaseVersionInfo(java.lang.Object object,
java.lang.String name,
java.util.Calendar created)
|
|
java.lang.String |
updateNode(javax.jcr.Node node,
java.lang.Object entity)
Update an existing JCR node with the entity supplied. |
|
java.lang.String |
updateNode(javax.jcr.Node node,
java.lang.Object entity,
NodeFilter nodeFilter)
Update an existing JCR node with the entity supplied. |
|
java.lang.String |
updateNode(javax.jcr.Node node,
java.lang.Object entity,
java.lang.String childNodeFilter,
int maxDepth)
Update an existing JCR node with the entity supplied. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Jcrom()
public Jcrom(boolean cleanNames)
cleanNames - specifies whether to clean names of new nodes, that is,
replace illegal characters and spaces automatically
public Jcrom(boolean cleanNames,
boolean dynamicInstantiation)
cleanNames - specifies whether to clean names of new nodes, that is,
replace illegal characters and spaces automaticallydynamicInstantiation - if set to true, then Jcrom will try to retrieve
the name of the class to instantiate from a node property
(see @JcrNode(classNameProperty)).public Jcrom(java.util.Set<java.lang.Class> classesToMap)
classesToMap - a set of classes to map by this instance
public Jcrom(boolean cleanNames,
java.util.Set<java.lang.Class> classesToMap)
cleanNames - specifies whether to clean names of new nodes, that is,
replace illegal characters and spaces automaticallyclassesToMap - a set of classes to map by this instance
public Jcrom(boolean cleanNames,
boolean dynamicInstantiation,
java.util.Set<java.lang.Class> classesToMap)
cleanNames - specifies whether to clean names of new nodes, that is,
replace illegal characters and spaces automaticallydynamicInstantiation - if set to true, then Jcrom will try to retrieve
the name of the class to instantiate from a node property
(see @JcrNode(classNameProperty)).classesToMap - a set of classes to map by this instance| Method Detail |
|---|
public Jcrom map(java.lang.Class entityClass)
entityClass - the class that will be mapped
public Jcrom mapPackage(java.lang.String packageName)
packageName - the name of the package to process
public Jcrom mapPackage(java.lang.String packageName,
boolean ignoreInvalidClasses)
packageName - the name of the package to processignoreInvalidClasses - specifies whether to ignore classes in the
package that cannot be mapped
public java.util.Set<java.lang.Class> getMappedClasses()
public boolean isMapped(java.lang.Class entityClass)
entityClass - the class we want to check
public java.lang.String getName(java.lang.Object object)
throws JcrMappingException
JcrMappingException
public java.lang.String getPath(java.lang.Object object)
throws JcrMappingException
JcrMappingException
public void setBaseVersionInfo(java.lang.Object object,
java.lang.String name,
java.util.Calendar created)
throws JcrMappingException
JcrMappingException
public <T> T fromNode(java.lang.Class<T> entityClass,
javax.jcr.Node node)
throws JcrMappingException
entityClass - the class of the entity to be instantiated from the node
(in the case of dynamic instantiation, the instance class may be read from
the document, but will be cast to this class)node - the JCR node from which to create the object
JcrMappingException
public <T> T fromNode(java.lang.Class<T> entityClass,
javax.jcr.Node node,
java.lang.String childNodeFilter,
int maxDepth)
throws JcrMappingException
entityClass - the class of the entity to be instantiated from the node
(in the case of dynamic instantiation, the instance class may be read from
the document, but will be cast to this class)node - the JCR node from which to create the objectchildNodeFilter - comma separated list of names of child nodes to load
("*" loads all, while "none" loads no children)maxDepth - the maximum depth of loaded child nodes (0 means no child nodes are loaded,
while a negative value means that no restrictions are set on the depth).
JcrMappingException
public <T> T fromNode(java.lang.Class<T> entityClass,
javax.jcr.Node node,
NodeFilter nodeFilter)
throws JcrMappingException
entityClass - the class of the entity to be instantiated from the node
(in the case of dynamic instantiation, the instance class may be read from
the document, but will be cast to this class)node - the JCR node from which to create the objectnodeFilter - the NodeFilter to apply when loading child nodes and references
JcrMappingException
public javax.jcr.Node addNode(javax.jcr.Node parentNode,
java.lang.Object entity)
throws JcrMappingException
parentNode - the parent node to which the entity node will be addedentity - the entity to be mapped to the JCR node
JcrMappingException
public javax.jcr.Node addNode(javax.jcr.Node parentNode,
java.lang.Object entity,
java.lang.String[] mixinTypes)
throws JcrMappingException
parentNode - the parent node to which the entity node will be addedentity - the entity to be mapped to the JCR nodemixinTypes - an array of mixin type that will be added to the new node
JcrMappingException
public java.lang.String updateNode(javax.jcr.Node node,
java.lang.Object entity)
throws JcrMappingException
node - the JCR node to be updatedentity - the entity that will be mapped to the existing node
JcrMappingException
public java.lang.String updateNode(javax.jcr.Node node,
java.lang.Object entity,
java.lang.String childNodeFilter,
int maxDepth)
throws JcrMappingException
node - the JCR node to be updatedentity - the entity that will be mapped to the existing nodechildNodeFilter - comma separated list of names of child nodes to update
("*" updates all, while "none" updates no children)maxDepth - the maximum depth of updated child nodes (0 means no child nodes are updated,
while a negative value means that no restrictions are set on the depth).
JcrMappingException
public java.lang.String updateNode(javax.jcr.Node node,
java.lang.Object entity,
NodeFilter nodeFilter)
throws JcrMappingException
node - the JCR node to be updatedentity - the entity that will be mapped to the existing nodenodeFilter - the NodeFilter to apply when updating child nodes and references
JcrMappingException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||