Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2010-2011 eBusiness Information, Excilys Group Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed To in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package com.googlecode.androidannotations.helper;
 
 import java.util.List;
 
 
 public class AnnotationHelper {
 
 	protected final ProcessingEnvironment processingEnv;
 
 	public AnnotationHelper(ProcessingEnvironment processingEnv) {
 		this. = processingEnv;
 	}

Tests whether one type is a subtype of another. Any type is considered to be a subtype of itself.

Parameters:
t1 the first type
t2 the second type
Returns:
true if and only if the first type is a subtype of the second
Throws:
java.lang.IllegalArgumentException if given an executable or package type
See also:
javax.lang.model.util.Types.isSubtype(javax.lang.model.type.TypeMirror,javax.lang.model.type.TypeMirror)
 
 	public boolean isSubtype(TypeMirror t1TypeMirror t2) {
 		return .getTypeUtils().isSubtype(t1t2);
 	}
 
 	public boolean isSubtype(TypeElement t1TypeElement t2) {
 		return isSubtype(t1.asType(), t2.asType());
 	}
 
 	public TypeElement typeElementFromQualifiedName(String qualifiedName) {
 		return .getElementUtils().getTypeElement(qualifiedName);
 	}
 
 	public AnnotationMirror findAnnotationMirror(Element annotatedElementClass<? extends AnnotationannotationClass) {
 		List<? extends AnnotationMirrorannotationMirrors = annotatedElement.getAnnotationMirrors();
 
 		for (AnnotationMirror annotationMirror : annotationMirrors) {
 			TypeElement annotationElement = (TypeElementannotationMirror.getAnnotationType().asElement();
 			if (isAnnotation(annotationElementannotationClass)) {
 				return annotationMirror;
 			}
 		}
 		return null;
 	}
 
 	public boolean isAnnotation(TypeElement annotationClass<? extends AnnotationannotationClass) {
 		return annotation.getQualifiedName().toString().equals(annotationClass.getName());
 	}
 
 	public void printAnnotationError(Element annotatedElementClass<? extends AnnotationannotationClassString message) {
 		printAnnotationMessage(..annotatedElementannotationClassmessage);
 	}
 
 	public void printAnnotationWarning(Element annotatedElementClass<? extends AnnotationannotationClassString message) {
 		printAnnotationMessage(..annotatedElementannotationClassmessage);
 	}
 
 	public void printAnnotationMessage(Diagnostic.Kind diagnosticKindElement annotatedElementClass<? extends AnnotationannotationClassString message) {
 		AnnotationMirror annotationMirror = findAnnotationMirror(annotatedElementannotationClass);
 		if (annotationMirror != null) {
 			.getMessager().printMessage(diagnosticKindmessageannotatedElementannotationMirror);
 		} else {
 			printError(annotatedElementmessage);
 		}
 	}
 
 	public void printError(Element elementString message) {
 	}
	public boolean isPrivate(Element element) {
	}
	public boolean isAbstract(Element element) {
	}
	public boolean isInterface(TypeElement element) {
		return element.getKind().isInterface();
	}
	public boolean isFinal(Element element) {
		return element.getModifiers().contains(.);
	}
	public boolean isSynchronized(Element element) {
	}
	}
	public Types getTypeUtils() {
	}
New to GrepCode? Check out our FAQ X