Class AbstractLengthFacet

    • Constructor Detail

      • AbstractLengthFacet

        protected AbstractLengthFacet()
        No-arg constructor. By default only 'collapse' is supported for the whiteSpace facet.
      • AbstractLengthFacet

        protected AbstractLengthFacet​(boolean whiteSpaceCollapseOnly)
        Construct a new AbstractXSLengthFacet optionally allowing the whiteSpace facet to be set to 'replace' and 'preserve' values in addition to 'collaps'.
        Parameters:
        whiteSpaceCollapseOnly - If set to true only 'collapse' is allowed for the whiteSpace facet. If set to false 'collaps', 'replace' and 'preserve' values are allowed for whiteSpace facet.
    • Method Detail

      • hasLength

        public final boolean hasLength()
        Returns true if a length has been set.
        Returns:
        True if a length has been set.
      • getLength

        public final int getLength()
        Returns the length that this type must have.
        Returns:
        The length that this type must have.
      • setLength

        public final void setLength​(int length)
        Sets the length of this type. While setting the length, the maxLength and minLength are also set up to this length.
        Parameters:
        length - The length to set.
      • hasMaxLength

        public final boolean hasMaxLength()
        Returns true if a maximum length has been set.
        Returns:
        True if a maximum length has been set.
      • getMaxLength

        public final int getMaxLength()
        Returns the maximum length occurances of this type can be. A negative value denotes no maximum length.
        Returns:
        The maximum length facet.
      • setMaxLength

        public final void setMaxLength​(int maxLength)
        Sets the maximum length of this type. To remove the max length facet, use a negative value.
        Parameters:
        maxLength - The maximum length for occurances of this type.
      • hasMinLength

        public final boolean hasMinLength()
        Returns true if a minimum length has been set.
        Returns:
        True if a minimum length has been set.
      • getMinLength

        public final int getMinLength()
        Returns the minimum length occurances of this type can be.
        Returns:
        The minimum length facet.
      • setMinLength

        public final void setMinLength​(int minLength)
        Sets the minimum length of this XSString.
        Parameters:
        minLength - The minimum length for occurances of this type.
      • setFacet

        protected final void setFacet​(Facet facet)
        Set the given facet for XSType if applicable.
        Overrides:
        setFacet in class AbstractWhiteSpaceFacet
        Parameters:
        facet - The facet to set for XSType.
      • setLengthFacet

        protected final void setLengthFacet​(Facet facet)
        Transfer given facet if it is one of length, maxLength or minLength.
        Parameters:
        facet - The facet to transfer.
      • codeLengthFacet

        protected final void codeLengthFacet​(JSourceCode jsc,
                                             java.lang.String validatorName)
        Generate the source code for length, maxLength or minLength facets validation.
        Parameters:
        jsc - The JSourceCode to fill in.
        validatorName - The name of the TypeValidator that the patterns should be added to.