Java 类java.lang.annotation.Documented 实例源码

项目:beanvalidation-benchmark    文件:Jsr303Annotator.java   
private JDefinedClass buildTemplateConstraint(String name) {
    try {
        JDefinedClass tplConstraint = codeModel._class(Config.CFG.getBasePackageName() + ".annot."+name, ClassType.ANNOTATION_TYPE_DECL);
        tplConstraint.annotate(Documented.class);
        tplConstraint.annotate(Retention.class).param("value", RetentionPolicy.RUNTIME);
        tplConstraint.annotate(Target.class).paramArray("value").param(ElementType.TYPE).param(ElementType.ANNOTATION_TYPE).param(ElementType.FIELD).param(ElementType.METHOD);

        // Using direct as I don't know how to build default { } with code model
        tplConstraint.direct("\n" + "    Class<?>[] groups() default {};\n" + "    String message() default \"Invalid value\";\n" + "    Class<? extends Payload>[] payload() default {};\n");

        // Hack to force the import of javax.validation.Payload
        tplConstraint.javadoc().addThrows((JClass) codeModel._ref(Payload.class)).add("Force import");

        return tplConstraint;
    } catch (JClassAlreadyExistsException e) {
        throw new RuntimeException("Tried to create an already existing class: " + name, e);
    }
}
项目:openjdk-jdk10    文件:NoPrivateTypesExported.java   
private void verifyAnnotations(Iterable<? extends AnnotationMirror> annotations,
                               Set<String> acceptable) {
    for (AnnotationMirror mirror : annotations) {
        Element annotationElement = mirror.getAnnotationType().asElement();

        if (annotationElement.getAnnotation(Documented.class) == null) {
            note("Ignoring undocumented annotation: " + mirror.getAnnotationType());
        }

        verifyTypeAcceptable(mirror.getAnnotationType(), acceptable);

        for (AnnotationValue value : mirror.getElementValues().values()) {
            verifyAnnotationValue(value, acceptable);
        }
    }
}
项目:openjdk9    文件:NoPrivateTypesExported.java   
private void verifyAnnotations(Iterable<? extends AnnotationMirror> annotations,
                               Set<String> acceptable) {
    for (AnnotationMirror mirror : annotations) {
        Element annotationElement = mirror.getAnnotationType().asElement();

        if (annotationElement.getAnnotation(Documented.class) == null) {
            note("Ignoring undocumented annotation: " + mirror.getAnnotationType());
        }

        verifyTypeAcceptable(mirror.getAnnotationType(), acceptable);

        for (AnnotationValue value : mirror.getElementValues().values()) {
            verifyAnnotationValue(value, acceptable);
        }
    }
}
项目:spring4-understanding    文件:AnnotationMetadataTests.java   
private void doTestMetadataForAnnotationClass(AnnotationMetadata metadata) {
    assertThat(metadata.getClassName(), is(Component.class.getName()));
    assertThat(metadata.isInterface(), is(true));
    assertThat(metadata.isAnnotation(), is(true));
    assertThat(metadata.isAbstract(), is(true));
    assertThat(metadata.isConcrete(), is(false));
    assertThat(metadata.hasSuperClass(), is(false));
    assertThat(metadata.getSuperClassName(), nullValue());
    assertThat(metadata.getInterfaceNames().length, is(1));
    assertThat(metadata.getInterfaceNames()[0], is(Annotation.class.getName()));
    assertThat(metadata.isAnnotated(Documented.class.getName()), is(false));
    assertThat(metadata.isAnnotated(Scope.class.getName()), is(false));
    assertThat(metadata.isAnnotated(SpecialAttr.class.getName()), is(false));
    assertThat(metadata.hasAnnotation(Documented.class.getName()), is(true));
    assertThat(metadata.hasAnnotation(Scope.class.getName()), is(false));
    assertThat(metadata.hasAnnotation(SpecialAttr.class.getName()), is(false));
    assertThat(metadata.getAnnotationTypes().size(), is(3));
}
项目:lookaside_java-1.8.0-openjdk    文件:NoPrivateTypesExported.java   
private void verifyAnnotations(Iterable<? extends AnnotationMirror> annotations,
                               Set<String> acceptable) {
    for (AnnotationMirror mirror : annotations) {
        Element annotationElement = mirror.getAnnotationType().asElement();

        if (annotationElement.getAnnotation(Documented.class) == null) {
            note("Ignoring undocumented annotation: " + mirror.getAnnotationType());
        }

        verifyTypeAcceptable(mirror.getAnnotationType(), acceptable);

        for (AnnotationValue value : mirror.getElementValues().values()) {
            verifyAnnotationValue(value, acceptable);
        }
    }
}
项目:jsr308-langtools    文件:NoPrivateTypesExported.java   
private void verifyAnnotations(Iterable<? extends AnnotationMirror> annotations,
                               Set<String> acceptable) {
    for (AnnotationMirror mirror : annotations) {
        Element annotationElement = mirror.getAnnotationType().asElement();

        if (annotationElement.getAnnotation(Documented.class) == null) {
            note("Ignoring undocumented annotation: " + mirror.getAnnotationType());
        }

        verifyTypeAcceptable(mirror.getAnnotationType(), acceptable);

        for (AnnotationValue value : mirror.getElementValues().values()) {
            verifyAnnotationValue(value, acceptable);
        }
    }
}
项目:gwt-backbone    文件:ReflectAllInOneCreator.java   
private void getAllReflectionClasses() throws NotFoundException{

        //System annotations
        addClassIfNotExists(typeOracle.getType(Retention.class.getCanonicalName()), ReflectableHelper.getDefaultSettings(typeOracle));
        addClassIfNotExists(typeOracle.getType(Documented.class.getCanonicalName()), ReflectableHelper.getDefaultSettings(typeOracle));
        addClassIfNotExists(typeOracle.getType(Inherited.class.getCanonicalName()), ReflectableHelper.getDefaultSettings(typeOracle));
        addClassIfNotExists(typeOracle.getType(Target.class.getCanonicalName()), ReflectableHelper.getDefaultSettings(typeOracle));
        addClassIfNotExists(typeOracle.getType(Deprecated.class.getCanonicalName()), ReflectableHelper.getDefaultSettings(typeOracle));
        //typeOracle.getType("org.lirazs.gbackbone.client.test.reflection.TestReflectionGenerics.TestReflection1");

        //=====GWT0.7
        for (JClassType classType : typeOracle.getTypes()) {
            Reflectable reflectable = GenUtils.getClassTypeAnnotationWithMataAnnotation(classType, Reflectable.class);
            if (reflectable != null){
                processClass(classType, reflectable);

                if (reflectable.assignableClasses()){
                    for (JClassType type : classType.getSubtypes()){
                        processClass(type, reflectable);
                    }
                }
            }
        }
        //======end of gwt0.7
    }
