Class SchemaUtils


  • public class SchemaUtils
    extends java.lang.Object
    Utility methods for working with schema structures.
    Author:
    Dennis M. Sosnoski
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String NO_PREFIX_BINDING
      Binding name for output with schema namespace as default (no prefix).
      private static java.lang.String[] s_indents
      Pregenerated indentation strings.
      private static java.lang.String s_indentText
      String used as basis for indentation.
      static Logger s_logger
      Logger for class.
      static java.lang.String XS_PREFIX_BINDING
      Binding 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.String componentPath​(OpenAttrBase comp)
      Get path to component.
      static java.lang.String describeComponent​(SchemaBase comp)
      Get string description of component for use in logging.
      static java.lang.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 isOptionalAttribute​(AttributeElement attr)
      Check if an attribute is optional (zero instances allowed).
      static boolean isOptionalElement​(ElementElement elem)
      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 isSingletonElement​(ElementElement elem)
      Check if an element is a singleton (one, and only one, instance allowed).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.
    • Constructor Detail

      • SchemaUtils

        public SchemaUtils()
    • Method Detail

      • isRepeated

        public static boolean isRepeated​(IArity part)
        Check if a particle is a repeated value.
        Parameters:
        part - particle to be checked
        Returns:
        true if repeated, false if not
      • isProhibited

        public static boolean isProhibited​(IArity part)
        Check if a particle is prohibited (no instances allowed).
        Parameters:
        part - particle to be checked
        Returns:
        true if prohibited, false if not
      • isOptional

        public static boolean isOptional​(IArity part)
        Check if a particle is optional (zero instances allowed).
        Parameters:
        part - particle to be checked
        Returns:
        true if optional, false if not
      • isOptionalElement

        public static boolean isOptionalElement​(ElementElement elem)
        Check if an element is optional (zero instances allowed).
        Parameters:
        elem - element to be checked
        Returns:
        true if optional, false if not
      • isOptionalAttribute

        public static boolean isOptionalAttribute​(AttributeElement attr)
        Check if an attribute is optional (zero instances allowed).
        Parameters:
        attr - attribute to be checked
        Returns:
        true if optional, false if 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:
        true if singleton, false if 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:
        true if singleton, false if not
      • isNillable

        public static boolean isNillable​(OpenAttrBase comp)
        Check if a definition component is nillable (an element with nillable='true').
        Parameters:
        comp -
        Returns:
        true if nillable, false if not
      • isNamed

        public static boolean isNamed​(OpenAttrBase comp)
        Check if a definition component has a name.
        Parameters:
        comp -
        Returns:
        true if named, false if 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 returns true 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