org.peaseplate.internal.service
Class DefaultMacroService

java.lang.Object
  extended by org.peaseplate.internal.service.DefaultMacroService
All Implemented Interfaces:
MacroService

public class DefaultMacroService
extends java.lang.Object
implements MacroService

The default implementation of the MacroService

Author:
Manfred HANTSCHEL

Constructor Summary
DefaultMacroService()
           
 
Method Summary
 void add(java.lang.Class<?> macroClass)
          Adds the macro specified by the class.
 void add(java.lang.ClassLoader... classLoaders)
          Scans the specified class loaders for macro service definitions.
 void add(java.lang.Object macro)
          Adds the specified macro 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

DefaultMacroService

public DefaultMacroService()
Method Detail

add

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

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

add

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

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

add

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

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

getInstance

public java.lang.Object getInstance(java.lang.String name)
Specified by:
getInstance in interface MacroService
See Also:
MacroService.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 MacroService
See Also:
MacroService.getMethod(java.lang.String, java.lang.String, int)


Copyright © 2008. All Rights Reserved.