项目:dolphin-platform    文件:ClasspathScannerTest.java   
@Test
public void testScanOtherPackage() {
    //There can't be a class that is annotated with Inject
    final DefaultClasspathScanner scanner = new DefaultClasspathScanner(CLASSPATH_SCAN);
    Set<Class<?>> classes = scanner.getTypesAnnotatedWith(Resources.class);
    assertNotNull(classes);
    assertEquals(classes.size(), 0);

    classes = scanner.getTypesAnnotatedWith(AnnotationForClasspathScanTest.class);
    assertNotNull(classes);
    assertEquals(classes.size(), 0);

    classes = scanner.getTypesAnnotatedWith(Documented.class);
    assertNotNull(classes);
    assertEquals(classes.size(), 1);
    assertTrue(classes.contains(DocumentAnnotatedClass.class));
}
项目:infobip-open-jdk-8    文件:NoPrivateTypesExported.java   
private void verifyAnnotations(Iterable<? extends AnnotationMirror> annotations,
                               Set<String> acceptable) {
    for (AnnotationMirror mirror : annotations) {
        Element annotationElement = mirror.getAnnotationType().asElement();

        if (annotationElement.getAnnotation(Documented.class) == null) {
            note("Ignoring undocumented annotation: " + mirror.getAnnotationType());
        }

        verifyTypeAcceptable(mirror.getAnnotationType(), acceptable);

        for (AnnotationValue value : mirror.getElementValues().values()) {
            verifyAnnotationValue(value, acceptable);
        }
    }
}
项目:asakusafw-compiler    文件:CompositeOperatorEstimatorTest.java   
/**
 * user operators.
 */
