org.eclipse.emf.transaction
Interface Transaction.OptionMetadata

All Known Implementing Classes:
BasicTransactionOptionMetadata
Enclosing interface:
Transaction

public static interface Transaction.OptionMetadata

An interface that allows clients to query certain meta-data about transaction options.

This interface is not intended to be implemented by clients. Extend the BasicTransactionOptionMetadata class, instead.

Since:
1.3
See Also:
BasicTransactionOptionMetadata, Transaction.OptionMetadata.Registry

Nested Class Summary
static interface Transaction.OptionMetadata.Registry
           A registry of metadata describing transaction options.
 
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.
 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.
 

Method Detail

getOption

Object getOption()
Obtains the key of the option that I describe. This is the key that would be used in the options map of a transaction.

Returns:
my option

isTag

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.

Unrecognized options are assumed to be tags, because a transaction would not be able to interpret their meaning.

Returns:
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 tag

isHereditary

boolean isHereditary()

Queries whether the option is inherited by nested transactions.

Unrecognized options are assumed to be inherited.

Returns:
true if the option is inherited or if it is not recognized; false if it is not inherited

getType

Class<?> getType()

Obtains the type value of an option.

The type of an unrecognized option is assumed to be Object.

Returns:
the default value of the option, or Object if it is not known

getDefaultValue

Object getDefaultValue()

Obtains the default value of an option.

The default value of an unrecognized option is assumed to be null.

Returns:
the default value of the option, or null if it is not known

getValue

Object getValue(Map<?,?> options)
Gets the value (implicit/default or explicit) of my option in the specified map.

Parameters:
options - an options map
Returns:
my value in the map

isSet

boolean isSet(Map<?,?> options)
Queries whether the specified map has a setting for my option.

Parameters:
options - an options map
Returns:
whether it has a setting for my option

sameSetting

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. That is, this method accounts for default values and such complex cases as the Transaction.OPTION_VALIDATE_EDIT in which values of two different types may mean the same thing.

Parameters:
options1 - an options map
options2 - another options map
Returns:
whether the two maps have the same setting of my option

inherit

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.

Parameters:
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 map
childOptions - the map that is to inherit the option setting
force - 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 that

Copyright 2002, 2007 IBM Corporation and others.
All Rights Reserved.