public void addAtAspectJAnnotations() { Annotation annotation = null; if (declareDecl instanceof DeclareAnnotation) { DeclareAnnotation da = (DeclareAnnotation) declareDecl; String patternString = da.getPatternAsString(); String annString = da.getAnnotationString(); String kind = da.getKind().toString(); annotation = AtAspectJAnnotationFactory.createDeclareAnnAnnotation( patternString, annString, kind, declarationSourceStart); } else if (declareDecl instanceof DeclareErrorOrWarning) { DeclareErrorOrWarning dd = (DeclareErrorOrWarning) declareDecl; annotation = AtAspectJAnnotationFactory.createDeclareErrorOrWarningAnnotation( dd.getPointcut().toString(), dd.getMessage(), dd.isError(), declarationSourceStart); } else if (declareDecl instanceof DeclareParents) { DeclareParents dp = (DeclareParents) declareDecl; String childPattern = dp.getChild().toString(); Collection parentPatterns = dp.getParents().getExactTypes(); StringBuffer parents = new StringBuffer(); for (Iterator iter = parentPatterns.iterator(); iter.hasNext(); ) { UnresolvedType urt = ((UnresolvedType) iter.next()); parents.append(urt.getName()); if (iter.hasNext()) { parents.append(", "); } } annotation = AtAspectJAnnotationFactory.createDeclareParentsAnnotation( childPattern, parents.toString(), dp.isExtends(), declarationSourceStart); } else if (declareDecl instanceof DeclarePrecedence) { DeclarePrecedence dp = (DeclarePrecedence) declareDecl; String precedenceList = dp.getPatterns().toString(); annotation = AtAspectJAnnotationFactory.createDeclarePrecedenceAnnotation( precedenceList, declarationSourceStart); } else if (declareDecl instanceof DeclareSoft) { DeclareSoft ds = (DeclareSoft) declareDecl; annotation = AtAspectJAnnotationFactory.createDeclareSoftAnnotation( ds.getPointcut().toString(), ds.getException().getExactType().getName(), declarationSourceStart); } if (annotation != null) { AtAspectJAnnotationFactory.addAnnotation(this, annotation, this.scope); } }
public static ConstructorMirrorMember make(MirrorWorld world, ConstructorMirror cons) { UnresolvedType declaringType = world.resolve(cons.getDeclaringClass()); UnresolvedType returnType = declaringType; UnresolvedType[] parameterTypes = new UnresolvedType[cons.getParameterTypeNames().size()]; for (int i = 0; i < parameterTypes.length; i++) { parameterTypes[i] = UnresolvedType.forName(cons.getParameterTypeNames().get(i)); } return new ConstructorMirrorMember( cons, declaringType, cons.getModifiers(), returnType, "<init>", parameterTypes); }