Package org.jibx.schema
Class SchemaUtils
- java.lang.Object
-
- org.jibx.schema.SchemaUtils
-
public class SchemaUtils extends java.lang.ObjectUtility methods for working with schema structures.- Author:
- Dennis M. Sosnoski
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNO_PREFIX_BINDINGBinding name for output with schema namespace as default (no prefix).private static java.lang.String[]s_indentsPregenerated indentation strings.private static java.lang.Strings_indentTextString used as basis for indentation.static Loggers_loggerLogger for class.static java.lang.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 java.lang.StringcomponentPath(OpenAttrBase comp)Get path to component.static java.lang.StringdescribeComponent(SchemaBase comp)Get string description of component for use in logging.static java.lang.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 java.lang.String XS_PREFIX_BINDING
Binding name for output with schema namespace prefix 'xs'.- See Also:
- Constant Field Values
-
NO_PREFIX_BINDING
public static final java.lang.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 Logger s_logger
Logger for class.
-
s_indentText
private static final java.lang.String s_indentText
String used as basis for indentation.- See Also:
- Constant Field Values
-
s_indents
private static final java.lang.String[] s_indents
Pregenerated indentation strings.
-
-
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-- Returns:
trueif nillable,falseif not
-
isNamed
public static boolean isNamed(OpenAttrBase comp)
Check if a definition component has a name.- Parameters:
comp-- Returns:
trueif named,falseif not
-
getIndentation
public static java.lang.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-- Returns:
- indentation string
-
describeComponent
public static java.lang.String describeComponent(SchemaBase comp)
Get string description of component for use in logging.- Parameters:
comp- schema component- Returns:
- description
-
componentPath
public static java.lang.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-- Returns:
trueif an enumeration definition,falseif not
-
-