org.apache.maven.doxia.macro
Class AbstractMacro

java.lang.Object
  extended by org.apache.maven.doxia.macro.AbstractMacro
All Implemented Interfaces:
LogEnabled, Macro
Direct Known Subclasses:
EchoMacro, SnippetMacro, SwfMacro, TocMacro

public abstract class AbstractMacro
extends Object
implements Macro

Abstract base class to execute Macro.

Since:
1.0
Version:
$Id: AbstractMacro.java 1090706 2011-04-09 23:15:28Z hboutemy $
Author:
Jason van Zyl

Field Summary
 
Fields inherited from interface org.apache.maven.doxia.macro.Macro
EOL, ROLE
 
Constructor Summary
AbstractMacro()
           
 
Method Summary
 void enableLogging(Log log)
          Enable a Doxia logger for this Doxia component.
protected static SinkEventAttributes getAttributesFromMap(Map<?,?> parameters)
          Convert the Map of macro parameters to an AttributeSet.
protected  Log getLog()
          Returns a logger for this macro.
protected  void required(String paramName, String paramValue)
          Check if the given parameter is required.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.maven.doxia.macro.Macro
execute
 

Constructor Detail

AbstractMacro

public AbstractMacro()
Method Detail

enableLogging

public void enableLogging(Log log)
Enable a Doxia logger for this Doxia component.

Specified by:
enableLogging in interface LogEnabled
Parameters:
log - a Log.

getLog

protected Log getLog()
Returns a logger for this macro. If no logger has been configured, a new SystemStreamLog is returned.

Returns:
Log
Since:
1.1

required

protected void required(String paramName,
                        String paramValue)
Check if the given parameter is required. Throws an IllegalArgumentException if paramValue is null or empty.

Parameters:
paramName - The name of the parameter to check.
paramValue - The parameter value.
Since:
1.1

getAttributesFromMap

protected static SinkEventAttributes getAttributesFromMap(Map<?,?> parameters)
Convert the Map of macro parameters to an AttributeSet. No check of validity is done, all parameters are added.

Parameters:
parameters - the macro parameters.
Returns:
a SinkEventAttributeSet containing the same parameters, or null if parameters is null.
Since:
1.1.1.


Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.