Package com.igormaznitsa.jcp.directives
Class IfDefinedDirectiveHandler
- java.lang.Object
-
- com.igormaznitsa.jcp.directives.AbstractDirectiveHandler
-
- com.igormaznitsa.jcp.directives.IfDefinedDirectiveHandler
-
- Direct Known Subclasses:
IfDefDirectiveHandler
,IfNDefDirectiveHandler
public class IfDefinedDirectiveHandler extends AbstractDirectiveHandler
The class implements the //#ifdefined directive handler
-
-
Field Summary
-
Fields inherited from class com.igormaznitsa.jcp.directives.AbstractDirectiveHandler
DIRECTIVE_PREFIX, DIRECTIVES, GLOBAL_DIRECTIVES, ONE_LINE_COMMENT, PREFIX_FOR_KEEPING_LINES, PREFIX_FOR_KEEPING_LINES_PROCESSED_DIRECTIVES
-
-
Constructor Summary
Constructors Constructor Description IfDefinedDirectiveHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AfterDirectiveProcessingBehaviour
execute(java.lang.String string, PreprocessorContext context)
Execute directiveboolean
executeOnlyWhenExecutionAllowed()
Shows that the directive can be executed only when the preprocessing n active state i.e.DirectiveArgumentType
getArgumentType()
Get the argument type needed by the directivejava.lang.String
getName()
Get the name of the directive without prefixjava.lang.String
getReference()
Get the directive reference, it will be printed for a help requestprotected boolean
postprocessFlag(boolean variableExists)
-
Methods inherited from class com.igormaznitsa.jcp.directives.AbstractDirectiveHandler
getFullName, isDeprecated, isGlobalPhaseAllowed, isPreprocessingPhaseAllowed
-
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from class:AbstractDirectiveHandler
Get the name of the directive without prefix- Specified by:
getName
in classAbstractDirectiveHandler
- Returns:
- the directive name, must not be null
-
getReference
public java.lang.String getReference()
Description copied from class:AbstractDirectiveHandler
Get the directive reference, it will be printed for a help request- Specified by:
getReference
in classAbstractDirectiveHandler
- Returns:
- the directive reference as a String, must not be null
-
postprocessFlag
protected boolean postprocessFlag(boolean variableExists)
-
executeOnlyWhenExecutionAllowed
public boolean executeOnlyWhenExecutionAllowed()
Description copied from class:AbstractDirectiveHandler
Shows that the directive can be executed only when the preprocessing n active state i.e. if it is in active block //#if..//#endif of //#while- Overrides:
executeOnlyWhenExecutionAllowed
in classAbstractDirectiveHandler
- Returns:
- true if the directive can be executed only if it is in active block, else the directive will be called in any case
-
getArgumentType
public DirectiveArgumentType getArgumentType()
Description copied from class:AbstractDirectiveHandler
Get the argument type needed by the directive- Overrides:
getArgumentType
in classAbstractDirectiveHandler
- Returns:
- the argument type needed by the directive, it can't be null
-
execute
public AfterDirectiveProcessingBehaviour execute(java.lang.String string, PreprocessorContext context)
Description copied from class:AbstractDirectiveHandler
Execute directive- Specified by:
execute
in classAbstractDirectiveHandler
- Parameters:
string
- the tail of the string where the directive has been met, must not be null but can be emptycontext
- the preprocessor context- Returns:
- the needed preprocessor behavior, must not be null
-
-