Package org.jibx.schema
Class SchemaUtils
- java.lang.Object
-
- org.jibx.schema.SchemaUtils
-
public class SchemaUtils extends Object
Utility methods for working with schema structures.- Author:
- Dennis M. Sosnoski
-
-
Field Summary
Fields Modifier and Type Field Description static StringNO_PREFIX_BINDINGBinding name for output with schema namespace as default (no prefix).static org.apache.log4j.Loggers_loggerLogger for class.static StringXS_PREFIX_BINDINGBinding name for output with schema namespace prefix 'xs'.
-
Constructor Summary
Constructors Constructor Description SchemaUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcomponentPath(OpenAttrBase comp)Get path to component.static StringdescribeComponent(SchemaBase comp)Get string description of component for use in logging.static StringgetIndentation(int depth)Get indentation string.static booleanisEnumeration(AnnotatedBase comp)Check if a particular schema definition component is an enumeration type definition.static booleanisNamed(OpenAttrBase comp)Check if a definition component has a name.static booleanisNillable(OpenAttrBase comp)Check if a definition component is nillable (an element with nillable='true').static booleanisOptional(IArity part)Check if a particle is optional (zero instances allowed).static booleanisOptionalAttribute(AttributeElement attr)Check if an attribute is optional (zero instances allowed).static booleanisOptionalElement(ElementElement elem)Check if an element is optional (zero instances allowed).static booleanisProhibited(IArity part)Check if a particle is prohibited (no instances allowed).static booleanisRepeated(IArity part)Check if a particle is a repeated value.static booleanisSingleton(IArity part)Check if a particle is a singleton (one, and only one, instance allowed).static booleanisSingletonElement(ElementElement elem)Check if an element is a singleton (one, and only one, instance allowed).
-
-
-
Field Detail
-
XS_PREFIX_BINDING
public static final String XS_PREFIX_BINDING
Binding name for output with schema namespace prefix 'xs'.- See Also:
- Constant Field Values
-
NO_PREFIX_BINDING
public static final String NO_PREFIX_BINDING
Binding name for output with schema namespace as default (no prefix).- See Also:
- Constant Field Values
-
s_logger
public static final org.apache.log4j.Logger s_logger
Logger for class.
-
-
Method Detail
-
isRepeated
public static boolean isRepeated(IArity part)
Check if a particle is a repeated value.- Parameters:
part- particle to be checked- Returns:
trueif repeated,falseif not
-
isProhibited
public static boolean isProhibited(IArity part)
Check if a particle is prohibited (no instances allowed).- Parameters:
part- particle to be checked- Returns:
trueif prohibited,falseif not
-
isOptional
public static boolean isOptional(IArity part)
Check if a particle is optional (zero instances allowed).- Parameters:
part- particle to be checked- Returns:
trueif optional,falseif not
-
isOptionalElement
public static boolean isOptionalElement(ElementElement elem)
Check if an element is optional (zero instances allowed).- Parameters:
elem- element to be checked- Returns:
trueif optional,falseif not
-
isOptionalAttribute
public static boolean isOptionalAttribute(AttributeElement attr)
Check if an attribute is optional (zero instances allowed).- Parameters:
attr- attribute to be checked- Returns:
trueif optional,falseif not
-
isSingleton
public static boolean isSingleton(IArity part)
Check if a particle is a singleton (one, and only one, instance allowed).- Parameters:
part- particle to be checked- Returns:
trueif singleton,falseif not
-
isSingletonElement
public static boolean isSingletonElement(ElementElement elem)
Check if an element is a singleton (one, and only one, instance allowed).- Parameters:
elem- element to be checked- Returns:
trueif singleton,falseif not
-
isNillable
public static boolean isNillable(OpenAttrBase comp)
Check if a definition component is nillable (an element with nillable='true').- Parameters:
comp- Component- Returns:
trueif nillable,falseif not
-
isNamed
public static boolean isNamed(OpenAttrBase comp)
Check if a definition component has a name.- Parameters:
comp- Component- Returns:
trueif named,falseif not
-
getIndentation
public static String getIndentation(int depth)
Get indentation string. This returns a string of the requested number of indents to the maximum value supported, and otherwise just returns the maximum indentation.- Parameters:
depth- Indentation depth- Returns:
- indentation string
-
describeComponent
public static String describeComponent(SchemaBase comp)
Get string description of component for use in logging.- Parameters:
comp- schema component- Returns:
- description
-
componentPath
public static String componentPath(OpenAttrBase comp)
Get path to component.- Parameters:
comp- schema component- Returns:
- description
-
isEnumeration
public static boolean isEnumeration(AnnotatedBase comp)
Check if a particular schema definition component is an enumeration type definition. Formally, this returnstrueif and only if the component is a <simpleType> element which is a restriction using one or more <enumeration> facets.- Parameters:
comp- Component- Returns:
trueif an enumeration definition,falseif not
-
-