@Test
public void user() {
    OperatorEstimator estimator = CompositeOperatorEstimator.builder()
            .withUser(Deprecated.class, engine("a"))
            .withUser(Documented.class, engine("b"))
            .build();

    Operator o0 = user(classOf(Deprecated.class));
    Operator o1 = user(classOf(Documented.class));
    Operator o2 = user(clazz("Unknown"));

    OperatorEstimate e0 = perform(context(), estimator, o0);
    OperatorEstimate e1 = perform(context(), estimator, o1);
    OperatorEstimate e2 = perform(context(), estimator, o2);

    assertThat(e0, hasMark("a"));
    assertThat(e1, hasMark("b"));
    assertThat(e2, hasMark(null));
}
项目:jadecy    文件:ClassDepsParserTest.java   
public void test_computeDependencies_packageInfo() {
    for (boolean apiOnly : FALSE_TRUE) {

        final SortedSet<String> expected = new TreeSet<String>();
        //
        if (apiOnly) {
        } else {
            addSlashedName(expected, TestAnno1.class);
            addSlashedName(expected, TestAnno2.class);
            addSlashedName(expected, Object.class);
            // String doesn't make it into the class file,
            // only types of other arguments.
            addSlashedName(expected, Integer.class);
            addSlashedName(expected, RoundingMode.class);
            addSlashedName(expected, Documented.class);
        }

        computeDepsAndCheck(TestAnno1.class.getPackage().getName() + ".package-info", apiOnly, expected);
    }
}
项目:jadecy    文件:ClassDepsParserTest.java   
public void test_computeDependencies_methodCodeStaticInitBlock() {
    for (boolean apiOnly : FALSE_TRUE) {

        final SortedSet<String> expected = new TreeSet<String>();
        //
        addSlashedName(expected, Object.class);
        //
        if (apiOnly) {
        } else {
            addSlashedName(expected, ClassDepsParserTest.class);
            //
            if (BUG_JDK_8136419_FIXED) {
                addSlashedName(expected, A_TYPE_USE_R_COMPLEX.class);
                addSlashedName(expected, Long.class);
                addSlashedName(expected, RoundingMode.class);
                addSlashedName(expected, Documented.class);
            }
            addSlashedName(expected, Integer.class);
            addSlashedName(expected, MyBlackHole.class);
            addSlashedName(expected, RuntimeException.class);
        }

        computeDepsAndCheck(MyMethodCodeStaticInitBlock.class.getName(), apiOnly, expected);
    }
}
项目:jadecy    文件:ClassDepsParserTest.java   
public void test_computeDependencies_methodCodeInitBlock() {
    for (boolean apiOnly : FALSE_TRUE) {

        final SortedSet<String> expected = new TreeSet<String>();
        //
        addSlashedName(expected, Object.class);
        //
        if (apiOnly) {
        } else {
            addSlashedName(expected, ClassDepsParserTest.class);
            //
            if (BUG_JDK_8136419_FIXED) {
                addSlashedName(expected, A_TYPE_USE_R_COMPLEX.class);
                addSlashedName(expected, Long.class);
                addSlashedName(expected, RoundingMode.class);
                addSlashedName(expected, Documented.class);
            }
            addSlashedName(expected, Integer.class);
            addSlashedName(expected, MyBlackHole.class);
            addSlashedName(expected, RuntimeException.class);
        }

        computeDepsAndCheck(MyMethodCodeInitBlock.class.getName(), apiOnly, expected);
    }
}
项目:jadecy    文件:ClassDepsParserTest.java   
public void test_computeDependencies_methodCodeConstructor() {
    for (boolean apiOnly : FALSE_TRUE) {

        final SortedSet<String> expected = new TreeSet<String>();
        //
        addSlashedName(expected, Object.class);
        //
        if (apiOnly) {
        } else {
            addSlashedName(expected, ClassDepsParserTest.class);
            //
            addSlashedName(expected, A_TYPE_USE_R_COMPLEX.class);
            addSlashedName(expected, Long.class);
            addSlashedName(expected, RoundingMode.class);
            addSlashedName(expected, Documented.class);
            addSlashedName(expected, Integer.class);
            addSlashedName(expected, MyBlackHole.class);
            addSlashedName(expected, RuntimeException.class);
        }

        computeDepsAndCheck(MyMethodCodeConstructor.class.getName(), apiOnly, expected);
    }
}
项目:jadecy    文件:ClassDepsParserTest.java   
public void test_computeDependencies_methodCodeNonGen() {
    for (boolean apiOnly : FALSE_TRUE) {

        final SortedSet<String> expected = new TreeSet<String>();
        //
        addSlashedName(expected, Object.class);
        //
        if (apiOnly) {
        } else {
            addSlashedName(expected, ClassDepsParserTest.class);
            //
            addSlashedName(expected, A_TYPE_USE_R_COMPLEX.class);
            addSlashedName(expected, Long.class);
            addSlashedName(expected, RoundingMode.class);
            addSlashedName(expected, Documented.class);
            addSlashedName(expected, Integer.class);
            addSlashedName(expected, MyBlackHole.class);
            addSlashedName(expected, RuntimeException.class);
        }

        computeDepsAndCheck(MyMethodCodeNonGen.class.getName(), apiOnly, expected);
    }
}
项目:jadecy    文件:ClassDepsParserTest.java   
public void test_computeDependencies_methodCodeGenStrict() {
    for (boolean apiOnly : FALSE_TRUE) {

        final SortedSet<String> expected = new TreeSet<String>();
        //
        addSlashedName(expected, Object.class);
        //
        if (apiOnly) {
        } else {
            addSlashedName(expected, ClassDepsParserTest.class);
            //
            addSlashedName(expected, A_TYPE_USE_R_COMPLEX.class);
            addSlashedName(expected, Long.class);
            addSlashedName(expected, RoundingMode.class);
            addSlashedName(expected, Documented.class);
            addSlashedName(expected, Comparable.class);
            addSlashedName(expected, MyBlackHole.class);
            addSlashedName(expected, RuntimeException.class);
        }

        computeDepsAndCheck(MyMethodCodeGenStrict.class.getName(), apiOnly, expected);
    }
}
项目:jadecy    文件:ClassDepsParserTest.java   
public void test_computeDependencies_methodCodeGenLoose() {
    for (boolean apiOnly : FALSE_TRUE) {

        final SortedSet<String> expected = new TreeSet<String>();
        //
        addSlashedName(expected, Object.class);
        //
        if (apiOnly) {
        } else {
            addSlashedName(expected, ClassDepsParserTest.class);
            //
            addSlashedName(expected, A_TYPE_USE_R_COMPLEX.class);
            addSlashedName(expected, Long.class);
            addSlashedName(expected, RoundingMode.class);
            addSlashedName(expected, Documented.class);
            addSlashedName(expected, Comparable.class);
            addSlashedName(expected, MyBlackHole.class);
            addSlashedName(expected, RuntimeException.class);
        }

        computeDepsAndCheck(MyMethodCodeGenLoose.class.getName(), apiOnly, expected);
    }
}
项目:OLD-OpenJDK8    文件:NoPrivateTypesExported.java   
private void verifyAnnotations(Iterable<? extends AnnotationMirror> annotations,
                               Set<String> acceptable) {
    for (AnnotationMirror mirror : annotations) {
        Element annotationElement = mirror.getAnnotationType().asElement();

        if (annotationElement.getAnnotation(Documented.class) == null) {
            note("Ignoring undocumented annotation: " + mirror.getAnnotationType());
        }

        verifyTypeAcceptable(mirror.getAnnotationType(), acceptable);

        for (AnnotationValue value : mirror.getElementValues().values()) {
            verifyAnnotationValue(value, acceptable);
        }
    }
}
项目:cn1    文件:Class1_5Test.java   
/**
 *  
 */
