Interface Field
-
- All Superinterfaces:
Comparable<Field>
,Serializable
- All Known Implementing Classes:
AbstractField
,AccessPathField
,DateField
,DateFieldImpl
,DateRoField
,ExplorerField
,FileField
,GroupField
,JdbcField
,LdapField
,MultipleUserField
,PdcField
,PdcUserField
,PublicationsPickerField
,SequenceField
,TextField
,TextFieldImpl
,TextRoField
,UserField
public interface Field extends Serializable, Comparable<Field>
A Field is an item of a DataRecord. The fields of a record may have different types, but they are all managed via this interface. To be displayed in a web page a field must be handled by a specificFieldDisplayer
which is aware of the internal data type and format of the field. The links between Fields and FieldDisplayers are managed by aRecordTemplate
.- See Also:
DataRecord
,FieldDisplayer
,RecordTemplate
-
-
Field Summary
Fields Modifier and Type Field Description static String
FILE_PARAM_NAME_SUFFIX
static String
TYPE_FILE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
acceptObjectValue(Object value)
Is this field able to accept the specified value?boolean
acceptStringValue(String value)
Is this field able to accept the specifiedString
value?boolean
acceptValue(String value)
Is this field is able to accept the specified value?boolean
acceptValue(String value, String lang)
Is this field is able to accept the specified value in the given language?int
compareTo(Field field)
String
getName()
Gets the name of this field.Object
getObjectValue()
Gets the value of this field.int
getOccurrence()
Gets the occurrence position of this field in the case there is several identical fields in aDataRecord
.String
getStringValue()
Gets the normalizedString
value of this field.String
getTypeName()
Gets the type name of this field.String
getValue()
Gets the normalized value of this field.String
getValue(String lang)
Gets the textual value of this field in the specified language.boolean
isNull()
Is this field valued?void
setName(String name)
Sets the name of this field.void
setNull()
Sets to null this field.void
setObjectValue(Object value)
Sets the specified value.void
setOccurrence(int i)
Sets the specified occurrence position of this field in aDataRecord
when there is several similar fields.void
setStringValue(String value)
Sets the specifiedString
normalized value.void
setValue(String value)
Sets the specified normalized value.void
setValue(String value, String lang)
Sets the specified textual value in the given language.
-
-
-
Field Detail
-
TYPE_FILE
static final String TYPE_FILE
- See Also:
- Constant Field Values
-
FILE_PARAM_NAME_SUFFIX
static final String FILE_PARAM_NAME_SUFFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getTypeName
String getTypeName()
Gets the type name of this field.- Returns:
- the name of this field type.
-
getValue
String getValue()
Gets the normalized value of this field.- Returns:
- the value of this field.
-
setValue
void setValue(String value) throws FormException
Sets the specified normalized value.- Parameters:
value
- the normalized value to set.- Throws:
FormException
- when the field is readOnly or when the value format is wrong.
-
acceptValue
boolean acceptValue(String value)
Is this field is able to accept the specified value?- Returns:
- true if the value format is correct and this field isn't read only. False otherwise.
-
getValue
String getValue(String lang)
Gets the textual value of this field in the specified language.- Parameters:
lang
- the ISO-631 code of a supported language.- Returns:
- the value in the specified language.
-
setValue
void setValue(String value, String lang) throws FormException
Sets the specified textual value in the given language.- Parameters:
value
- a textual value.lang
- the ISO-631 code of a supported language.- Throws:
FormException
- when the field is readOnly or if the value isn't a text.
-
acceptValue
boolean acceptValue(String value, String lang)
Is this field is able to accept the specified value in the given language?- Parameters:
value
- a textual value.lang
- the ISO-631 code of a supported language.- Returns:
- true if the local value isn't ill formed and this field isn't read only.
-
getStringValue
String getStringValue()
Gets the normalizedString
value of this field.- Returns:
- the
String
representation of the value of this field.
-
setStringValue
void setStringValue(String value) throws FormException
Sets the specifiedString
normalized value.- Parameters:
value
- theString
value to set- Throws:
FormException
- when the field is readOnly or FormException when the value is not a normalized.
-
acceptStringValue
boolean acceptStringValue(String value)
Is this field able to accept the specifiedString
value?- Parameters:
value
- aString
value.- Returns:
- true if the value isn't normalized and this field isn't read only.
-
getObjectValue
Object getObjectValue()
Gets the value of this field.- Returns:
- an object representing the value of this field.
-
setObjectValue
void setObjectValue(Object value) throws FormException
Sets the specified value.- Parameters:
value
- anObject
representing the value to set.- Throws:
FormException
- when the field is readOnly or when the value has a wrong type.
-
acceptObjectValue
boolean acceptObjectValue(Object value)
Is this field able to accept the specified value?- Parameters:
value
- a value- Returns:
- true if the value hasn't a wrong type and this field isn't read only.
-
isNull
boolean isNull()
Is this field valued?- Returns:
- true if this field is not set. False otherwise.
-
setNull
void setNull() throws FormException
Sets to null this field.- Throws:
FormException
- when the field is mandatory or when the field is read only.
-
getOccurrence
int getOccurrence()
Gets the occurrence position of this field in the case there is several identical fields in aDataRecord
. A field is identified by its name.- Returns:
- the occurrence position of this field.
-
setOccurrence
void setOccurrence(int i)
Sets the specified occurrence position of this field in aDataRecord
when there is several similar fields. A field is identified by its name.- Parameters:
i
- the occurrence position.
-
setName
void setName(String name)
Sets the name of this field. Its name is its identifier in aDataRecord
or in aRecordTemplate
.- Parameters:
name
- the name of the field.
-
getName
String getName()
Gets the name of this field.- Returns:
- the field name.
-
compareTo
int compareTo(Field field)
- Specified by:
compareTo
in interfaceComparable<Field>
-
-