Package org.jibx.schema
Class SchemaUtils
java.lang.Object
org.jibx.schema.SchemaUtils
Utility methods for working with schema structures.
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Binding name for output with schema namespace as default (no prefix).private static final String[]
Pregenerated indentation strings.private static final String
String used as basis for indentation.static final Logger
Logger for class.static final String
Binding name for output with schema namespace prefix 'xs'. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
componentPath
(OpenAttrBase comp) Get path to component.static String
describeComponent
(SchemaBase comp) Get string description of component for use in logging.static String
getIndentation
(int depth) Get indentation string.static boolean
isEnumeration
(AnnotatedBase comp) Check if a particular schema definition component is an enumeration type definition.static boolean
isNamed
(OpenAttrBase comp) Check if a definition component has a name.static boolean
isNillable
(OpenAttrBase comp) Check if a definition component is nillable (an element with nillable='true').static boolean
isOptional
(IArity part) Check if a particle is optional (zero instances allowed).static boolean
Check if an attribute is optional (zero instances allowed).static boolean
Check if an element is optional (zero instances allowed).static boolean
isProhibited
(IArity part) Check if a particle is prohibited (no instances allowed).static boolean
isRepeated
(IArity part) Check if a particle is a repeated value.static boolean
isSingleton
(IArity part) Check if a particle is a singleton (one, and only one, instance allowed).static boolean
Check if an element is a singleton (one, and only one, instance allowed).
-
Field Details
-
XS_PREFIX_BINDING
Binding name for output with schema namespace prefix 'xs'.- See Also:
-
NO_PREFIX_BINDING
Binding name for output with schema namespace as default (no prefix).- See Also:
-
s_logger
public static final Logger s_loggerLogger for class. -
s_indentText
String used as basis for indentation.- See Also:
-
s_indents
Pregenerated indentation strings.
-
-
Constructor Details
-
SchemaUtils
public SchemaUtils()
-
-
Method Details
-
isRepeated
Check if a particle is a repeated value.- Parameters:
part
- particle to be checked- Returns:
true
if repeated,false
if not
-
isProhibited
Check if a particle is prohibited (no instances allowed).- Parameters:
part
- particle to be checked- Returns:
true
if prohibited,false
if not
-
isOptional
Check if a particle is optional (zero instances allowed).- Parameters:
part
- particle to be checked- Returns:
true
if optional,false
if not
-
isOptionalElement
Check if an element is optional (zero instances allowed).- Parameters:
elem
- element to be checked- Returns:
true
if optional,false
if not
-
isOptionalAttribute
Check if an attribute is optional (zero instances allowed).- Parameters:
attr
- attribute to be checked- Returns:
true
if optional,false
if not
-
isSingleton
Check if a particle is a singleton (one, and only one, instance allowed).- Parameters:
part
- particle to be checked- Returns:
true
if singleton,false
if not
-
isSingletonElement
Check if an element is a singleton (one, and only one, instance allowed).- Parameters:
elem
- element to be checked- Returns:
true
if singleton,false
if not
-
isNillable
Check if a definition component is nillable (an element with nillable='true').- Parameters:
comp
-- Returns:
true
if nillable,false
if not
-
isNamed
Check if a definition component has a name.- Parameters:
comp
-- Returns:
true
if named,false
if not
-
getIndentation
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
Get string description of component for use in logging.- Parameters:
comp
- schema component- Returns:
- description
-
componentPath
Get path to component.- Parameters:
comp
- schema component- Returns:
- description
-
isEnumeration
Check if a particular schema definition component is an enumeration type definition. Formally, this returnstrue
if and only if the component is a <simpleType> element which is a restriction using one or more <enumeration> facets.- Parameters:
comp
-- Returns:
true
if an enumeration definition,false
if not
-