public class DataSourceField
extends java.lang.Object
| Constructor and Description |
|---|
DataSourceField() |
DataSourceField(DataSourceField field) |
DataSourceField(java.lang.String fieldName) |
DataSourceField(java.lang.String fieldName,
java.lang.String type) |
| Modifier and Type | Method and Description |
|---|---|
static DataSourceField |
combineFieldData(DataSourceField localField,
DataSourceField dsField) |
java.lang.Boolean |
getCanEdit() |
java.lang.String |
getChildTagName()
For a field that is multiple:true, the tag name of each subelement.
|
java.lang.String |
getEditorType() |
java.lang.String |
getForeignKey() |
java.lang.String |
getHint() |
java.lang.Integer |
getLength() |
java.lang.String |
getName() |
java.lang.String |
getOffText() |
java.lang.String |
getOnText() |
java.lang.Boolean |
getRequired() |
java.lang.Boolean |
getShowTitle() |
java.lang.String |
getSubrecordsProperty() |
java.lang.String |
getTitle() |
java.lang.String |
getType()
The name of a registered
SimpleType. |
DataSource |
getTypeAsDataSource() |
java.util.LinkedHashMap<?,java.lang.String> |
getValueMap() |
boolean |
isDerived() |
boolean |
isHidden() |
java.lang.Boolean |
isInapplicable() |
java.lang.Boolean |
isMultiple()
Indicates that this field should always be array-valued (Java type
List). |
java.lang.Boolean |
isPrimaryKey() |
void |
setCanEdit(java.lang.Boolean canEdit) |
void |
setChildTagName(java.lang.String childTagName) |
void |
setDerived(boolean derived) |
void |
setEditorType(java.lang.String editorType) |
void |
setForeignKey(java.lang.String fk) |
void |
setHidden(boolean hidden) |
void |
setHint(java.lang.String hint) |
void |
setInapplicable(java.lang.Boolean inapplicable) |
void |
setLength(java.lang.Long length) |
void |
setMultiple(java.lang.Boolean multiple) |
void |
setName(java.lang.String name) |
void |
setNestedFields(DataSourceField... nestedFields)
Deprecated.
The preferred approach is to create a DataSource with the nested fields and
call
setTypeAsDataSource(DataSource). |
void |
setOffText(java.lang.String offText) |
void |
setOnText(java.lang.String onText) |
void |
setPrimaryKey(java.lang.Boolean pk) |
void |
setRequired(java.lang.Boolean required) |
void |
setShowTitle(java.lang.Boolean showTitle) |
void |
setSubrecordsProperty(java.lang.String subrecordsProperty) |
void |
setTitle(java.lang.String title) |
void |
setType(java.lang.String type) |
void |
setTypeAsDataSource(DataSource typeDS)
Sets the field type to a DataSource, which allows you to model nested structures.
|
void |
setValueMap(java.util.LinkedHashMap<?,java.lang.String> valueMap) |
public DataSourceField()
public DataSourceField(java.lang.String fieldName)
public DataSourceField(java.lang.String fieldName,
java.lang.String type)
public DataSourceField(DataSourceField field)
public static DataSourceField combineFieldData(DataSourceField localField, DataSourceField dsField)
public final java.lang.String getName()
public void setName(java.lang.String name)
public java.lang.Boolean isMultiple()
List).
If the value is singular, it will be wrapped in an array.
Specifically for XML serialization and deserialization, multiple:true
behaves similarly to the SOAP array idiom;
that is, there is a "wrapper element" having the field name as its tag name and one
or more child "value" elements that specify the values of the array.
The childTagName attribute allows the tag name of the
child "value" elements to be customized.
public void setMultiple(java.lang.Boolean multiple)
@Deprecated public void setNestedFields(DataSourceField... nestedFields)
setTypeAsDataSource(DataSource).nestedFields - the nested fields.public java.lang.String getChildTagName()
If null, then the child tag name is presumed to be "value".
public void setChildTagName(java.lang.String childTagName)
public void setDerived(boolean derived)
public boolean isDerived()
public void setHidden(boolean hidden)
public boolean isHidden()
public java.lang.Boolean getRequired()
public void setRequired(java.lang.Boolean required)
public final java.lang.String getType()
SimpleType.public void setType(java.lang.String type)
public final DataSource getTypeAsDataSource()
public void setTypeAsDataSource(DataSource typeDS)
When the type of the field is a DataSource, then this field will have
RecordList or Record
values, depending on whether this field is multiple:true or not,
respectively. The fields of this DataSource are called "nested fields". The nested fields
are referred to when parsing DataSource responses for the DataSource corresponding to this
DataSourceField.
When a field has nested fields, then the JSON value for the field should either be an
object or an array of objects, depending on the value of multiple. If
multiple is true, then the value should be an array; otherwise, the value
should be an object.
| Example 1 | Example 2 | |
|---|---|---|
| Data source response |
{
"response": {
"status": 0,
"startRow": 0,
"endRow": 1,
"totalRows": 1,
"data": [
{
"nestedRecord": {
"id": 7,
"title": "Nest #7"
}
}
]
}
}
|
{
"response": {
"status": 0,
"startRow": 0,
"endRow": 1,
"totalRows": 1,
"data": [
{
"nestedRecords": [
{ "id": 7, "title": "Nest #7" },
{ "id": 91, "title": "Nest #91" },
{ "id": 12, "title": "Nest #12" },
{ "id": 2, "title": "Nest #2" }
]
}
]
}
}
|
name |
"nestedRecord" |
"nestedRecords" |
multiple |
false | true |
If multiple is true, childTagName
is still applicable. If not null, as in Example 3 below, childTagName
is the name of subelements that will be parsed as records using the nested fields.
Otherwise, as in Example 2 below, subelements of the record element having tag name
name are collected and processed as the subelements.
| Example 1 | Example 2 | Example 3 | |
|---|---|---|---|
| Data source response |
<response>
<status>0</status>
<startRow>0</startRow>
<endRow>1</endRow>
<totalRows>1</totalRows>
<data>
<record>
<nestedRecord>
<id>7</id>
<title>Nest #7</title>
</nestedRecord>
</record>
</data>
</response>
|
<response>
<status>0</status>
<startRow>0</startRow>
<endRow>1</endRow>
<totalRows>1</totalRows>
<data>
<record>
<nestedRecord id="7" title="Nest #7"/>
<nestedRecord id="91" title="Nest #91"/>
<nestedRecord id="12" title="Nest #12"/>
<nestedRecord id="2" title="Nest #2"/>
</record>
</data>
</response>
|
<response>
<status>0</status>
<startRow>0</startRow>
<endRow>1</endRow>
<totalRows>1</totalRows>
<data>
<record>
<nestedRecords>
<nestedRecord id="7" title="Nest #7"/>
<nestedRecord id="91" title="Nest #91"/>
<nestedRecord id="12" title="Nest #12"/>
<nestedRecord id="2" title="Nest #2"/>
</nestedRecords>
</record>
</data>
</response>
|
name |
"nestedRecord" |
"nestedRecord" |
"nestedRecords" |
multiple |
false | true | true |
childTagName |
N/A | null | "nestedRecord" |
isMultiple(),
getChildTagName()public final java.lang.String getEditorType()
public final void setEditorType(java.lang.String editorType)
public final java.lang.String getHint()
public void setHint(java.lang.String hint)
public void setLength(java.lang.Long length)
public final java.lang.Integer getLength()
public void setTitle(java.lang.String title)
public final java.lang.String getTitle()
public final java.lang.Boolean getShowTitle()
public void setShowTitle(java.lang.Boolean showTitle)
public void setPrimaryKey(java.lang.Boolean pk)
public java.lang.Boolean isPrimaryKey()
public void setForeignKey(java.lang.String fk)
public java.lang.String getForeignKey()
public void setInapplicable(java.lang.Boolean inapplicable)
public java.lang.Boolean isInapplicable()
public final java.util.LinkedHashMap<?,java.lang.String> getValueMap()
public void setValueMap(java.util.LinkedHashMap<?,java.lang.String> valueMap)
public final java.lang.Boolean getCanEdit()
public final void setCanEdit(java.lang.Boolean canEdit)
public final java.lang.String getOnText()
public final void setOnText(java.lang.String onText)
public final java.lang.String getOffText()
public final void setOffText(java.lang.String offText)
public final java.lang.String getSubrecordsProperty()
public final void setSubrecordsProperty(java.lang.String subrecordsProperty)