|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ccg.macros.at.Base
public class Base
Base class for specialized @macro handlers.
This class is used to build specialized macro handlers. It provides common methods which derived classes will find useful (allowing them to concentrate on their specific macro definitions).
| Constructor Summary | |
|---|---|
protected |
Base(boolean hasFile)
Construct the object and optionally interpret a initialization file. |
| Method Summary | |
|---|---|
protected AtMacros |
getAtMacros()
Get the associated AtMacros processor. |
double |
getDoubleParameter(Vector args,
int i,
double def)
Safely retrieve and interpret a parameter and get the double value. |
int |
getIntParameter(Vector args,
int i,
int def)
Safely retrieve and interpret a parameter and get the integer value. |
long |
getLongParameter(Vector args,
int i,
long def)
Safely retrieve and interpret a parameter and get the integer value. |
String |
getStringParameter(Vector args,
int i)
Safely retrieve and interpret a parameter. |
void |
install(AtMacros at)
Register's all of the method macros AND loads the predefined property macros for the class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected Base(boolean hasFile)
hasFile - Set to true if there is a associated initialization file. The
initialization file must be found in the same manner as the
class file - except that it will end with ".At" instead of
".class". For example, the "/com/ccg/macros/at/Html" class has
a "/com/ccg/macros/at/Html.At" file associated with it.| Method Detail |
|---|
public void install(AtMacros at)
First, this method installs all of the "macro handler" methods
(see AtMacros.addMacros(Object) for
information on macro handler methods) of the class.
If the class also has a associated macro resource file, the resource file will then be interpretted by the macro processor (to load simple text style macros). During this "loading" phase, no output will be generated (unless the associated property file tries really hard to generate some).
am - The AtMacros object to register all of the
macros with. Must not be null.
public final String getStringParameter(Vector args,
int i)
throws IOException,
InterpretException
Many times a macro isn't picky about the string value of a parameter passed to the macro - it just wants to make sure it isn't passed a null. This method will fetch the desired parameter which was passed to your macro, interpret it and return the string representation.
It never returns null, but it may return a zero length string.
It will throw an exception if interpretation of the parameter was required but failed.
args - A vector of arguments which were passed to the macro.i - Index of the argument you want (0 corresponds to first entry).
InterpretException - If a internal (or macro error) is encountered while processing.
IOException - If interpretation of parameter involved output that triggered
a I/O error.
public final int getIntParameter(Vector args,
int i,
int def)
throws IOException,
InterpretException
Many times a macro isn't picky about the string value of a parameter passed to the macro - it just wants to make sure it isn't passed a null. This method will fetch the desired parameter which was passed to your macro, interpret it and return the string representation.
It will throw an exception if interpretation of the parameter was required but failed.
args - A vector of arguments which were passed to the
macro.i - Index of the argument you want (0 corresponds to first entry).def - Default value to return if argument omitted or doesn't
evaluate properly.
InterpretException - If a internal (or macro error) is encountered while processing.
IOException - If interpretation of parameter involved output that triggered
a I/O error.
public final long getLongParameter(Vector args,
int i,
long def)
throws IOException,
InterpretException
Many times a macro isn't picky about the string value of a parameter passed to the macro - it just wants to make sure it isn't passed a null. This method will fetch the desired parameter which was passed to your macro, interpret it and return the string representation.
It will throw an exception if interpretation of the parameter was required but failed.
args - A vector of arguments which were passed to the
macro.i - Index of the argument you want (0 corresponds to first entry).def - Default value to return if argument omitted or doesn't
evaluate properly.
InterpretException - If a internal (or macro error) is encountered while processing.
IOException - If interpretation of parameter involved output that triggered
a I/O error.
public final double getDoubleParameter(Vector args,
int i,
double def)
throws IOException,
InterpretException
Many times a macro isn't picky about the string value of a parameter passed to the macro - it just wants to make sure it isn't passed a null. This method will fetch the desired parameter which was passed to your macro, interpret it and return the string representation.
It will throw an exception if interpretation of the parameter was required but failed.
args - A vector of arguments which were passed to the
macro.i - Index of the argument you want (0 corresponds to first entry).def - Default value to return if argument omitted or doesn't
evaluate properly.
InterpretException - If a internal (or macro error) is encountered while processing.
IOException - If interpretation of parameter involved output that triggered
a I/O error.protected AtMacros getAtMacros()
AtMacros processor.
This method allows derived classes to get access to the macro processor which they are working for. It
corresponds to the last registered AtMacros
which was installed.
install.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||