## com.saxonica.schema
Class LengthFacet

    java.lang.Object
      com.saxonica.schema.Facet
          com.saxonica.schema.LengthFacet

All Implemented Interfaces:
  java.io.Serializable

Direct Known Subclasses:
  MaxLengthFacet, MinLengthFacet

    public class LengthFacet

extends Facet

Represents the length facet. Sublclasses represent the minLength and maxLength facets.

See Also:
  Serialized Form

Field Summary

Fields inherited from class com.saxonica.schema.Facet
`ASSERT, ENUMERATION, FRACTIONDIGITS, LENGTH, MAX_EXCLUSIVE, MAX_INCLUSIVE, MAX_LENGTH, MIN_EXCLUSIVE, MIN_INCLUSIVE, MIN_LENGTH, PATTERN, TOTALDIGITS, WHITESPACE`

Constructor Summary
`LengthFacet()`

Method Summary
`void` `checkFacetRestriction(UserSimpleType type, SimpleType base)` Check that this facet is legal when used on a type derived by restriction
`java.lang.String` `getName()` Returns the name of this Facet
`java.lang.String` `getValue()` Returns the lexical representation of this facet
`void` `setIntegerValue(int value)` Set the value as an integer
`void` `setValue(java.lang.String value)` Set the value of this facet as a string.
`boolean` `testAtomicValue(AtomicValue value)` Test whether an atomic value conforms to this facet
`boolean` `testLength(int actualLength)` Test whether a supplied length conforms to this required length.
`long` `toLong()` Returns the numeric value of this facet

Methods inherited from class com.saxonica.schema.Facet
`getWhitespaceAction, isFacetName, isFixed, isNewlyIntroduced, makeFacet, serializeFacet, setFixed, testListValue`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LengthFacet

    public LengthFacet()

Method Detail

### getName

    public java.lang.String getName()

  Description copied from class: `Facet`
  Returns the name of this Facet

  Specified by:
    `getName` in class `Facet`
  Returns:
    the name of this Facet

### getValue

    public java.lang.String getValue()

  Description copied from class: `Facet`
  Returns the lexical representation of this facet

  Specified by:
    `getValue` in class `Facet`
  Returns:
    the value of this facet

### toLong

    public long toLong()

  Description copied from class: `Facet`
  Returns the numeric value of this facet

  Overrides:
    `toLong` in class `Facet`
  Returns:
    a long representation of the value of this facet

### setIntegerValue

    public void setIntegerValue(int value)

  Set the value as an integer

### setValue

    public void setValue(java.lang.String value)
                  throws SchemaException

  Set the value of this facet as a string. For internal use only.

  Specified by:
    `setValue` in class `Facet`
  Parameters:
    `value` - the value as a string, which must parse as an integer
  Throws:
    `SchemaException` - if the value is invalid.

### checkFacetRestriction

    public void checkFacetRestriction(UserSimpleType type,
                                      SimpleType base)
                               throws SchemaException,
                                      ValidationException

  Check that this facet is legal when used on a type derived by restriction

  Overrides:
    `checkFacetRestriction` in class `Facet`
  Parameters:
    `base` - the type from which the restricted type is derived
    `type` - the type on which the facet is defined
  Throws:
    `SchemaException` - if the facet is not legal
    `ValidationException`

### testAtomicValue

    public boolean testAtomicValue(AtomicValue value)

  Test whether an atomic value conforms to this facet

  Overrides:
    `testAtomicValue` in class `Facet`
  Parameters:
    `value` - the value to be tested
  Returns:
    true if the value conforms; false if it doesn't conform, or if the test fails

### testLength

    public boolean testLength(int actualLength)

  Test whether a supplied length conforms to this required length. This method is overridden for the minlength and maxlength facets.

  Overrides:
    `testLength` in class `Facet`
  Parameters:
    `actualLength` - the actual length of the list
  Returns:
    true if the facet allows a list of this length, otherwise false

Copyright (c) Saxonica Limited. All rights reserved.