org.peaseplate.internal.service
Class DefaultDesignatorService

java.lang.Object
  extended by org.peaseplate.internal.service.DefaultDesignatorService
All Implemented Interfaces:
DesignatorService

public class DefaultDesignatorService
extends java.lang.Object
implements DesignatorService


Constructor Summary
DefaultDesignatorService()
           
 
Method Summary
 void add(java.lang.Class<? extends Designator> designatorClass)
          Adds the specified designator to the service.
 void add(java.lang.ClassLoader... classLoaders)
          Scans the specified class loaders for designator service definitions.
 void add(Designator designator)
          Adds the specified designator to the service.
 Designator get(java.lang.String keyword)
          Returns the designator with the specified keyword
 Designator getDefaultDesignator()
          Returns the designator specified by the default designator keyword
 java.lang.String getDefaultDesignatorKeyword()
          Returns the keyword of the default designator (the designator that is used if none is specified; the default is "print")
 void setDefaultDesignatorKeyword(java.lang.String defaultDesignatorKeyword)
          Sets the keyword of the default designator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDesignatorService

public DefaultDesignatorService()
Method Detail

add

public void add(java.lang.ClassLoader... classLoaders)
         throws java.lang.IllegalArgumentException
Description copied from interface: DesignatorService
Scans the specified class loaders for designator service definitions. The definitions are located in a resource with the name "META-INF/services/org.peaseplate.service.DesignatorService". The file contains class names of Designators, one class name per line.

Specified by:
add in interface DesignatorService
Parameters:
classLoaders - the class loaders
Throws:
java.lang.IllegalArgumentException - if a class could not be instantiated
See Also:
DesignatorService.add(java.lang.ClassLoader[])

add

public void add(java.lang.Class<? extends Designator> designatorClass)
         throws java.lang.IllegalArgumentException
Description copied from interface: DesignatorService
Adds the specified designator to the service. Create a new instance of the class immediately. If there already exists another designator with the same name it will get replaced by the specified designator.

Specified by:
add in interface DesignatorService
Parameters:
designatorClass - the class of the designator
Throws:
java.lang.IllegalArgumentException - if the instance could not be created
See Also:
DesignatorService.add(java.lang.Class)

add

public void add(Designator designator)
Description copied from interface: DesignatorService
Adds the specified designator to the service. If there already exists another designator with the same name it will get replaced by the specified designator.

Specified by:
add in interface DesignatorService
Parameters:
designator - the designator
See Also:
DesignatorService.add(org.peaseplate.lang.Designator)

get

public Designator get(java.lang.String keyword)
Description copied from interface: DesignatorService
Returns the designator with the specified keyword

Specified by:
get in interface DesignatorService
Parameters:
keyword - the keyword
Returns:
the designator or null if not found
See Also:
DesignatorService.get(java.lang.String)

getDefaultDesignatorKeyword

public java.lang.String getDefaultDesignatorKeyword()
Description copied from interface: DesignatorService
Returns the keyword of the default designator (the designator that is used if none is specified; the default is "print")

Specified by:
getDefaultDesignatorKeyword in interface DesignatorService
Returns:
the keyword of the default designator
See Also:
DesignatorService.getDefaultDesignatorKeyword()

setDefaultDesignatorKeyword

public void setDefaultDesignatorKeyword(java.lang.String defaultDesignatorKeyword)
Description copied from interface: DesignatorService
Sets the keyword of the default designator.

Specified by:
setDefaultDesignatorKeyword in interface DesignatorService
Parameters:
defaultDesignatorKeyword - the keyword
See Also:
DesignatorService.setDefaultDesignatorKeyword(java.lang.String)

getDefaultDesignator

public Designator getDefaultDesignator()
                                throws java.lang.IllegalStateException
Description copied from interface: DesignatorService
Returns the designator specified by the default designator keyword

Specified by:
getDefaultDesignator in interface DesignatorService
Returns:
the default designator
Throws:
java.lang.IllegalStateException - if the default designator does not exist
See Also:
DesignatorService.getDefaultDesignator()


Copyright © 2008. All Rights Reserved.