Class RestrictionSimpleTypeImpl

All Implemented Interfaces:
ContentTypeImpl, Ref.ContentType, Ref.SimpleType, Ref.Type, XSComponent, XSContentType, XSDeclaration, XSRestrictionSimpleType, XSSimpleType, XSType

public class RestrictionSimpleTypeImpl extends SimpleTypeImpl implements XSRestrictionSimpleType
  • Constructor Details

  • Method Details

    • addFacet

      public void addFacet(XSFacet facet)
    • iterateDeclaredFacets

      public Iterator<XSFacet> iterateDeclaredFacets()
      Description copied from interface: XSRestrictionSimpleType
      Iterates facets that are specified in this step of derivation.
      Specified by:
      iterateDeclaredFacets in interface XSRestrictionSimpleType
    • getDeclaredFacets

      public Collection<? extends XSFacet> getDeclaredFacets()
      Description copied from interface: XSRestrictionSimpleType
      Gets all the facets that are declared on this restriction.
      Specified by:
      getDeclaredFacets in interface XSRestrictionSimpleType
      Returns:
      Can be empty but always non-null.
    • getDeclaredFacet

      public XSFacet getDeclaredFacet(String name)
      Description copied from interface: XSRestrictionSimpleType
      Gets the declared facet object of the given name.

      This method returns a facet object that is added in this type and does not recursively check the ancestors.

      For those facets that can have multiple values (pattern facets and enumeration facets), this method will return only the first one.

      Specified by:
      getDeclaredFacet in interface XSRestrictionSimpleType
      Returns:
      Null if the facet is not specified in the last step of derivation.
    • getDeclaredFacets

      public List<XSFacet> getDeclaredFacets(String name)
      Description copied from interface: XSRestrictionSimpleType
      Gets the declared facets of the given name. This method is for those facets (such as 'pattern') that can be specified multiple times on a simple type.
      Specified by:
      getDeclaredFacets in interface XSRestrictionSimpleType
      Returns:
      can be empty but never be null.
    • getFacet

      public XSFacet getFacet(String name)
      Description copied from interface: XSSimpleType
      Gets the effective facet object of the given name.

      For example, if a simple type "foo" is derived from xs:string by restriction with the "maxLength" facet and another simple type "bar" is derived from "foo" by restriction with another "maxLength" facet, this method will return the latter one, because that is the most restrictive, effective facet.

      For those facets that can have multiple values (pattern facets and enumeration facets), this method will return only the first one. TODO: allow clients to access all of them by some means.

      Specified by:
      getFacet in interface XSSimpleType
      Returns:
      If this datatype has a facet of the given name, return that object. If the facet is not specified anywhere in its derivation chain, null will be returned.
    • getFacets

      public List<XSFacet> getFacets(String name)
      Description copied from interface: XSSimpleType
      For multi-valued facets (enumeration and pattern), obtain all values.
      Specified by:
      getFacets in interface XSSimpleType
      Returns:
      can be empty but never null.
      See Also:
    • getVariety

      public XSVariety getVariety()
      Description copied from interface: XSSimpleType
      Gets the variety of this simple type.
      Specified by:
      getVariety in interface XSSimpleType
    • getPrimitiveType

      public XSSimpleType getPrimitiveType()
      Description copied from interface: XSSimpleType
      Gets the ancestor primitive if this type is atomic.
      Specified by:
      getPrimitiveType in interface XSSimpleType
      Returns:
      null otherwise.
    • isPrimitive

      public boolean isPrimitive()
      Description copied from interface: XSSimpleType
      Returns true if this is a primitive built-in simple type (that directly derives from xs:anySimpleType, by definition.)
      Specified by:
      isPrimitive in interface XSSimpleType
      Overrides:
      isPrimitive in class SimpleTypeImpl
    • visit

      public void visit(XSSimpleTypeVisitor visitor)
      Specified by:
      visit in interface XSSimpleType
    • apply

      public <T> T apply(XSSimpleTypeFunction<T> function)
      Specified by:
      apply in interface XSSimpleType
    • isRestriction

      public boolean isRestriction()
      Description copied from interface: XSSimpleType
      Returns true if this instanceof XSRestrictionSimpleType.
      Specified by:
      isRestriction in interface XSSimpleType
      Overrides:
      isRestriction in class SimpleTypeImpl
    • asRestriction

      public XSRestrictionSimpleType asRestriction()
      Specified by:
      asRestriction in interface XSSimpleType
      Overrides:
      asRestriction in class SimpleTypeImpl
    • getName

      public String getName()
      Description copied from interface: XSDeclaration
      Gets the (local) name of the declaration.
      Specified by:
      getName in interface XSDeclaration
      Returns:
      null if this component is anonymous.
    • getTargetNamespace

      public String getTargetNamespace()
      Description copied from interface: XSDeclaration
      Target namespace to which this component belongs. "" is used to represent the default no namespace.
      Specified by:
      getTargetNamespace in interface XSDeclaration
    • isAnonymous

      @Deprecated public boolean isAnonymous()
      Deprecated.
      Specified by:
      isAnonymous in interface XSDeclaration
    • isGlobal

      public final boolean isGlobal()
      Description copied from interface: XSDeclaration
      Returns true if this declaration is a global declaration. Global declarations are those declaration that can be enumerated through the schema object.
      Specified by:
      isGlobal in interface XSDeclaration
    • isLocal

      public final boolean isLocal()
      Description copied from interface: XSDeclaration
      Returns true if this declaration is a local declaration. Equivalent of !isGlobal()
      Specified by:
      isLocal in interface XSDeclaration