Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


org.eclipse.emf.transaction.util
Class BasicTransactionOptionMetadata


java.lang.Object
  extended by 
org.eclipse.emf.transaction.util.BasicTransactionOptionMetadata
All Implemented Interfaces:
Transaction.OptionMetadata

public class BasicTransactionOptionMetadata
extends Object
implements Transaction.OptionMetadata

A simple implementation of the Transaction.OptionMetadata interface.

Since:
1.3

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

BasicTransactionOptionMetadata

public BasicTransactionOptionMetadata(
Object option)
Initializes me with my option key.

Parameters:
option - my option key

BasicTransactionOptionMetadata

public BasicTransactionOptionMetadata(
Object option,
                                      boolean isTag,
                                      boolean isHereditary,
                                      
Class<?> type,
                                      
Object defaultValue)
Initializes me with my option key and other details.

Parameters:
option - my option key
isTag - whether the option is a tag
isHereditary - whether the option is inherited
type - the option type
defaultValue - the option's defaul value
Method Detail

getDefaultValue

public 
Object getDefaultValue()
Description copied from interface: Transaction.OptionMetadata

Obtains the default value of an option.

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

Specified by:
getDefaultValue in interface Transaction.OptionMetadata
Returns:
the default value of the option, or null if it is not known

getOption

public final 
Object getOption()
Description copied from interface: Transaction.OptionMetadata
Obtains the key of the option that I describe. This is the key that would be used in the options map of a transaction.

Specified by:
getOption in interface Transaction.OptionMetadata
Returns:
my option

getType

public 
Class<?> getType()
Description copied from interface: Transaction.OptionMetadata

Obtains the type value of an option.

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

Specified by:
getType in interface Transaction.OptionMetadata
Returns:
the default value of the option, or Object if it is not known

isHereditary

public boolean isHereditary()
Description copied from interface: Transaction.OptionMetadata

Queries whether the option is inherited by nested transactions.

Unrecognized options are assumed to be inherited.

Specified by:
isHereditary in interface Transaction.OptionMetadata
Returns:
true if the option is inherited or if it is not recognized; false if it is not inherited

isTag

public boolean isTag()
Description copied from interface: 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.

Specified by:
isTag in interface Transaction.OptionMetadata
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

getValue

public 
Object getValue(
Map<?,?> options)
Description copied from interface: Transaction.OptionMetadata
Gets the value (implicit/default or explicit) of my option in the specified map.

Specified by:
getValue in interface Transaction.OptionMetadata
Parameters:
options - an options map
Returns:
my value in the map

isSet

public boolean isSet(
Map<?,?> options)
Description copied from interface: Transaction.OptionMetadata
Queries whether the specified map has a setting for my option.

Specified by:
isSet in interface Transaction.OptionMetadata
Parameters:
options - an options map
Returns:
whether it has a setting for my option

sameSetting

public boolean sameSetting(
Map<?,?> options1,
                           
Map<?,?> options2)
Description copied from interface: Transaction.OptionMetadata
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.

Specified by:
sameSetting in interface Transaction.OptionMetadata
Parameters:
options1 - an options map
options2 - another options map
Returns:
whether the two maps have the same setting of my option

inherit

public void inherit(
Map<?,?> parentOptions,
                    
Map<
Object,
Object> childOptions,
                    boolean force)
Description copied from interface: Transaction.OptionMetadata
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.

Specified by:
inherit in interface Transaction.OptionMetadata
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

safeEquals

protected boolean safeEquals(
Object a,
                             
Object b)

safeClass

protected 
Class<?> safeClass(
Object o)

newBoolean

public static 
Transaction.OptionMetadata newBoolean(
Object option,
                                                    boolean defaultValue)
Creates a new transaction option meta-data for an heritary, non-tag, boolean-valued option.

Parameters:
option - the option key
defaultValue - the option's default value
Returns:
the option meta-data

toString

public 
String toString()
Overrides:
toString in class Object

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


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire