public class FieldPosition extends Object
FieldPosition is passed
to the format method with such a parameter, then the indices will be set to
the start and end indices of the field in the formatted string.
A FieldPosition can be created by using the integer constants in the
various format classes (for example NumberFormat.INTEGER_FIELD) or
one of the fields of type Format.Field.
If more than one field position is needed, the method
Format.formatToCharacterIterator(Object) should be used.
| Constructor and Description |
|---|
FieldPosition(Format.Field attribute)
Constructs a new
FieldPosition for the given Field attribute. |
FieldPosition(Format.Field attribute,
int field)
Constructs a new
FieldPosition for the given Field attribute and field id. |
FieldPosition(int field)
Constructs a new
FieldPosition for the given field id. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object object)
Compares the given object to this field position and indicates if
they are equal.
|
int |
getBeginIndex()
Returns the index of the beginning of the field.
|
int |
getEndIndex()
Returns the index one past the end of the field.
|
int |
getField()
Returns the field which is being identified.
|
Format.Field |
getFieldAttribute()
Returns the attribute which is being identified.
|
int |
hashCode()
Returns an integer hash code for this object.
|
void |
setBeginIndex(int index)
Sets the index of the beginning of the field.
|
void |
setEndIndex(int index)
Sets the index of the end of the field.
|
String |
toString()
Returns the string representation of this field position.
|
public FieldPosition(int field)
FieldPosition for the given field id.public FieldPosition(Format.Field attribute)
FieldPosition for the given Field attribute.public FieldPosition(Format.Field attribute, int field)
FieldPosition for the given Field attribute and field id.public boolean equals(Object object)
object must be an instance
of FieldPosition with the same field, begin index and end index.equals in class Objectobject - the object to compare this instance with.true if the specified object is equal to this Object; false otherwise.Object.hashCode()public int getBeginIndex()
public int getEndIndex()
public int getField()
public Format.Field getFieldAttribute()
public int hashCode()
ObjectObject.equals(java.lang.Object) returns true must return
the same hash code value. This means that subclasses of Object
usually override both methods or neither method.
Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct
hashCode method
if you intend implementing your own hashCode method.
hashCode in class ObjectObject.equals(java.lang.Object)public void setBeginIndex(int index)
public void setEndIndex(int index)