public abstract class AttributeAccessorSupport extends ObjectSE implements AttributeAccessor, SerializableSE
AttributeAccessors
のサポートクラス。サブクラスによって拡張されます。Serializable
SE(サブクラスとすべての属性値が Serializable
SE の場合)。
コンストラクターと説明 |
---|
AttributeAccessorSupport() |
修飾子と型 | メソッドと説明 |
---|---|
StringSE[] | attributeNames() すべての属性の名前を返します。 |
<T> T | computeAttribute(StringSE name, FunctionSE<StringSE,T> computeFunction) |
protected void | copyAttributesFrom(AttributeAccessor source) 提供された AttributeAccessor からこのアクセサーに属性をコピーします。 |
boolean | equals(ObjectSE other) |
ObjectSE | getAttribute(StringSE name) name で識別される属性の値を取得します。 |
boolean | hasAttribute(StringSE name) name で識別される属性が存在する場合は、true を返します。 |
int | hashCode() |
ObjectSE | removeAttribute(StringSE name) name で識別される属性を削除し、その値を返します。 |
void | setAttribute(StringSE name, ObjectSE value) name で定義された属性を、指定された value に設定します。 |
cloneSE, finalizeSE, getClassSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public void setAttribute(StringSE name, @Nullable ObjectSE value)
AttributeAccessor
name
で定義された属性を、指定された value
に設定します。value
が null
の場合、属性は removed
です。
一般に、ユーザーは、クラスまたはパッケージ名を接頭辞として使用するなど、完全修飾名を使用して、他のメタデータ属性との重複を防ぐように注意する必要があります。
AttributeAccessor
の setAttribute
name
- 一意の属性キー value
- 添付する属性値 @Nullable public ObjectSE getAttribute(StringSE name)
AttributeAccessor
name
で識別される属性の値を取得します。 属性が存在しない場合は null
を返します。
AttributeAccessor
の getAttribute
name
- 一意の属性キー public <T> T computeAttribute(StringSE name, FunctionSE<StringSE,T> computeFunction)
AttributeAccessor
name
で識別される属性の新しい値を計算し、この AttributeAccessor
に新しい値を設定します。name
で識別される属性の値がこの AttributeAccessor
にすでに存在する場合、提供された計算関数を適用せずに既存の値が返されます。
このメソッドのデフォルトの実装はスレッドセーフではありませんが、このインターフェースの具体的な実装によってオーバーライドできます。
AttributeAccessor
の computeAttribute
T
- 属性値の型 name
- 一意の属性キー computeFunction
- 属性名の新しい値を計算する関数。関数は null
値を返してはなりません AttributeAccessor.getAttribute(String)
, AttributeAccessor.setAttribute(String, Object)
@Nullable public ObjectSE removeAttribute(StringSE name)
AttributeAccessor
name
で識別される属性を削除し、その値を返します。name
に属性が見つからない場合は、null
を返します。
AttributeAccessor
の removeAttribute
name
- 一意の属性キー public boolean hasAttribute(StringSE name)
AttributeAccessor
name
で識別される属性が存在する場合は、true
を返します。 それ以外の場合は false
を返します。
AttributeAccessor
の hasAttribute
name
- 一意の属性キー public StringSE[] attributeNames()
AttributeAccessor
AttributeAccessor
の attributeNames
protected void copyAttributesFrom(AttributeAccessor source)
source
- コピー元の AttributeAccessorpublic int hashCode()
ObjectSE
の hashCodeSE