コード例 #1
0
ファイル: BindingUtil.java プロジェクト: mmaxiaolei/j2objc
 public static IAnnotationBinding getAnnotation(IBinding binding, Class<?> annotationClass) {
   for (IAnnotationBinding annotation : binding.getAnnotations()) {
     if (typeEqualsClass(annotation.getAnnotationType(), annotationClass)) {
       return annotation;
     }
   }
   return null;
 }
コード例 #2
0
ファイル: BindingUtil.java プロジェクト: mmaxiaolei/j2objc
 /** Less strict version of the above where we don't care about the annotation's package. */
 public static boolean hasNamedAnnotation(IBinding binding, String annotationName) {
   for (IAnnotationBinding annotation : binding.getAnnotations()) {
     if (annotation.getName().equals(annotationName)) {
       return true;
     }
   }
   return false;
 }
コード例 #3
0
ファイル: BindingUtil.java プロジェクト: mmaxiaolei/j2objc
 /**
  * Return true if a binding has a named "Nonnull" annotation. Package names aren't checked because
  * different nonnull annotations are defined in several Java frameworks, with varying but similar
  * names.
  */
 public static boolean hasNonnullAnnotation(IBinding binding) {
   Pattern p = Pattern.compile("No[nt][Nn]ull");
   for (IAnnotationBinding annotation : binding.getAnnotations()) {
     if (p.matcher(annotation.getName()).matches()) {
       return true;
     }
   }
   return false;
 }