Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.common.schema.model
Class DefinitionUtil

java.lang.Object
  extended by eu.esdihumboldt.hale.common.schema.model.DefinitionUtil

public abstract class DefinitionUtil
extends Object

Definition utility methods

Author:
Simon Templer

Constructor Summary
DefinitionUtil()
           
 
Method Summary
static Collection<? extends ChildDefinition<?>> getAllChildren(DefinitionGroup group)
          Get all children of a definition group.
static Collection<? extends PropertyDefinition> getAllProperties(DefinitionGroup group)
          Get all properties of a definition group.
static Cardinality getCardinality(ChildDefinition<?> child)
          Get the cardinality of a child definition.
static ChildDefinition<?> getChild(ChildDefinition<?> definition, QName name)
          Returns the child definition of definition with the given name.
static ChildDefinition<?> getChild(ChildDefinition<?> definition, QName name, boolean allowIgnoreNamespace)
          Returns the child definition of definition with the given name.
static ChildDefinition<?> getChild(Definition<?> definition, QName name)
          Returns the child definition of definition with the given name.
static ChildDefinition<?> redeclareChild(ChildDefinition<?> child, DefinitionGroup newParent)
          Create a proxy for the given child with another declaring group
static ChildDefinition<?> reparentChild(ChildDefinition<?> child, TypeDefinition newParent)
          Create a proxy for the given child with another parent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefinitionUtil

public DefinitionUtil()
Method Detail

reparentChild

public static ChildDefinition<?> reparentChild(ChildDefinition<?> child,
                                               TypeDefinition newParent)
Create a proxy for the given child with another parent

Parameters:
child - the child
newParent - the new parent type
Returns:
the reparented child definition

redeclareChild

public static ChildDefinition<?> redeclareChild(ChildDefinition<?> child,
                                                DefinitionGroup newParent)
Create a proxy for the given child with another declaring group

Parameters:
child - the child
newParent - the new declaring group
Returns:
the redeclared child definition

getAllChildren

public static Collection<? extends ChildDefinition<?>> getAllChildren(DefinitionGroup group)
Get all children of a definition group. For TypeDefinition also the inherited children will be returned.

Parameters:
group - the definition group
Returns:
the children

getAllProperties

public static Collection<? extends PropertyDefinition> getAllProperties(DefinitionGroup group)
Get all properties of a definition group. For TypeDefinition also the inherited children will be returned. If there are children that are groups, their properties are also added.

Parameters:
group - the definition group
Returns:
the children

getCardinality

public static Cardinality getCardinality(ChildDefinition<?> child)
Get the cardinality of a child definition.

Parameters:
child - the child definition
Returns:
the cardinality

getChild

public static ChildDefinition<?> getChild(Definition<?> definition,
                                          QName name)
Returns the child definition of definition with the given name.

Parameters:
definition - the definition
name - the name of the child
Returns:
the child with the given name of the given definition, or null if it doesn't exist
Throws:
IllegalStateException - if the given definition isn't group nor property definition

getChild

public static ChildDefinition<?> getChild(ChildDefinition<?> definition,
                                          QName name)
Returns the child definition of definition with the given name.

Parameters:
definition - the definition
name - the name of the child
Returns:
the child with the given name of the given definition, or null if it doesn't exist
Throws:
IllegalStateException - if the given definition isn't group nor property definition

getChild

public static ChildDefinition<?> getChild(ChildDefinition<?> definition,
                                          QName name,
                                          boolean allowIgnoreNamespace)
Returns the child definition of definition with the given name.

Parameters:
definition - the definition
name - the name of the child
allowIgnoreNamespace - specifies if when the child with the exact name is not present, a child with a similar local name should be returned
Returns:
the child with the given name if it exists, a child with a similar local name if it exists or null
Throws:
IllegalStateException - if the given definition isn't group nor property definition

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d