|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Objectjava.text.FieldPosition
public class FieldPosition
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 の文字列表現を返します。 |
| クラス java.lang.Object から継承されたメソッド |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| コンストラクタの詳細 |
|---|
public FieldPosition(int field)
NumberFormat.INTEGER_FIELD,
NumberFormat.FRACTION_FIELD,
DateFormat.YEAR_FIELD,
DateFormat.MONTH_FIELDpublic 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)
Object 内の equalsobj - 比較対象の参照オブジェクト
true、そうでない場合は falseObject.hashCode(),
Hashtablepublic int hashCode()
Object 内の hashCodeObject.equals(java.lang.Object),
Hashtablepublic String toString()
Object 内の toString
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。