|
Lombok - v0.10.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectlombok.eclipse.handlers.EclipseHandlerUtil
public class EclipseHandlerUtil
Container for static utility methods useful to handlers written for eclipse.
| Nested Class Summary | |
|---|---|
static class |
EclipseHandlerUtil.MemberExistsResult
Serves as return value for the methods that check for the existence of fields and methods. |
| Method Summary | |
|---|---|
static EclipseHandlerUtil.MemberExistsResult |
constructorExists(EclipseNode node)
Checks if there is a (non-default) constructor. |
static List<Integer> |
createListOfNonExistentFields(List<String> list,
EclipseNode type,
boolean excludeStandard,
boolean excludeTransient)
Given a list of field names and a node referring to a type, finds each name in the list that does not match a field within the type. |
static org.eclipse.jdt.internal.compiler.ast.Annotation[] |
createSuppressWarningsAll(org.eclipse.jdt.internal.compiler.ast.ASTNode source,
org.eclipse.jdt.internal.compiler.ast.Annotation[] originalAnnotationArray)
|
static EclipseHandlerUtil.MemberExistsResult |
fieldExists(String fieldName,
EclipseNode node)
Checks if there is a field with the provided name. |
static boolean |
filterField(org.eclipse.jdt.internal.compiler.ast.FieldDeclaration declaration)
Checks if the field should be included in operations that work on 'all' fields: If the field is static, or starts with a '$', or is actually an enum constant, 'false' is returned, indicating you should skip it. |
static org.eclipse.jdt.internal.compiler.ast.Annotation[] |
findAnnotations(org.eclipse.jdt.internal.compiler.ast.FieldDeclaration field,
Pattern namePattern)
Searches the given field node for annotations and returns each one that matches the provided regular expression pattern. |
static org.eclipse.jdt.internal.compiler.ast.Statement |
generateNullCheck(org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration variable,
org.eclipse.jdt.internal.compiler.ast.ASTNode source)
Generates a new statement that checks if the given variable is null, and if so, throws a NullPointerException with the
variable name as message. |
static void |
injectField(EclipseNode type,
org.eclipse.jdt.internal.compiler.ast.FieldDeclaration field)
Inserts a field into an existing type. |
static void |
injectFieldSuppressWarnings(EclipseNode type,
org.eclipse.jdt.internal.compiler.ast.FieldDeclaration field)
Inserts a field into an existing type. |
static void |
injectMethod(EclipseNode type,
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration method)
Inserts a method into an existing type. |
static boolean |
isPrimitive(org.eclipse.jdt.internal.compiler.ast.TypeReference ref)
Checks if the given type reference represents a primitive type. |
static org.eclipse.jdt.internal.compiler.ast.CastExpression |
makeCastExpression(org.eclipse.jdt.internal.compiler.ast.Expression ref,
org.eclipse.jdt.internal.compiler.ast.TypeReference castTo,
org.eclipse.jdt.internal.compiler.ast.ASTNode source)
In eclipse 3.7+, the CastExpression constructor was changed from a really weird version to a less weird one. |
static org.eclipse.jdt.internal.compiler.ast.IntLiteral |
makeIntLiteral(char[] token,
org.eclipse.jdt.internal.compiler.ast.ASTNode source)
In eclipse 3.7+, IntLiterals are created using a factory-method Unfortunately that means we need to use reflection as we want to be compatible with eclipse versions before 3.7. |
static org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation |
makeMarkerAnnotation(char[][] name,
org.eclipse.jdt.internal.compiler.ast.ASTNode source)
Create an annotation of the given name, and is marked as being generated by the given source. |
static EclipseHandlerUtil.MemberExistsResult |
methodExists(String methodName,
EclipseNode node)
Wrapper for methodExists(String, EclipseNode, boolean) with caseSensitive = true. |
static EclipseHandlerUtil.MemberExistsResult |
methodExists(String methodName,
EclipseNode node,
boolean caseSensitive)
Checks if there is a method with the provided name. |
static boolean |
nameEquals(char[][] typeName,
String string)
Checks if an eclipse-style array-of-array-of-characters to represent a fully qualified name ('foo.bar.baz'), matches a plain string containing the same fully qualified name with dots in the string. |
static int |
toEclipseModifier(AccessLevel value)
Turns an AccessLevel instance into the flag bit used by eclipse. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean isPrimitive(org.eclipse.jdt.internal.compiler.ast.TypeReference ref)
public static int toEclipseModifier(AccessLevel value)
AccessLevel instance into the flag bit used by eclipse.
public static boolean nameEquals(char[][] typeName,
String string)
public static boolean filterField(org.eclipse.jdt.internal.compiler.ast.FieldDeclaration declaration)
public static EclipseHandlerUtil.MemberExistsResult fieldExists(String fieldName,
EclipseNode node)
fieldName - the field name to check for.node - Any node that represents the Type (TypeDeclaration) to look in, or any child node thereof.
public static EclipseHandlerUtil.MemberExistsResult methodExists(String methodName,
EclipseNode node)
methodExists(String, EclipseNode, boolean) with caseSensitive = true.
public static EclipseHandlerUtil.MemberExistsResult methodExists(String methodName,
EclipseNode node,
boolean caseSensitive)
methodName - the method name to check for.node - Any node that represents the Type (TypeDeclaration) to look in, or any child node thereof.caseSensitive - If the search should be case sensitive.public static EclipseHandlerUtil.MemberExistsResult constructorExists(EclipseNode node)
node - Any node that represents the Type (TypeDeclaration) to look in, or any child node thereof.
public static void injectFieldSuppressWarnings(EclipseNode type,
org.eclipse.jdt.internal.compiler.ast.FieldDeclaration field)
TypeDeclaration.
The field carries the @SuppressWarnings("all") annotation.
public static void injectField(EclipseNode type,
org.eclipse.jdt.internal.compiler.ast.FieldDeclaration field)
TypeDeclaration.
public static void injectMethod(EclipseNode type,
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration method)
TypeDeclaration.
public static org.eclipse.jdt.internal.compiler.ast.Annotation[] createSuppressWarningsAll(org.eclipse.jdt.internal.compiler.ast.ASTNode source,
org.eclipse.jdt.internal.compiler.ast.Annotation[] originalAnnotationArray)
public static org.eclipse.jdt.internal.compiler.ast.Annotation[] findAnnotations(org.eclipse.jdt.internal.compiler.ast.FieldDeclaration field,
Pattern namePattern)
public static org.eclipse.jdt.internal.compiler.ast.Statement generateNullCheck(org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration variable,
org.eclipse.jdt.internal.compiler.ast.ASTNode source)
NullPointerException with the
variable name as message.
public static org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation makeMarkerAnnotation(char[][] name,
org.eclipse.jdt.internal.compiler.ast.ASTNode source)
public static List<Integer> createListOfNonExistentFields(List<String> list,
EclipseNode type,
boolean excludeStandard,
boolean excludeTransient)
public static org.eclipse.jdt.internal.compiler.ast.CastExpression makeCastExpression(org.eclipse.jdt.internal.compiler.ast.Expression ref,
org.eclipse.jdt.internal.compiler.ast.TypeReference castTo,
org.eclipse.jdt.internal.compiler.ast.ASTNode source)
ref - The foo in (String)foo.castTo - The String in (String)foo.
public static org.eclipse.jdt.internal.compiler.ast.IntLiteral makeIntLiteral(char[] token,
org.eclipse.jdt.internal.compiler.ast.ASTNode source)
|
Lombok - v0.10.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||