Package org.sourceid.saml20.adapter.conf
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.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_NUM_VAL
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getFileValueAsByteArray()If the field type is an UploadFileFieldDescriptor and the file uploaded is binary, this method will return the bytes of the file.StringgetFileValueAsString()If the field type is an UploadFileFieldDescriptor and the file uploaded is text, this method will return that text.StringgetLabel()Gets the label of this field.StringgetName()Gets the name of this field.StringgetValue()Gets the value of this field.booleangetValueAsBoolean()This method coerces an boolean value from the underlying String value.doublegetValueAsDouble()This method attempts to coerce a double value from the underlying String value.floatgetValueAsFloat()This method attempts to coerce a float value from the underlying String value.intgetValueAsInt()This method attempts to coerce an int value from the underlying String value.longgetValueAsLong()This method attempts to coerce a long value from the underlying String value.voidsetLabel(String label)StringtoString()
-
-
-
Field Detail
-
DEFAULT_NUM_VAL
public static final int DEFAULT_NUM_VAL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
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 reasonDEFAULT_NUM_VALis 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 reasonDEFAULT_NUM_VALis 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 reasonDEFAULT_NUM_VALis 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 reasonDEFAULT_NUM_VALis 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 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:
UploadFileFieldDescriptor
-
-