org.sourceid.saml20.adapter.conf
Class Field

java.lang.Object
  extended by org.sourceid.saml20.adapter.conf.Field
All Implemented Interfaces:
java.io.Serializable

public class Field
extends java.lang.Object
implements java.io.Serializable

This class holds the name and user-entered value of a GUI-rendered configuration field.

Author:
Brian Campbell
See Also:
FieldDescriptor, FieldList.getFields(), FieldList.getField(String), FieldList.getFields(), FieldList.getField(String), Serialized Form

Field Summary
static int DEFAULT_NUM_VAL
           
 
Constructor Summary
Field(java.lang.String name, java.lang.String value)
          Create a new Field with the specified name and value.
 
Method Summary
 byte[] getFileValueAsByteArray()
          If the field type is an UploadFileFieldDescriptor and the file uploaded is binary, this method will return the bytes of the file.
 java.lang.String getFileValueAsString()
          If the field type is an UploadFileFieldDescriptor and the file uploaded is text, this method will return that text (after base 64 decoding it).
 java.lang.String getName()
          Gets the name of this field.
 java.lang.String getValue()
          Gets the value of this field.
 boolean getValueAsBoolean()
          This method coerces an boolean value from the underlying String value.
 double getValueAsDouble()
          This method attempts to coerce a double value from the underlying String value.
 float getValueAsFloat()
          This method attempts to coerce a float value from the underlying String value.
 int getValueAsInt()
          This method attempts to coerce an int value from the underlying String value.
 long getValueAsLong()
          This method attempts to coerce a long value from the underlying String value.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_NUM_VAL

public static final int DEFAULT_NUM_VAL
See Also:
Constant Field Values
Constructor Detail

Field

public Field(java.lang.String name,
             java.lang.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 -
Method Detail

getName

public java.lang.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 java.lang.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.

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:
UploadFileFieldDescriptor

getFileValueAsString

public java.lang.String getFileValueAsString()
If the field type is an UploadFileFieldDescriptor and the file uploaded is text, this method will return that text (after base 64 decoding it).

Returns:
the text value of the uploaded file.
See Also:
UploadFileFieldDescriptor

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright 2007 Ping Identity Corp. All rights reserved.