}
/**
- * Returns true if the class has the specified annotation class.
+ * Returns true if the class has the specified annotation type.
*
- * @param clz the name of annotation class.
+ * @param typeName the name of annotation type.
* @return <code>true</code> if the annotation is found,
* otherwise <code>false</code>.
- * @since 3.11
+ * @since 3.21
*/
- public boolean hasAnnotation(String clz) {
+ public boolean hasAnnotation(String typeName) {
MethodInfo mi = getMethodInfo2();
AnnotationsAttribute ainfo = (AnnotationsAttribute)
mi.getAttribute(AnnotationsAttribute.invisibleTag);
AnnotationsAttribute ainfo2 = (AnnotationsAttribute)
mi.getAttribute(AnnotationsAttribute.visibleTag);
- return CtClassType.hasAnnotationType(clz,
+ return CtClassType.hasAnnotationType(typeName,
getDeclaringClass().getClassPool(),
ainfo, ainfo2);
}
}
/**
- * Returns true if the class has the specified annotation class.
+ * Returns true if the class has the specified annotation type.
*
- * @param clz the annotation class.
+ * @param annotationType the annotation type.
* @return <code>true</code> if the annotation is found, otherwise <code>false</code>.
* @since 3.11
*/
- public boolean hasAnnotation(Class clz) {
- return hasAnnotation(clz.getName());
+ public boolean hasAnnotation(Class annotationType) {
+ return hasAnnotation(annotationType.getName());
}
/**
- * Returns true if the class has the specified annotation class.
+ * Returns true if the class has the specified annotation type.
*
- * @param annotClzName the name of annotation class.
+ * @param annotationTypeName the name of annotation type.
* @return <code>true</code> if the annotation is found, otherwise <code>false</code>.
- * @since 3.11
+ * @since 3.21
*/
- public boolean hasAnnotation(String annotClzName) {
+ public boolean hasAnnotation(String annotationTypeName) {
return false;
}
/**
- * Returns the annotation if the class has the specified annotation class.
+ * Returns the annotation if the class has the specified annotation type.
* For example, if an annotation <code>@Author</code> is associated
* with this class, an <code>Author</code> object is returned.
* The member values can be obtained by calling methods on
* the <code>Author</code> object.
*
- * @param clz the annotation class.
+ * @param clz the annotation type.
* @return the annotation if found, otherwise <code>null</code>.
* @since 3.11
*/
}
//@Override
- public boolean hasAnnotation(String annotClzName) {
+ public boolean hasAnnotation(String annotationName) {
ClassFile cf = getClassFile2();
AnnotationsAttribute ainfo = (AnnotationsAttribute)
cf.getAttribute(AnnotationsAttribute.invisibleTag);
AnnotationsAttribute ainfo2 = (AnnotationsAttribute)
cf.getAttribute(AnnotationsAttribute.visibleTag);
- return hasAnnotationType(annotClzName, getClassPool(), ainfo, ainfo2);
+ return hasAnnotationType(annotationName, getClassPool(), ainfo, ainfo2);
}
+ /**
+ * @deprecated
+ */
static boolean hasAnnotationType(Class clz, ClassPool cp,
AnnotationsAttribute a1,
AnnotationsAttribute a2)
return hasAnnotationType(clz.getName(), cp, a1, a2);
}
- static boolean hasAnnotationType(String annotationClzNm, ClassPool cp,
+ static boolean hasAnnotationType(String annotationTypeName, ClassPool cp,
AnnotationsAttribute a1,
AnnotationsAttribute a2)
{
else
anno2 = a2.getAnnotations();
- // String typeName = clz.getName();
- String typeName = annotationClzNm;
if (anno1 != null)
for (int i = 0; i < anno1.length; i++)
- if (anno1[i].getTypeName().equals(typeName))
+ if (anno1[i].getTypeName().equals(annotationTypeName))
return true;
if (anno2 != null)
for (int i = 0; i < anno2.length; i++)
- if (anno2[i].getTypeName().equals(typeName))
+ if (anno2[i].getTypeName().equals(annotationTypeName))
return true;
return false;
}
/**
- * Returns true if the class has the specified annotation class.
+ * Returns true if the class has the specified annotation type.
*
- * @param clz the name of annotation class.
+ * @param typeName the name of annotation type.
* @return <code>true</code> if the annotation is found, otherwise <code>false</code>.
- * @since 3.11
+ * @since 3.21
*/
- public boolean hasAnnotation(String clz) {
+ public boolean hasAnnotation(String typeName) {
FieldInfo fi = getFieldInfo2();
AnnotationsAttribute ainfo = (AnnotationsAttribute)
fi.getAttribute(AnnotationsAttribute.invisibleTag);
AnnotationsAttribute ainfo2 = (AnnotationsAttribute)
fi.getAttribute(AnnotationsAttribute.visibleTag);
- return CtClassType.hasAnnotationType(clz, getDeclaringClass().getClassPool(),
+ return CtClassType.hasAnnotationType(typeName, getDeclaringClass().getClassPool(),
ainfo, ainfo2);
}
public abstract void setModifiers(int mod);
/**
- * Returns true if the class has the specified annotation class.
+ * Returns true if the class has the specified annotation type.
*
- * @param clz the annotation class.
+ * @param clz the annotation type.
* @return <code>true</code> if the annotation is found, otherwise <code>false</code>.
* @since 3.11
*/
}
/**
- * Returns true if the class has the specified annotation class.
+ * Returns true if the class has the specified annotation type.
*
- * @param annotClzName the name of annotation class.
+ * @param annotationTypeName the name of annotation type.
* @return <code>true</code> if the annotation is found, otherwise <code>false</code>.
- * @since 3.11
+ * @since 3.21
*/
- public abstract boolean hasAnnotation(String annotClzName);
+ public abstract boolean hasAnnotation(String annotationTypeName);
/**
- * Returns the annotation if the class has the specified annotation class.
+ * Returns the annotation if the class has the specified annotation type.
* For example, if an annotation <code>@Author</code> is associated
* with this member, an <code>Author</code> object is returned.
* The member values can be obtained by calling methods on
* the <code>Author</code> object.
*
- * @param clz the annotation class.
+ * @param annotationType the annotation type.
* @return the annotation if found, otherwise <code>null</code>.
* @since 3.11
*/
- public abstract Object getAnnotation(Class clz) throws ClassNotFoundException;
+ public abstract Object getAnnotation(Class annotationType) throws ClassNotFoundException;
/**
* Returns the annotations associated with this member.