public class FieldPosition extends Object
FieldPosition クラスは、フォーマットされた出力のフィールドを識別するために Format とそのサブクラスが使用する単純なクラスです。フィールドは 2 つの方法で識別されます。
_FIELD で終わります。定数は Format のさまざまなサブクラスで定義されます。
Format.Field 定数。使用例は、DateFormat の ERA_FIELD などを参照してください。
FieldPosition は、フォーマットされた出力の中で、フィールドの最初の文字のインデックスとフィールドの最後の文字のインデックスの 2 つを使用してフィールドの位置を追跡します。
さまざまな Format クラスにおける format メソッドの 1 つのバージョンは、引数として FieldPosition オブジェクトを要求します。この format メソッドを使用して、部分的なフォーマットを実行したり、フォーマットされた出力 (フィールドのポジションなど) についての情報を取得できます。
フォーマットされた文字列におけるすべての属性の位置を知るには、Format メソッドの formatToCharacterIterator を使用します。
Format| コンストラクタと説明 |
|---|
FieldPosition(Format.Field attribute)
指定されたフィールド定数のための FieldPosition オブジェクトを生成します。
|
FieldPosition(Format.Field attribute, int fieldID)
指定されたフィールドのための
FieldPosition オブジェクトを生成します。 |
FieldPosition(int field)
指定されたフィールドのための FieldPosition オブジェクトを生成します。
|
| 修飾子と型 | メソッドと説明 |
|---|---|
boolean |
equals(Object obj)
equals をオーバーライドします。
|
int |
getBeginIndex()
要求されたフィールドで最初の文字のインデックスを取得します。
|
int |
getEndIndex()
要求されたフィールドで最後の文字に続く文字のインデックスを取得します。
|
int |
getField()
フィールド識別子を取得します。
|
Format.Field |
getFieldAttribute()
Field のサブクラスの 1 つからの属性定数としてフィールド識別子を返します。 |
int |
hashCode()
この FieldPosition のハッシュコードを返します。
|
void |
setBeginIndex(int bi)
開始インデックスを設定します。
|
void |
setEndIndex(int ei)
終了インデックスを設定します。
|
String |
toString()
この FieldPosition の文字列表現を返します。
|
public FieldPosition(int field)
public FieldPosition(Format.Field attribute)
Format サブクラスで定義される定数で識別されます。これは、new FieldPosition(attribute, -1) の呼び出しと同等です。attribute - フィールドを識別する Format.Field 定数public FieldPosition(Format.Field attribute, int fieldID)
FieldPosition オブジェクトを生成します。フィールドは、Field サブクラスの 1 つからの属性定数や、Format サブクラスで定義される整数型フィールド ID によって識別されます。Field を認識する Format サブクラスは、attribute が null でない場合に attribute を優先し、fieldID を無視します。ただし、古い Format サブクラスでは Field を認識せず、fieldID に依存する場合があります。フィールドが対応する整数型定数を持たない場合は、fieldID は -1 になります。attribute - フィールドを識別する Format.Field 定数fieldID - フィールドを識別する整数型定数public Format.Field getFieldAttribute()
Field のサブクラスの 1 つからの属性定数としてフィールド識別子を返します。フィールドが整数型フィールド ID だけによって指定される場合は、null を返します。public int getField()
public int getBeginIndex()
public int getEndIndex()
public void setBeginIndex(int bi)
public void setEndIndex(int ei)
public boolean equals(Object obj)
equals、クラス: Objectobj - 比較対象の参照オブジェクト。true、それ以外の場合は false。Object.hashCode()、HashMappublic int hashCode()
hashCode、クラス: ObjectObject.equals(java.lang.Object), System.identityHashCode(java.lang.Object) バグまたは機能を送信
詳細な API リファレンスおよび開発者ドキュメントについては、Java SE のドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.