Interface Field

All Superinterfaces:
Serializable
All Known Implementing Classes:
FieldImpl

public interface Field extends Serializable
A field is a member of a complex type.

It is defined by a name and a type.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    Gets the complex type or list type that declared this field.
    Gets this field default value or null if none.
    int
    Gets the maximum length for this field.
    int
    Gets the maximum number this field may occurs in the owner type.
    int
    Gets the minimum number this field may occurs in the owner type.
    Gets the field name.
    Gets the field type.
    boolean
    Checks whether this field is constant (is read only).
    boolean
    Checks whether this field is nillable (can have null values).
    void
    setConstant(boolean isConstant)
    Sets the constant flag.
    void
    Sets the default value of this field.
    void
    setMaxLength(int length)
    Sets the maximum length for this field.
    void
    setMaxOccurs(int max)
    Sets max number of occurrences for this field.
    void
    setMinOccurs(int min)
    Sets min number of occurrences for this field.
    void
    setNillable(boolean isNillable)
    Sets the nillable flag.
  • Field Details

  • Method Details

    • getName

      QName getName()
      Gets the field name.
      Returns:
      the field name
    • getType

      Type getType()
      Gets the field type.
      Returns:
      the field type
    • getDeclaringType

      Type getDeclaringType()
      Gets the complex type or list type that declared this field.

      The declaring type may differ from the complex type owning this field.

      For example, in the case of a derived complex type, the field is owned by both the derived type and the base type, but it's declared only by the base type.

      Returns:
      the complex that declared this field
    • getDefaultValue

      Object getDefaultValue()
      Gets this field default value or null if none.
      Returns:
      the default value if any was specified, null otherwise
    • isNillable

      boolean isNillable()
      Checks whether this field is nillable (can have null values).
      Returns:
      true if the field can have null values
    • isConstant

      boolean isConstant()
      Checks whether this field is constant (is read only).
      Returns:
      true if the field is constant false otherwise
    • setDefaultValue

      void setDefaultValue(String value)
      Sets the default value of this field.
      Parameters:
      value - the value to set
    • setNillable

      void setNillable(boolean isNillable)
      Sets the nillable flag.
    • setConstant

      void setConstant(boolean isConstant)
      Sets the constant flag.
    • getMaxOccurs

      int getMaxOccurs()
      Gets the maximum number this field may occurs in the owner type.

      By default this is 1. -1 is returned if not a maximum limit is imposed.

      Returns:
      the max occurrences
    • getMinOccurs

      int getMinOccurs()
      Gets the minimum number this field may occurs in the owner type.

      By default this is 1.

      Returns:
      the min occurrences
    • setMaxOccurs

      void setMaxOccurs(int max)
      Sets max number of occurrences for this field.
      Parameters:
      max - max number of occurrences
    • setMinOccurs

      void setMinOccurs(int min)
      Sets min number of occurrences for this field.
      Parameters:
      min - min number of occurrences
    • getMaxLength

      int getMaxLength()
      Gets the maximum length for this field.

      Value -1 means no constraint.

      Returns:
      the length
    • setMaxLength

      void setMaxLength(int length)
      Sets the maximum length for this field.
      Parameters:
      length - the length, or -1 for no constraint
    • getConstraints

      Set<Constraint> getConstraints()
      Returns:
      The constraints applied to this field.
      Since:
      7.1