public void test_isAnnotationPresent_Cla() {
    class e {};
    assertFalse("zzz annotation is not presented for e class!", 
                     e.class.isAnnotationPresent(zzz.class));
          assertFalse("zzz annotation is not presented for zzz class!", 
                     zzz.class.isAnnotationPresent(zzz.class));
    assertTrue("Target annotation is presented for zzz class!",
                     zzz.class.isAnnotationPresent(java.lang.annotation
                                                   .Target.class));
    assertTrue("Documented annotation is presented for zzz class!",
                     zzz.class.isAnnotationPresent(java.lang.annotation
                                                   .Documented.class));
    assertTrue("Retention annotation is presented for zzz class!", 
                     zzz.class.isAnnotationPresent(java.lang.annotation
                                                   .Retention.class));
}
项目:cn1    文件:Class1_5Test.java   
/**
 *  
 */
public void test_getAnnotation_Cla() {
    class e {};
    assertNull("zzz annotation is not presented in e class!", 
                  e.class.getAnnotation(zzz.class));
    assertNull("zzz annotation is not presented in zzz class!", 
                  zzz.class.getAnnotation(zzz.class));
    assertFalse("Target annotation is presented in zzz class!", 
                  zzz.class.getAnnotation(java.lang.annotation.Target.class)
                     .toString().indexOf("java.lang.annotation.Target") == -1);
    assertFalse("Documented annotation is presented in zzz class!", 
                  zzz.class.getAnnotation(java.lang.annotation.Documented.class)
                     .toString().indexOf("java.lang.annotation.Documented") == -1);
          assertFalse("Retention annotation is presented in zzz class!", 
                  zzz.class.getAnnotation(java.lang.annotation.Retention.class)
                     .toString().indexOf("java.lang.annotation.Retention") == -1);
}
项目:freeVM    文件:Class1_5Test.java   
/**
 *  
 */
