public class HandlerFactory
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.Map<DetailAST,AbstractExpressionHandler> |
createdHandlers
Cache for created method call handlers.
|
private java.util.Map<java.lang.Integer,java.lang.reflect.Constructor<?>> |
typeHandlers
Registered handlers.
|
Constructor and Description |
---|
HandlerFactory()
Creates a HandlerFactory.
|
Modifier and Type | Method and Description |
---|---|
void |
clearCreatedHandlers()
Clears cache of created handlers.
|
private AbstractExpressionHandler |
createMethodCallHandler(IndentationCheck indentCheck,
DetailAST ast,
AbstractExpressionHandler parent)
Create new instance of handler for METHOD_CALL.
|
int[] |
getHandledTypes()
Gets list of registered handler types.
|
AbstractExpressionHandler |
getHandler(IndentationCheck indentCheck,
DetailAST ast,
AbstractExpressionHandler parent)
Get the handler for an AST.
|
boolean |
isHandledType(int type)
Returns true if this type (form TokenTypes) is handled.
|
private <T> void |
register(int type,
java.lang.Class<T> handlerClass)
Registers a handler.
|
private final java.util.Map<java.lang.Integer,java.lang.reflect.Constructor<?>> typeHandlers
private final java.util.Map<DetailAST,AbstractExpressionHandler> createdHandlers
private <T> void register(int type, java.lang.Class<T> handlerClass)
T
- type of the handler class object.type
- type from TokenTypeshandlerClass
- the handler to registerpublic boolean isHandledType(int type)
type
- type from TokenTypespublic int[] getHandledTypes()
public AbstractExpressionHandler getHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
indentCheck
- the indentation checkast
- ast to handleparent
- the handler parent of this ASTprivate AbstractExpressionHandler createMethodCallHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
indentCheck
- the indentation checkast
- ast to handleparent
- the handler parent of this ASTpublic void clearCreatedHandlers()