public class TagletOfTypeProcessor<T extends CodeletTemplateBase> extends Object
Base class for type-specific Codelet processors. Called by TagletProcessor.
aliteralmind __DASH__ github __AT__ yahoo __DOT__ com), dual-licensed under the LGPL (version 3.0 or later) or the ASL (version 2.0). See source code for details. http://codelet.aliteralmind.com, https://github.com/aliteralmind/codelet| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_CUSTOMIZER_CLASS_NAME
The name of the class in each package that uses codelets, that is the "fallback" location for IXC-customizers--Equal to
"zCodeletCustomizers". |
| Constructor and Description |
|---|
TagletOfTypeProcessor(CodeletType sub_classType,
CodeletInstance instance)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
crashIfClassOrFileCannotUseCustomizer(CustomizationInstructions<T> instructions)
If the class or file is not allowed to use the customizer, crash.
|
String |
getClassOrFilePortion()
The example code's fully-qualified class name (plus any command-line parameters), or the path to the plain-text file.
|
CustomizationInstructions<T> |
getCustomCustomizationInstructions(CodeletType needed_defaultAlterType) |
CustomizationInstructions<T> |
getCustomizationInstructions(CodeletType needed_defaultAlterType) |
String |
getCustomizerPortion()
The optional customizer part of a codelet, as found after its prefix character.
|
SimpleMethodSignature |
getCustomizerSigFromString(String customizer_strSig)
Given the customizer's fully-expanded string-signature, get its simple-signature.
|
String |
getExampleCodeStringSig()
Get the string-signature for executing the example code.
|
String |
getFullyCustomizedOutput() |
CodeletInstance |
getInstance()
The current taglet instance.
|
CustomizationInstructions<T> |
getInstructionsFromSig(SimpleMethodSignature customizer_sig,
CodeletType needed_defaultAlterType)
Invoke the customizer and get its return value, as required by the taglet-processor--For
{@.codelet.and.out} taglets only. |
protected String |
getSig2PrnsApnddForNameOrPostfix(String betweenPre_andPostInclUndrScr,
String sig,
boolean do_debug) |
Iterator<String> |
getSourceCodeLineIterator(CodeletInstance instance) |
String |
getStringSignature()
Expands a potentially-shortened customizer signature (shortcut) to its full string-signature, for
{@.codelet} and {@.codelet.out} taglets only. |
T |
getTemplateFromInstructionsOverrideOrDefault(CustomizationInstructions<T> instructions) |
CustomizationInstructions<T> |
newInstructionsForDefaults(CustomizationInstructions<T> instructions) |
protected void |
setFullyProcessedOutput(String fully_processed) |
public static final String DEFAULT_CUSTOMIZER_CLASS_NAME
The name of the class in each package that uses codelets, that is the "fallback" location for IXC-customizers--Equal to "zCodeletCustomizers". This class is only applicable for customizers that are
BasicCustomizers,public TagletOfTypeProcessor(CodeletType sub_classType, CodeletInstance instance)
Create a new instance.
Steps:
tag_text), this setsgetClassOrFilePortion() to the text preceding the prefix char.getCustomizerPortion() to the text following it.getClassOrFilePortion() to instance.getText().getCustomizerPortion() to null.sub_classType - The taglet type of the sub-class. May not be null. Discarded after construction.instance - May not be null, and its type must be the same as sub_classType. Get with getInstance().NoSuchMethodException - If the customizer function does not exist, either in the specified or default classes, or with the required attributes, such as missing parameters, an unexpected return value, or if it's non-static.NoSuchFileException - If the source-code or plain-text file does not exist.AccessDeniedException - If the file exists, but cannot be read.public CodeletInstance getInstance()
The current taglet instance.
public String getClassOrFilePortion()
The example code's fully-qualified class name (plus any command-line parameters), or the path to the plain-text file. This is the portion of the taglet's text that follows the name and precedes the optional customizer prefix character. If no customizer is specified, this is equal to getInstance().getText()
protected void crashIfClassOrFileCannotUseCustomizer(CustomizationInstructions<T> instructions)
If the class or file is not allowed to use the customizer, crash. Otherwise, do nothing.
IllegalStateException - If
FilenameUtils.wildcardMatch(getClassOrFilePortion(), instructions.getClassNameOrFilePathRestricter)
false.public String getCustomizerPortion()
The optional customizer part of a codelet, as found after its prefix character. If no customizer is specified, this is null.
public String getFullyCustomizedOutput()
protected void setFullyProcessedOutput(String fully_processed)
public T getTemplateFromInstructionsOverrideOrDefault(CustomizationInstructions<T> instructions)
public String getExampleCodeStringSig()
Get the string-signature for executing the example code.
clsNm + "#main(" + params + ")"
clsNm is
TagletTextUtil.getExampleClassFQName(instance)
params is
TagletTextUtil.getExampleCommandLineParams(instance)public CustomizationInstructions<T> getCustomCustomizationInstructions(CodeletType needed_defaultAlterType) throws ClassNotFoundException, NoSuchMethodException, SecurityException
public CustomizationInstructions<T> getInstructionsFromSig(SimpleMethodSignature customizer_sig, CodeletType needed_defaultAlterType) throws ClassNotFoundException, NoSuchMethodException, SecurityException
Invoke the customizer and get its return value, as required by the taglet-processor--For {@.codelet.and.out} taglets only.
This obtains and then invokes the customizer signature, and returns its return value, which must be a CustomizationInstructions of the type required by the processor.
customizer_sig - May not be null, and the function in represents must conform to the requirements.IllegalArgumentException - If
[the-instructions-returned-by-the-customizer].getNeededAlterArrayType()
needed_defaultAlterType. See
CustomizationInstructions.CustomizationInstructions(CodeletInstance, CodeletType)ClassNotFoundExceptionNoSuchMethodExceptionSecurityExceptionpublic SimpleMethodSignature getCustomizerSigFromString(String customizer_strSig) throws ClassNotFoundException
Given the customizer's fully-expanded string-signature, get its simple-signature.
Steps:
null.'#'): The following classes are set as its defaults, one in which the customizer function must exist (although that's verified externally--not by this function). They are search in order:BasicCustomizerssimple signaturecustomizer_strSig - The expanded string-signature. If null, no customizer is specified.ClassNotFoundException - If the class name, but not its package, is in the string-signature, and the class does not exist in the enclosing package.getStringSignature()public String getStringSignature()
Expands a potentially-shortened customizer signature (shortcut) to its full string-signature, for {@.codelet} and {@.codelet.out} taglets only. This does not validate the taglet text or the returned signature.
Steps:
null."()", this returns the default Codelet customizer function name'.' in the example code's fully-qualified class name)."()""getSourceConfigAGreatExample()"'_'), it is the function name's postfix, which is appended after the classes simple name. This returns (for example)
"getSourceConfigAGreatExample_DoSpecialStuff()""()"protected String getSig2PrnsApnddForNameOrPostfix(String betweenPre_andPostInclUndrScr, String sig, boolean do_debug)
public CustomizationInstructions<T> newInstructionsForDefaults(CustomizationInstructions<T> instructions)
public Iterator<String> getSourceCodeLineIterator(CodeletInstance instance)
public CustomizationInstructions<T> getCustomizationInstructions(CodeletType needed_defaultAlterType) throws ClassNotFoundException, NoSuchMethodException, NoSuchFileException, AccessDeniedException
Copyright 2014, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.
https://github.com/aliteralmind/codelet