public void test_isAnnotationPresent_Cla() {
    class e {};
    assertFalse("zzz annotation is not presented for e class!", 
                     e.class.isAnnotationPresent(zzz.class));
          assertFalse("zzz annotation is not presented for zzz class!", 
                     zzz.class.isAnnotationPresent(zzz.class));
    assertTrue("Target annotation is presented for zzz class!",
                     zzz.class.isAnnotationPresent(java.lang.annotation
                                                   .Target.class));
    assertTrue("Documented annotation is presented for zzz class!",
                     zzz.class.isAnnotationPresent(java.lang.annotation
                                                   .Documented.class));
    assertTrue("Retention annotation is presented for zzz class!", 
                     zzz.class.isAnnotationPresent(java.lang.annotation
                                                   .Retention.class));
}
项目:freeVM    文件:Class1_5Test.java   
/**
 *  
 */
public void test_getAnnotation_Cla() {
    class e {};
    assertNull("zzz annotation is not presented in e class!", 
                  e.class.getAnnotation(zzz.class));
    assertNull("zzz annotation is not presented in zzz class!", 
                  zzz.class.getAnnotation(zzz.class));
    assertFalse("Target annotation is presented in zzz class!", 
                  zzz.class.getAnnotation(java.lang.annotation.Target.class)
                     .toString().indexOf("java.lang.annotation.Target") == -1);
    assertFalse("Documented annotation is presented in zzz class!", 
                  zzz.class.getAnnotation(java.lang.annotation.Documented.class)
                     .toString().indexOf("java.lang.annotation.Documented") == -1);
          assertFalse("Retention annotation is presented in zzz class!", 
                  zzz.class.getAnnotation(java.lang.annotation.Retention.class)
                     .toString().indexOf("java.lang.annotation.Retention") == -1);
}
项目:react4j    文件:ProcessorUtil.java   
static void copyDocumentedAnnotations( @Nonnull final AnnotatedConstruct element,
                                       @Nonnull final MethodSpec.Builder builder )
{
  for ( final AnnotationMirror annotation : element.getAnnotationMirrors() )
  {
    final DeclaredType annotationType = annotation.getAnnotationType();
    if ( !annotationType.toString().startsWith( "react4j.annotations." ) &&
         null != annotationType.asElement().getAnnotation( Documented.class ) )
    {
      builder.addAnnotation( AnnotationSpec.get( annotation ) );
    }
  }
}
项目:react4j    文件:ProcessorUtil.java   
static void copyDocumentedAnnotations( @Nonnull final AnnotatedConstruct element,
                                       @Nonnull final ParameterSpec.Builder builder )
{
  for ( final AnnotationMirror annotation : element.getAnnotationMirrors() )
  {
    if ( null != annotation.getAnnotationType().asElement().getAnnotation( Documented.class ) )
    {
      builder.addAnnotation( AnnotationSpec.get( annotation ) );
    }
  }
}
项目:openjdk-jdk10    文件:Utils.java   
/**
 * Given an annotation, return true if it should be documented and false
 * otherwise.
 *
 * @param annotation the annotation to check.
 *
 * @return true return true if it should be documented and false otherwise.
 */
