Package com.igormaznitsa.jcp.directives
Class AbstractDirectiveHandler
- java.lang.Object
-
- com.igormaznitsa.jcp.directives.AbstractDirectiveHandler
-
- Direct Known Subclasses:
AbortDirectiveHandler
,ActionDirectiveHandler
,BreakDirectiveHandler
,CommentNextLineDirectiveHandler
,ContinueDirectiveHandler
,DefineDirectiveHandler
,EchoDirectiveHandler
,ElseDirectiveHandler
,EndDirectiveHandler
,EndIfDirectiveHandler
,ErrorDirectiveHandler
,ExcludeIfDirectiveHandler
,ExitDirectiveHandler
,ExitIfDirectiveHandler
,FlushDirectiveHandler
,GlobalDirectiveHandler
,GlobalElseDirectiveHandler
,GlobalEndIfDirectiveHandler
,GlobalIfDirectiveHandler
,IfDefinedDirectiveHandler
,IfDirectiveHandler
,IncludeDirectiveHandler
,LocalDirectiveHandler
,MsgDirectiveHandler
,NoAutoFlushHandler
,OutDirDirectiveHandler
,OutDisabledDirectiveHandler
,OutEnabledDirectiveHandler
,OutNameDirectiveHandler
,PostfixDirectiveHandler
,PrefixDirectiveHandler
,WhileDirectiveHandler
public abstract class AbstractDirectiveHandler extends java.lang.Object
The class is the abstract parent for all classes process preprocessor directives
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DIRECTIVE_PREFIX
The common preprocessor prefix for all directivesstatic AbstractDirectiveHandler[]
DIRECTIVES
The array contains all directives of the preprocessorstatic AbstractDirectiveHandler[]
GLOBAL_DIRECTIVES
The array contains preprocessor directives active only during the global preprocessing phasestatic java.lang.String
ONE_LINE_COMMENT
The prefix for one line commentstatic java.lang.String
PREFIX_FOR_KEEPING_LINES
The prefix for lines to be kept by preprocessorstatic java.lang.String
PREFIX_FOR_KEEPING_LINES_PROCESSED_DIRECTIVES
The prefix for lines to be kept by preprocessor, which contain processed directives
-
Constructor Summary
Constructors Constructor Description AbstractDirectiveHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract AfterDirectiveProcessingBehaviour
execute(java.lang.String tailString, 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
getFullName()
Get the directive name with prefixabstract java.lang.String
getName()
Get the name of the directive without prefixabstract java.lang.String
getReference()
Get the directive reference, it will be printed for a help requestboolean
isDeprecated()
Check that the directive is deprecated one and can be removed in a next releaseboolean
isGlobalPhaseAllowed()
Shows that the directive can be executed during a global preprocessing phaseboolean
isPreprocessingPhaseAllowed()
Shows that the directive can be executed during the second preprocessing phase
-
-
-
Field Detail
-
DIRECTIVE_PREFIX
public static final java.lang.String DIRECTIVE_PREFIX
The common preprocessor prefix for all directives- See Also:
- Constant Field Values
-
PREFIX_FOR_KEEPING_LINES
public static final java.lang.String PREFIX_FOR_KEEPING_LINES
The prefix for lines to be kept by preprocessor- See Also:
- Constant Field Values
-
PREFIX_FOR_KEEPING_LINES_PROCESSED_DIRECTIVES
public static final java.lang.String PREFIX_FOR_KEEPING_LINES_PROCESSED_DIRECTIVES
The prefix for lines to be kept by preprocessor, which contain processed directives- See Also:
- Constant Field Values
-
ONE_LINE_COMMENT
public static final java.lang.String ONE_LINE_COMMENT
The prefix for one line comment- See Also:
- Constant Field Values
-
DIRECTIVES
public static final AbstractDirectiveHandler[] DIRECTIVES
The array contains all directives of the preprocessor
-
GLOBAL_DIRECTIVES
public static final AbstractDirectiveHandler[] GLOBAL_DIRECTIVES
The array contains preprocessor directives active only during the global preprocessing phase
-
-
Method Detail
-
getName
public abstract java.lang.String getName()
Get the name of the directive without prefix- Returns:
- the directive name, must not be null
-
getReference
public abstract java.lang.String getReference()
Get the directive reference, it will be printed for a help request- Returns:
- the directive reference as a String, must not be null
-
getFullName
public java.lang.String getFullName()
Get the directive name with prefix- Returns:
- the full directive name (it including prefix)
-
getArgumentType
public DirectiveArgumentType getArgumentType()
Get the argument type needed by the directive- Returns:
- the argument type needed by the directive, it can't be null
-
execute
public abstract AfterDirectiveProcessingBehaviour execute(java.lang.String tailString, PreprocessorContext context)
Execute directive- Parameters:
tailString
- the tail of the string where the directive has been met, must not be null but can be emptycontext
- the preprocessor context, it can be null- Returns:
- the needed preprocessor behavior, must not be null
-
executeOnlyWhenExecutionAllowed
public boolean executeOnlyWhenExecutionAllowed()
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- Returns:
- true if the directive can be executed only if it is in active block, else the directive will be called in any case
-
isGlobalPhaseAllowed
public boolean isGlobalPhaseAllowed()
Shows that the directive can be executed during a global preprocessing phase- Returns:
- true if the directive allows the global directive phase, false if the directive must be ignored during that phase
-
isPreprocessingPhaseAllowed
public boolean isPreprocessingPhaseAllowed()
Shows that the directive can be executed during the second preprocessing phase- Returns:
- true uf the directive can be executed during the second preprocessing phase else false if the directive must be ignored
-
isDeprecated
public boolean isDeprecated()
Check that the directive is deprecated one and can be removed in a next release- Returns:
- true if the directive is deprecated, false otherwise
-
-