org.peaseplate.service
Interface MacroService

All Known Implementing Classes:
DefaultMacroService

public interface MacroService

The macro service. Stores and holds predefined macros.

Author:
Manfred HANTSCHEL

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)
           
 

Method Detail

add

void add(java.lang.ClassLoader... classLoaders)
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:

Parameters:
classLoaders - the class loaders
Throws:
java.lang.IllegalArgumentException - if a class could not be instantiated

add

void add(java.lang.Class<?> macroClass)
         throws java.lang.IllegalArgumentException
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:

Parameters:
macroClass - the macro class
Throws:
java.lang.IllegalArgumentException - if the instance could not be created

add

void add(java.lang.Object macro)
         throws java.lang.IllegalArgumentException
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:

Parameters:
macro - the macro class
Throws:
java.lang.IllegalArgumentException - on occasion

getInstance

java.lang.Object getInstance(java.lang.String name)

getMethod

java.lang.reflect.Method getMethod(java.lang.String name,
                                   java.lang.String extension,
                                   int numberOfParameters)


Copyright © 2008. All Rights Reserved.