public boolean isDocumentedAnnotation(TypeElement annotation) {
    for (AnnotationMirror anno : annotation.getAnnotationMirrors()) {
        if (getFullyQualifiedName(anno.getAnnotationType().asElement()).equals(
                Documented.class.getName())) {
            return true;
        }
    }
    return false;
}
项目:arez    文件:ProcessorUtil.java   
static void copyDocumentedAnnotations( @Nonnull final AnnotatedConstruct element,
                                       @Nonnull final MethodSpec.Builder builder )
{
  for ( final AnnotationMirror annotation : element.getAnnotationMirrors() )
  {
    final DeclaredType annotationType = annotation.getAnnotationType();
    if ( !annotationType.toString().startsWith( "arez.annotations." ) &&
         null != annotationType.asElement().getAnnotation( Documented.class ) )
    {
      builder.addAnnotation( AnnotationSpec.get( annotation ) );
    }
  }
}
项目:arez    文件:ProcessorUtil.java   
static void copyDocumentedAnnotations( @Nonnull final AnnotatedConstruct element,
                                       @Nonnull final ParameterSpec.Builder builder )
{
  for ( final AnnotationMirror annotation : element.getAnnotationMirrors() )
  {
    if ( null != annotation.getAnnotationType().asElement().getAnnotation( Documented.class ) )
    {
      builder.addAnnotation( AnnotationSpec.get( annotation ) );
    }
  }
}
项目:openjdk9    文件:Utils.java   
/**
 * Given an annotation, return true if it should be documented and false
 * otherwise.
 *
 * @param annotation the annotation to check.
 *
 * @return true return true if it should be documented and false otherwise.
 */
public boolean isDocumentedAnnotation(TypeElement annotation) {
    for (AnnotationMirror anno : annotation.getAnnotationMirrors()) {
        if (getFullyQualifiedName(anno.getAnnotationType().asElement()).equals(
                Documented.class.getName())) {
            return true;
        }
    }
    return false;
}
项目:openjdk9    文件:Utils.java   
/**
 * Given an annotation, return true if it should be documented and false
 * otherwise.
 *
 * @param annotationDoc the annotation to check.
 *
 * @return true return true if it should be documented and false otherwise.
 */
