|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jawk.ext.AbstractExtension
public abstract class AbstractExtension
Base class of various extensions.
Provides functionality common to most extensions, such as vm and jrt variable management, and convenience methods such as checkNumArgs() and toAwkString().
Field Summary | |
---|---|
protected JRT |
jrt
|
protected VariableManager |
vm
|
Constructor Summary | |
---|---|
AbstractExtension()
|
Method Summary | |
---|---|
protected static void |
checkNumArgs(java.lang.Object[] arr,
int expected_num)
Verifies that an exact number of arguments has been passed in by checking the length of the argument array. |
int[] |
getAssocArrayParameterPositions(java.lang.String extension_keyword,
int arg_count)
Assume no guarantee of any extension parameter being an associative array. |
void |
init(VariableManager vm,
JRT jrt)
Called after the creation and before normal processing of the extension, pass in the Jawk Runtime Manager and the Variable Manager once. |
protected java.lang.String |
toAwkString(java.lang.Object obj)
Convert a Jawk variable to a Jawk string based on the value of the CONVFMT variable. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jawk.ext.JawkExtension |
---|
extensionKeywords, getExtensionName, invoke |
Field Detail |
---|
protected JRT jrt
protected VariableManager vm
Constructor Detail |
---|
public AbstractExtension()
Method Detail |
---|
public void init(VariableManager vm, JRT jrt)
JawkExtension
It is guaranteed init() is called before invoke() is called.
init
in interface JawkExtension
protected final java.lang.String toAwkString(java.lang.Object obj)
obj
- The Jawk variable to convert to a Jawk string.
public int[] getAssocArrayParameterPositions(java.lang.String extension_keyword, int arg_count)
getAssocArrayParameterPositions
in interface JawkExtension
extension_keyword
- The extension keyword to check.arg_count
- The number of actual parameters used in this
extension invocation.
protected static final void checkNumArgs(java.lang.Object[] arr, int expected_num)
arr
- The arguments to check.expected_num
- The expected number of arguments.
IllegalAwkArgumentException
- if the number of arguments
do not match the expected number of arguments.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |