|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.emf.transaction.util.BasicTransactionOptionMetadata
public class BasicTransactionOptionMetadata
A simple implementation of the Transaction.OptionMetadata
interface.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.eclipse.emf.transaction.Transaction.OptionMetadata |
---|
Transaction.OptionMetadata.Registry |
Constructor Summary | |
---|---|
BasicTransactionOptionMetadata(Object option)
Initializes me with my option key. |
|
BasicTransactionOptionMetadata(Object option,
boolean isTag,
boolean isHereditary,
Class<?> type,
Object defaultValue)
Initializes me with my option key and other details. |
Method Summary | |
---|---|
Object |
getDefaultValue()
Obtains the default value of an option. |
Object |
getOption()
Obtains the key of the option that I describe. |
Class<?> |
getType()
Obtains the type value of an option. |
Object |
getValue(Map<?,?> options)
Gets the value (implicit/default or explicit) of my option in the specified map. |
void |
inherit(Map<?,?> parentOptions,
Map<Object,Object> childOptions,
boolean force)
Updates the options map of a child transaction to inherit the setting in a parent transaction, if it is a hereditary option and the child does not already have a setting for it. |
boolean |
isHereditary()
Queries whether the option is inherited by nested transactions. |
boolean |
isSet(Map<?,?> options)
Queries whether the specified map has a setting for my option. |
boolean |
isTag()
Queries whether the option is a tag, meaning that it adorns a transaction with client-specific information but that it does not otherwise affect the semantics (or behaviour) of the transaction. |
static Transaction.OptionMetadata |
newBoolean(Object option,
boolean defaultValue)
Creates a new transaction option meta-data for an heritary, non-tag, boolean-valued option. |
protected Class<?> |
safeClass(Object o)
|
protected boolean |
safeEquals(Object a,
Object b)
|
boolean |
sameSetting(Map<?,?> options1,
Map<?,?> options2)
Queries whether the specified options maps have the same value of my option, whether that be implicit or explicit. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BasicTransactionOptionMetadata(Object option)
option
- my option keypublic BasicTransactionOptionMetadata(Object option, boolean isTag, boolean isHereditary, Class<?> type, Object defaultValue)
option
- my option keyisTag
- whether the option is a tagisHereditary
- whether the option is inheritedtype
- the option typedefaultValue
- the option's defaul valueMethod Detail |
---|
public Object getDefaultValue()
Transaction.OptionMetadata
Obtains the default value of an option.
The default value of an unrecognized option is assumed to be
null
.
getDefaultValue
in interface Transaction.OptionMetadata
null
if it
is not knownpublic final Object getOption()
Transaction.OptionMetadata
getOption
in interface Transaction.OptionMetadata
public Class<?> getType()
Transaction.OptionMetadata
Obtains the type value of an option.
The type of an unrecognized option is assumed to be Object
.
getType
in interface Transaction.OptionMetadata
Object
if it
is not knownpublic boolean isHereditary()
Transaction.OptionMetadata
Queries whether the option is inherited by nested transactions.
Unrecognized options are assumed to be inherited.
isHereditary
in interface Transaction.OptionMetadata
true
if the option is inherited or if it is not
recognized; false
if it is not inheritedpublic boolean isTag()
Transaction.OptionMetadata
Queries whether the option is a tag, meaning that it adorns a transaction with client-specific information but that it does not otherwise affect the semantics (or behaviour) of the transaction.
Unrecognized options are assumed to be tags, because a transaction would not be able to interpret their meaning.
isTag
in interface Transaction.OptionMetadata
true
if the option key is a tag option or if it
is not recognized by this meta-data instance;
false
if it is recognized and is known not to be
a tagpublic Object getValue(Map<?,?> options)
Transaction.OptionMetadata
getValue
in interface Transaction.OptionMetadata
options
- an options map
public boolean isSet(Map<?,?> options)
Transaction.OptionMetadata
isSet
in interface Transaction.OptionMetadata
options
- an options map
public boolean sameSetting(Map<?,?> options1, Map<?,?> options2)
Transaction.OptionMetadata
Transaction.OPTION_VALIDATE_EDIT
in which values of two
different types may mean the same thing.
sameSetting
in interface Transaction.OptionMetadata
options1
- an options mapoptions2
- another options map
public void inherit(Map<?,?> parentOptions, Map<Object,Object> childOptions, boolean force)
Transaction.OptionMetadata
inherit
in interface Transaction.OptionMetadata
parentOptions
- the options map to inherit a value from. It is conceivable
that inheritance of an option may depend on more than one
option in this parent mapchildOptions
- the map that is to inherit the option settingforce
- whether to inherit the option anyway despite that it is
not hereditary. This is used for application of default
options, and can be ignored by the implementor if
necessary. Also, clients must not use this parameter to
attempt to override an existing child setting; a
well-behaved option will not do thatprotected boolean safeEquals(Object a, Object b)
protected Class<?> safeClass(Object o)
public static Transaction.OptionMetadata newBoolean(Object option, boolean defaultValue)
option
- the option keydefaultValue
- the option's default value
public String toString()
toString
in class Object
|
Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |