Class Field

java.lang.Object
org.sourceid.saml20.adapter.conf.Field
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
HashedField

public class Field extends Object implements Serializable
This class holds the name and user-entered value of a GUI-rendered configuration field.
See Also:
  • Field Summary

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

    Constructors
    Constructor
    Description
     
    Field(String name, String value)
    Create a new Field with the specified name and value.
    Field(String name, String label, String value)
    Create a new Field with the specified name, label and value.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    If the field type is an UploadFileFieldDescriptor and the file uploaded is binary, this method will return the bytes of the file.
    If the field type is an UploadFileFieldDescriptor and the file uploaded is text, this method will return that text.
    Gets the label of this field.
    Gets the name of this field.
    Gets the value of this field.
    boolean
    This method coerces an boolean value from the underlying String value.
    double
    This method attempts to coerce a double value from the underlying String value.
    float
    This method attempts to coerce a float value from the underlying String value.
    int
    This method attempts to coerce an int value from the underlying String value.
    long
    This method attempts to coerce a long value from the underlying String value.
    void
     
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • Field

      public Field()
    • Field

      public Field(String name, String value)
      Create a new Field with the specified name and value. The name of the field is the same name as the name of FieldDescriptor that was used to render the field on the GUI. The value will be the value entered by the admin/user in the GUI.
      Parameters:
      name -
      value -
    • Field

      public Field(String name, String label, String value)
      Create a new Field with the specified name, label and value.
      Parameters:
      name - The name of the field is the same name as the name of FieldDescriptor that was used to render the field on the GUI.
      label - The label of the field is the same label as the label of FieldDescriptor that was used to render the field on the GUI.
      value - The value entered by the admin/user in the GUI.
  • Method Details

    • getName

      public String getName()
      Gets the name of this field. The name of the field is the same name as the name of FieldDescriptor that was used to render the field on the GUI.
      Returns:
      the name
    • getValue

      public String getValue()
      Gets the value of this field. The value will be the value entered by the admin/user in the GUI.
      Returns:
      the value which may be null or an empty string.
    • getLabel

      public String getLabel()
      Gets the label of this field. If the label of FieldDescriptor that was used to render the field on the GUI exists, the label of the field will be the same label as the label of the FieldDescriptor. Otherwise, the label of the field will be the same as the name of the field.
      Returns:
      the label
    • setLabel

      public void setLabel(String label)
    • getValueAsInt

      public int getValueAsInt()
      This method attempts to coerce an int value from the underlying String value. If the coercion fails for any reason DEFAULT_NUM_VAL is returned.
      Returns:
      the value as an int.
    • getValueAsLong

      public long getValueAsLong()
      This method attempts to coerce a long value from the underlying String value. If the coercion fails for any reason DEFAULT_NUM_VAL is returned.
      Returns:
      the value as a long.
    • getValueAsFloat

      public float getValueAsFloat()
      This method attempts to coerce a float value from the underlying String value. If the coercion fails for any reason DEFAULT_NUM_VAL is returned.
      Returns:
      the value as a float.
    • getValueAsDouble

      public double getValueAsDouble()
      This method attempts to coerce a double value from the underlying String value. If the coercion fails for any reason DEFAULT_NUM_VAL is returned.
      Returns:
      the value as a double.
    • getValueAsBoolean

      public boolean getValueAsBoolean()
      This method coerces an boolean value from the underlying String value.
      Returns:
      true if the underlying String value is not null and is equal, ignoring case, to the string "true".
    • getFileValueAsByteArray

      public byte[] getFileValueAsByteArray()
      If the field type is an UploadFileFieldDescriptor and the file uploaded is binary, this method will return the bytes of the file.
      Returns:
      a byte array with the content of the uploaded file.
      See Also:
    • getFileValueAsString

      public String getFileValueAsString()
      If the field type is an UploadFileFieldDescriptor and the file uploaded is text, this method will return that text.
      Returns:
      the text value of the uploaded file.
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object