1
/********************************************************************
2
* Copyright (c) 2010 Contributors. All rights reserved.
3
* This program and the accompanying materials are made available
4
* under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution and is available at
6
* http://eclipse.org/legal/epl-v10.html
8
* Contributors: Nieraj Singh - initial implementation
9
*******************************************************************/
10
package org.aspectj.org.eclipse.jdt.core.dom;
12
import java.util.List;
14
public class TypeCategoryTypePattern extends TypePattern {
16
private int typeCategory;
18
public static final int CLASS = org.aspectj.weaver.patterns.TypeCategoryTypePattern.CLASS;
19
public static final int INTERFACE = org.aspectj.weaver.patterns.TypeCategoryTypePattern.INTERFACE;
20
public static final int ASPECT = org.aspectj.weaver.patterns.TypeCategoryTypePattern.ASPECT;
21
public static final int INNER = org.aspectj.weaver.patterns.TypeCategoryTypePattern.INNER;
22
public static final int ANONYMOUS = org.aspectj.weaver.patterns.TypeCategoryTypePattern.ANONYMOUS;
23
public static final int ENUM = org.aspectj.weaver.patterns.TypeCategoryTypePattern.ENUM;
24
public static final int ANNOTATION = org.aspectj.weaver.patterns.TypeCategoryTypePattern.ANNOTATION;
28
* See the weaver implementation for the type categories.
30
* @see org.aspectj.weaver.patterns.TypeCategoryTypePattern
34
* as defined in the corresponding weaver node type
36
TypeCategoryTypePattern(AST ast, int typeCategory) {
38
this.typeCategory = typeCategory;
43
* See the weaver implementation for the type categories.
45
* @see org.aspectj.weaver.patterns.TypeCategoryTypePattern
46
* @return type category
48
public int getTypeCategory() {
52
List<?> internalStructuralPropertiesForType(int apiLevel) {
56
public String getTypePatternExpression() {
58
String expression = super.getTypePatternExpression();
59
if (expression == null) {
60
switch (getTypeCategory()) {
62
expression = "ClassType";
65
expression = "InnerType";
68
expression = "InterfaceType";
71
expression = "AnnotationType";
74
expression = "AnonymousType";
77
expression = "AspectType";
80
expression = "EnumType";
83
expression = (expression != null) ? "is(" + expression + ")"
85
setTypePatternExpression(expression);
91
ASTNode clone0(AST target) {
92
ASTNode cloned = new TypeCategoryTypePattern(target, getTypeCategory());
93
cloned.setSourceRange(getStartPosition(), getLength());
97
void accept0(ASTVisitor visitor) {
98
if (visitor instanceof AjASTVisitor) {
99
AjASTVisitor ajVisitor = (AjASTVisitor) visitor;
100
ajVisitor.visit(this);
101
ajVisitor.endVisit(this);
105
boolean subtreeMatch0(ASTMatcher matcher, Object other) {
106
if (matcher instanceof AjASTMatcher) {
107
AjASTMatcher ajmatcher = (AjASTMatcher) matcher;
108
return ajmatcher.match(this, other);