public static class Schema.Field extends Object implements Serializable
A field can be looked up within a schema in three ways:
A Field object can be used to obtain the value of a field in a tuple. However, there are rules that must be obeyed in doing so. For example, one must obtain the Field object from a Schema object that describes the schema of the tuple (i.e., as opposed to directly from a Field constructor).
See the "client" StreamBase sample (streambase-install-dir/sample/client) for examples of proper use of Field objects.
Note: Serializations of instances of this class that are created (e.g., by using
ObjectOutputStream
) in one version of StreamBase in general will not be
deserializable in any other version of StreamBase.
Constructor and Description |
---|
Field(Schema.Field field)
Construct a Field from an existing Field.
|
Field(String name,
CompleteDataType completeType,
com.streambase.sb.util.Location loc) |
Field(String name,
DataType dataType)
Deprecated.
Use
Schema.createField(DataType, String) instead |
Field(String name,
DataType dataType,
Schema s)
Deprecated.
Use
Schema.Field#Field(String, CompleteDataType) instead with
new Schema(name, CompleteDataType.forTuple(s)), or Schema.createTupleField(String, Schema) |
Field(String name,
Schema.Field field)
Construct a Field from an existing Field, giving the new field a specified name
|
Modifier and Type | Method and Description |
---|---|
void |
checkType(CompleteDataType dataType)
Check to make sure that the given type is the same as the type of this Field
|
void |
checkType(DataType dataType)
Deprecated.
|
boolean |
equalsNoCapture(Schema.Field other) |
CompleteDataType |
getCompleteDataType()
Return the CompleteDataType of the Field
|
DataType |
getDataType()
Return the DataType of the Field
|
String |
getDescription()
Returns the description currently set for this field.
|
CompleteDataType |
getElementType()
Return the element type for this field.
|
int |
getIndex()
Return the index of this field within the Schema
|
com.streambase.sb.util.Location |
getLocation() |
String |
getName()
Return the name of the Field.
|
Schema.Field |
getNestedField(String fieldPathName)
Return a field that identifies a field in a nested tuple field.
|
Schema.Field[] |
getNestedFields()
Return an array of fields, each of which identifies a field in a nested tuple field.
|
Schema |
getSchema()
Return the schema for this field.
|
String |
getShortName()
Return the last (which might be the only) segment of this Field
|
int |
getSize()
Return the size of the field (in bytes) without any header information.
|
void |
setDescription(String description)
Sets this field's description.
|
String |
toString()
Return a String representation of this field.
|
public Field(String name, CompleteDataType completeType, com.streambase.sb.util.Location loc)
public Field(Schema.Field field)
field
- Field to copy data frompublic Field(String name, Schema.Field field)
name
- The name of the fieldfield
- Field to copy data from@Deprecated public Field(String name, DataType dataType)
Schema.createField(DataType, String)
insteadname
- The name of the FielddataType
- The DataType of the FieldIllegalArgumentException
- if dataType requires a schema or an element typepublic Field(String name, DataType dataType, Schema s)
Schema.Field#Field(String, CompleteDataType)
instead with
new Schema(name, CompleteDataType.forTuple(s)), or Schema.createTupleField(String, Schema)
name
- The name of the FielddataType
- The DataType of the Fields
- The schema of the FieldIllegalArgumentException
- if dataType doesn't require a schema or requires an element typepublic com.streambase.sb.util.Location getLocation()
public boolean equalsNoCapture(Schema.Field other)
public void checkType(DataType dataType) throws TupleException
Schema.Field.checkType(CompleteDataType)
dataType
- The DataType to checkTupleException
- thrown when the types do not matchpublic void checkType(CompleteDataType dataType) throws TupleException
dataType
- The CompleteDataType to checkTupleException
- thrown when the types do not matchpublic DataType getDataType()
public CompleteDataType getCompleteDataType()
public String getName()
public String getShortName()
public int getIndex()
public int getSize()
public Schema getSchema()
public Schema.Field getNestedField(String fieldPathName) throws TupleException
fieldPathName
- the path name to the desired nested tuple fieldTupleException
- if the field path name is invalid or this field isn't of type Tuplepublic Schema.Field[] getNestedFields() throws TupleException
TupleException
- if this field is not of type Tuple.public String toString()
public String getDescription()
null
, and the description can only be guaranteed
to have meaning during application development in the authoring environment.null
when unknownpublic void setDescription(String description)
description
- the description String for this fieldpublic CompleteDataType getElementType()