public boolean isDocumentedAnnotation(AnnotationTypeDoc annotationDoc) {
    for (AnnotationDesc anno : annotationDoc.annotations()) {
        if (anno.annotationType().qualifiedName().equals(
                Documented.class.getName())) {
            return true;
        }
    }
    return false;
}
项目:cp-elements    文件:ClassUtilsTests.java   
@Test
public void isNotArray() {
  assertFalse(ClassUtils.isArray(null));
  assertFalse(ClassUtils.isArray(Object.class));
  assertFalse(ClassUtils.isArray(Documented.class));
  assertFalse(ClassUtils.isArray(Object.class));
  assertFalse(ClassUtils.isArray(Thread.State.class));
  assertFalse(ClassUtils.isArray(Cloneable.class));
  assertFalse(ClassUtils.isArray(Integer.TYPE));
}
项目:cp-elements    文件:ClassUtilsTests.java   
@Test
public void isNotClass() {
  assertFalse(ClassUtils.isClass(null));
  assertFalse(ClassUtils.isClass(int[].class)); // array
  assertFalse(ClassUtils.isClass(Documented.class)); // annotation
  assertFalse(ClassUtils.isClass(Thread.State.class)); // enum
  assertFalse(ClassUtils.isClass(Cloneable.class)); // interface
  assertFalse(ClassUtils.isClass(Integer.TYPE)); // primitive
}
项目:cp-elements    文件:ClassUtilsTests.java   
@Test
public void isNotEnum() {
  assertFalse(ClassUtils.isEnum(null));
  assertFalse(ClassUtils.isEnum(int[].class));
  assertFalse(ClassUtils.isEnum(Documented.class));
  assertFalse(ClassUtils.isEnum(Object.class));
  assertFalse(ClassUtils.isEnum(Runnable.class));
  assertFalse(ClassUtils.isEnum(Integer.TYPE));
}
项目:cp-elements    文件:ClassUtilsTests.java   
@Test
public void isNotPrimitive() {
  assertFalse(ClassUtils.isPrimitive(null));
  assertFalse(ClassUtils.isPrimitive(int[].class));
  assertFalse(ClassUtils.isPrimitive(double[][].class));
  assertFalse(ClassUtils.isPrimitive(Documented.class));
  assertFalse(ClassUtils.isPrimitive(Object.class));
  assertFalse(ClassUtils.isPrimitive(Boolean.class));
  assertFalse(ClassUtils.isPrimitive(Character.class));
  assertFalse(ClassUtils.isPrimitive(Integer.class));
  assertFalse(ClassUtils.isPrimitive(Double.class));
  assertFalse(ClassUtils.isPrimitive(String.class));
  assertFalse(ClassUtils.isPrimitive(Thread.State.class));
  assertFalse(ClassUtils.isPrimitive(Runnable.class));
}
项目:dolphin-platform    文件:ClasspathScannerTest.java   
private void assertForAnnotation(final DefaultClasspathScanner scanner) {
    final Set<Class<?>> resourceClasses = scanner.getTypesAnnotatedWith(Resource.class);
    assertNotNull(resourceClasses);
    assertEquals(resourceClasses.size(), 1);

    final Set<Class<?>> documentClasses = scanner.getTypesAnnotatedWith(Documented.class);
    assertNotNull(documentClasses);
    assertEquals(documentClasses.size(), 1);
}
项目:jadecy    文件:ClassDepsParserTest.java   
public void test_computeDependencies_fromAno_public() {
    for (boolean apiOnly : FALSE_TRUE) {

        final SortedSet<String> expected = new TreeSet<String>();
        //
        // Extends Object.
        addSlashedName(expected, Object.class);
        // Implements Annotation.
        addSlashedName(expected, Annotation.class);
        //
        addSlashedName(expected, Class.class);
        addSlashedName(expected, Number.class);
        addSlashedName(expected, Byte.class);
        addSlashedName(expected, String.class);
        addSlashedName(expected, RoundingMode.class);
        addSlashedName(expected, Documented.class);
        //
        if (apiOnly) {
        } else {
            addSlashedName(expected, Retention.class);
            addSlashedName(expected, RetentionPolicy.class);
            addSlashedName(expected, Target.class);
            addSlashedName(expected, ElementType.class);
            //
            addSlashedName(expected, ClassDepsParserTest.class);
        }

        computeDepsAndCheck(MyTestAnno2_public.class.getName(), apiOnly, expected);
    }
}
项目:jadecy    文件:ClassDepsParserTest.java   
public void test_computeDependencies_fromAno_private() {
    for (boolean apiOnly : FALSE_TRUE) {

        final SortedSet<String> expected = new TreeSet<String>();
        //
        if (apiOnly) {
        } else {
            addSlashedName(expected, Retention.class);
            addSlashedName(expected, RetentionPolicy.class);
            addSlashedName(expected, Target.class);
            addSlashedName(expected, ElementType.class);
            //
            addSlashedName(expected, ClassDepsParserTest.class);
            //
            addSlashedName(expected, Object.class);
            addSlashedName(expected, Annotation.class);
            //
            addSlashedName(expected, Class.class);
            addSlashedName(expected, Number.class);
            addSlashedName(expected, Byte.class);
            addSlashedName(expected, String.class);
            addSlashedName(expected, RoundingMode.class);
            addSlashedName(expected, Documented.class);
        }

        computeDepsAndCheck(MyTestAnno2_private.class.getName(), apiOnly, expected);
    }
}
项目:cp-elements    文件:ClassUtilsTests.java   
@Test
public void isAnnotation() {
  assertTrue(ClassUtils.isAnnotation(Documented.class));
}
项目:cp-elements    文件:ClassUtilsTests.java   
@Test
public void isInterface() {
  assertTrue(ClassUtils.isInterface(Documented.class)); // true, even an enum type!
  assertTrue(ClassUtils.isInterface(Runnable.class));
}