org.apache.jsieve
Class ComparatorManagerImpl

java.lang.Object
  extended by org.apache.jsieve.ComparatorManagerImpl
All Implemented Interfaces:
ComparatorManager

public class ComparatorManagerImpl
extends java.lang.Object
implements ComparatorManager

Maps Comparator names to configured Comparator implementation classes.

Thread Safety

Instances may safely be accessed concurrently by multiple threads.


Constructor Summary
ComparatorManagerImpl(java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.String> classNameMap)
          Constructs a manager with the standard comparators implicitly defined.
ComparatorManagerImpl(java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.String> classNameMap, java.util.concurrent.CopyOnWriteArraySet<java.lang.String> implicitlyDeclared)
          Constructor for ComparatorManager.
 
Method Summary
 Comparator getComparator(java.lang.String name)
           Method newInstance answers an instance of the class to which a Comparator name is mapped.
 boolean isImplicitlyDeclared(java.lang.String comparatorName)
          Is an explicit declaration in a require statement unnecessary for this comparator?
 boolean isSupported(java.lang.String name)
          Is the comparator with the given name supported?
 java.lang.Class lookup(java.lang.String name)
           Method lookup answers the class to which a Comparator name is mapped.
static java.util.concurrent.CopyOnWriteArraySet<java.lang.String> standardDefinedComparators()
          Constructs a set containing the names of those comparisons for which require is not necessary before usage, according to RFC5228.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComparatorManagerImpl

public ComparatorManagerImpl(java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.String> classNameMap)
Constructs a manager with the standard comparators implicitly defined.

Parameters:
classNameMap - not null

ComparatorManagerImpl

public ComparatorManagerImpl(java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.String> classNameMap,
                             java.util.concurrent.CopyOnWriteArraySet<java.lang.String> implicitlyDeclared)
Constructor for ComparatorManager.

Parameters:
classNameMap - indexes names of implementation classes against logical names, not null
implicitlyDeclared - names of those comparisons for which require is not necessary before usage
Method Detail

standardDefinedComparators

public static java.util.concurrent.CopyOnWriteArraySet<java.lang.String> standardDefinedComparators()
Constructs a set containing the names of those comparisons for which require is not necessary before usage, according to RFC5228. See RFC5228, 2.7.3 Comparators.


isImplicitlyDeclared

public boolean isImplicitlyDeclared(java.lang.String comparatorName)
Is an explicit declaration in a require statement unnecessary for this comparator?

Specified by:
isImplicitlyDeclared in interface ComparatorManager
Parameters:
comparatorName - not null
Returns:
true when this comparator need not be declared by require, false when any usage of this comparator must be declared in a require statement

lookup

public java.lang.Class lookup(java.lang.String name)
                       throws LookupException

Method lookup answers the class to which a Comparator name is mapped.

Parameters:
name - - The name of the Comparator
Returns:
Class - The class of the Comparator
Throws:
LookupException

getComparator

public Comparator getComparator(java.lang.String name)
                         throws LookupException

Method newInstance answers an instance of the class to which a Comparator name is mapped.

Specified by:
getComparator in interface ComparatorManager
Parameters:
name - - The name of the Comparator
Returns:
Class - The class of the Comparator
Throws:
LookupException

isSupported

public boolean isSupported(java.lang.String name)
Description copied from interface: ComparatorManager
Is the comparator with the given name supported?

Specified by:
isSupported in interface ComparatorManager
Parameters:
name - not null
Returns:
true when supported, false otherwise
See Also:
ComparatorManager.isSupported(String)


Copyright © 2008-2009 The Apache Software Foundation. All Rights Reserved.