org.peaseplate.internal.service
Class DefaultTransformerService

java.lang.Object
  extended by org.peaseplate.internal.service.DefaultTransformerService
All Implemented Interfaces:
TransformerService

public class DefaultTransformerService
extends java.lang.Object
implements TransformerService


Constructor Summary
DefaultTransformerService()
           
 
Method Summary
 void add(java.lang.Class<?> transformerClass)
          Adds the transformer specified by the class.
 void add(java.lang.ClassLoader... classLoaders)
          Scans the specified class loaders for transformer service definitions.
 void add(java.lang.Object transformer)
          Adds the specified transformer class.
 java.lang.Object getInstance(java.lang.String name)
           
 java.lang.reflect.Method getMethod(java.lang.String name, java.lang.String extension, int numberOfParameters)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTransformerService

public DefaultTransformerService()
Method Detail

add

public void add(java.lang.ClassLoader... classLoaders)
Description copied from interface: TransformerService
Scans the specified class loaders for transformer service definitions. The definitions are located in a resource with the name "META-INF/services/org.peaseplate.service.TransformerService". The file contains class names of transformers, one class name per line. The name of the transformers will be the name of each class trimming "Transformer" and "Transformers" at the end. This can be overruled by using the Transformer annotation. The class must contains at lease one method annotated as Transformer or DefaultTransformer and conform the following rules:

Specified by:
add in interface TransformerService
Parameters:
classLoaders - the class loaders
See Also:
TransformerService.add(java.lang.ClassLoader[])

add

public void add(java.lang.Class<?> transformerClass)
         throws java.lang.IllegalArgumentException
Description copied from interface: TransformerService
Adds the transformer specified by the class. Creates an instance immediately and calls the add method. The name of the transformer will be the name of the class trimming "Transformer" and "Transformers" at the end. This can be overruled by using the Transformer annotation. The class must contains at lease one method annotated as Transformer or DefaultTransformer and conform the following rules:

Specified by:
add in interface TransformerService
Parameters:
transformerClass - the transformer class
Throws:
java.lang.IllegalArgumentException - if the instance could not be created
See Also:
TransformerService.add(java.lang.Class)

add

public void add(java.lang.Object transformer)
         throws java.lang.IllegalArgumentException
Description copied from interface: TransformerService
Adds the specified transformer class. The name of the transformer will be the name of the class trimming "Transformer" and "Transformers" at the end. This can be overruled by using the Transformer annotation. The class must contains at lease one method annotated as Transformer or DefaultTransformer and conform the following rules:

Specified by:
add in interface TransformerService
Parameters:
transformer - the transformer class
Throws:
java.lang.IllegalArgumentException - on occasion
See Also:
TransformerService.add(java.lang.Object)

getInstance

public java.lang.Object getInstance(java.lang.String name)
Specified by:
getInstance in interface TransformerService
See Also:
TransformerService.getInstance(java.lang.String)

getMethod

public java.lang.reflect.Method getMethod(java.lang.String name,
                                          java.lang.String extension,
                                          int numberOfParameters)
Specified by:
getMethod in interface TransformerService
See Also:
TransformerService.getMethod(java.lang.String, java.lang.String, int)


Copyright © 2008. All Rights Reserved.