Class Length

Object
Length

public abstract class Length extends Object
length is the number of units of length, where units of length varies depending on the type that is being ???derived??? from.

The value of length ???must??? be a nonNegativeInteger. Length is defined as:

  • string length is measured in units of characters
  • anyURI length is measured in units of characters
  • hexBinary and base64Binary length is measured in octets (8bits) on binary data
  • list length is measured in number of list items
This is xml so length string applies to datatypes derrived from string. Simon the spec says: For string and datatypes ???derived??? from string, length will not always coincide with "string length" as perceived by some users or with the number of storage units in some digital representation. Therefore, care should be taken when specifying a value for length and in attempting to infer storage requirements from a given value for length.

Example:


 <simpleType name='productCode'>
  <restriction base='string'>
    <length value='8' fixed='true'/>
  </restriction>
 </simpleType>
 
Author:
Jody Garnett
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Length
    string and anyURI measured length is measured in units of characters
    static final Length
    By default this one understands Collection, Array and Integer.
    static final Length
    hexBinary and base64Binary length is measured in octets (8bits) on binary data
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    length(XSDTypeDefinition definition)
     
    abstract void
    validate(XSDTypeDefinition definition, Object value)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CHARACTERS

      public static final Length CHARACTERS
      string and anyURI measured length is measured in units of characters
    • OCTETS

      public static final Length OCTETS
      hexBinary and base64Binary length is measured in octets (8bits) on binary data
    • LIST

      public static final Length LIST
      By default this one understands Collection, Array and Integer.

      So if you are checking a custom object please pass in an Integer representing the size of your object.

  • Method Details