public abstract class DefinitionUtil extends Object
Constructor and Description |
---|
DefinitionUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
equal(Definition<?> a,
Definition<?> b)
Checks whether two definitions are equal.
The result is true if a and b are both null. |
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 DefinitionGroup |
getDefinitionGroup(Definition<?> def)
Get the represented definition group of a definition.
|
static boolean |
hasChildren(Definition<?> def)
Determines if the given definition may have children.
|
static boolean |
isSuperType(TypeDefinition subType,
TypeDefinition superType)
Checks whether
superType is a super type of
subType or if they are the same. |
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
|
public static ChildDefinition<?> reparentChild(ChildDefinition<?> child, TypeDefinition newParent)
child
- the childnewParent
- the new parent typepublic static ChildDefinition<?> redeclareChild(ChildDefinition<?> child, DefinitionGroup newParent)
child
- the childnewParent
- the new declaring grouppublic static Collection<? extends ChildDefinition<?>> getAllChildren(DefinitionGroup group)
TypeDefinition
also
the inherited children will be returned.group
- the definition grouppublic static Collection<? extends PropertyDefinition> getAllProperties(DefinitionGroup group)
TypeDefinition
also
the inherited children will be returned. If there are children that are
groups, their properties are also added.group
- the definition grouppublic static Cardinality getCardinality(ChildDefinition<?> child)
child
- the child definitionpublic static ChildDefinition<?> getChild(Definition<?> definition, QName name)
definition
- the definitionname
- the name of the childnull
if it doesn't existIllegalStateException
- if the given definition isn't group nor
property nor type definitionpublic static ChildDefinition<?> getChild(ChildDefinition<?> definition, QName name)
definition
- the definitionname
- the name of the childnull
if it doesn't existIllegalStateException
- if the given definition isn't group nor
property definitionpublic static ChildDefinition<?> getChild(ChildDefinition<?> definition, QName name, boolean allowIgnoreNamespace)
definition
- the definitionname
- the name of the childallowIgnoreNamespace
- specifies if when the child with the exact
name is not present, a child with a similar local name should
be returnednull
IllegalStateException
- if the given definition isn't group nor
property definitionpublic static DefinitionGroup getDefinitionGroup(Definition<?> def)
def
- the definitionpublic static boolean hasChildren(Definition<?> def)
def
- the definitionpublic static boolean isSuperType(TypeDefinition subType, TypeDefinition superType)
superType
is a super type of
subType
or if they are the same.subType
- the type in questionsuperType
- the super typepublic static boolean equal(Definition<?> a, Definition<?> b)
true
if a
and b
are both null.
true
if a
and b
are both non-null, their
names are equal and both are of the same: TypeDefinition
,
PropertyDefinition
, GroupPropertyDefinition
or exactly
the same class.
false
in all other situations.
a
- the first definitionb
- the second definitionBuild 2013-10-07_11-27-38
Revision 99b27713a799a59a21b0b166eaaea8aaefbf125a