org.apache.torque.generator.option
Class Options

java.lang.Object
  extended by org.apache.torque.generator.option.Options

public class Options
extends Object

A Store for all options.


Constructor Summary
Options()
           
 
Method Summary
 void addGlobalOptions(Collection<Option> options)
          Adds several options with global scope.
 boolean containsKey(QualifiedName key)
          Checks if an option with the given key exists in any scope.
 Options getAllInHierarchy(Namespace namespace)
          Returns all mappings which live in the given namespace.
 Map<QualifiedName,Option> getGlobalScope()
          Returns a map containing all options in the global scope.
 Options getInHierarchy(Namespace namespace)
          Returns all mappings which live in the given name space.
 Option getInHierarchy(QualifiedName key)
          Returns the value of the option which is closest in Hierarchy.
 Collection<QualifiedName> keySet()
          Returns all options in a set.
 void setGlobalOption(Option option)
          Sets an option with global scope.
 String toString()
           
 Collection<Option> values()
          Returns all options in a Collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Options

public Options()
Method Detail

setGlobalOption

public void setGlobalOption(Option option)
Sets an option with global scope.

Parameters:
option - the option to set, not null.
Throws:
NullPointerException - if option is null.

addGlobalOptions

public void addGlobalOptions(Collection<Option> options)
Adds several options with global scope.

Parameters:
options - the option to add, not null, may not contain null.
Throws:
NullPointerException - if options is null or contains null.

getInHierarchy

public Option getInHierarchy(QualifiedName key)
Returns the value of the option which is closest in Hierarchy. If more than one matching options (options with the matching name and in the name space or parent name space of the key) are found, the one which name space is closer to the given key's name space is chosen.

Parameters:
key - the key for the option which value should be retrieved.
Returns:
the value of the option (can be null), or null if no matching option exists.

getInHierarchy

public Options getInHierarchy(Namespace namespace)
Returns all mappings which live in the given name space. If one mapping hides another mapping, i.e. if one mapping is a more specialized version of another, the hidden mapping is NOT returned.

Parameters:
namespace - the name space from which the returned options should be visible.
Returns:
an Options object containing the matching options

getAllInHierarchy

public Options getAllInHierarchy(Namespace namespace)
Returns all mappings which live in the given namespace. If one mapping hides another mapping, i.e. if one mapping is a more specialized version of another, both mappings are present in the returned map.

Parameters:
namespace - the name space from which the returned options should be visible.
Returns:
an Options object containing the matching options

values

public Collection<Option> values()
Returns all options in a Collection.

Returns:
a Collection containing all options, not null. The collection is unmodifiable.

keySet

public Collection<QualifiedName> keySet()
Returns all options in a set.

Returns:
a Collection containing the qualified names of all options, not null.

getGlobalScope

public Map<QualifiedName,Option> getGlobalScope()
Returns a map containing all options in the global scope. The key of the map is the key of the option, the value is the option itself.

Returns:
a map containing the options in global scope, not null.

containsKey

public boolean containsKey(QualifiedName key)
Checks if an option with the given key exists in any scope.

Parameters:
key - the key to check.
Returns:
true if the key exists, false otherwise.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2000-2012 The Apache Software Foundation. All Rights Reserved.