當前位置: 首頁>>代碼示例>>Java>>正文


Java Documented類代碼示例

本文整理匯總了Java中java.lang.annotation.Documented的典型用法代碼示例。如果您正苦於以下問題:Java Documented類的具體用法?Java Documented怎麽用?Java Documented使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Documented類屬於java.lang.annotation包,在下文中一共展示了Documented類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: buildTemplateConstraint

import java.lang.annotation.Documented; //導入依賴的package包/類
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);
    }
}
 
開發者ID:hibernate,項目名稱:beanvalidation-benchmark,代碼行數:19,代碼來源:Jsr303Annotator.java

示例2: verifyAnnotations

import java.lang.annotation.Documented; //導入依賴的package包/類
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);
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:NoPrivateTypesExported.java

示例3: doTestMetadataForAnnotationClass

import java.lang.annotation.Documented; //導入依賴的package包/類
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));
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:19,代碼來源:AnnotationMetadataTests.java

示例4: getAllReflectionClasses

import java.lang.annotation.Documented; //導入依賴的package包/類
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
	}
 
開發者ID:liraz,項目名稱:gwt-backbone,代碼行數:26,代碼來源:ReflectAllInOneCreator.java

示例5: testScanOtherPackage

import java.lang.annotation.Documented; //導入依賴的package包/類
@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));
}
 
開發者ID:canoo,項目名稱:dolphin-platform,代碼行數:18,代碼來源:ClasspathScannerTest.java

示例6: user

import java.lang.annotation.Documented; //導入依賴的package包/類
/**
 * 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));
}
 
開發者ID:asakusafw,項目名稱:asakusafw-compiler,代碼行數:23,代碼來源:CompositeOperatorEstimatorTest.java

示例7: test_computeDependencies_packageInfo

import java.lang.annotation.Documented; //導入依賴的package包/類
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);
    }
}
 
開發者ID:jeffhain,項目名稱:jadecy,代碼行數:21,代碼來源:ClassDepsParserTest.java

示例8: test_computeDependencies_methodCodeStaticInitBlock

import java.lang.annotation.Documented; //導入依賴的package包/類
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);
    }
}
 
開發者ID:jeffhain,項目名稱:jadecy,代碼行數:26,代碼來源:ClassDepsParserTest.java

示例9: test_computeDependencies_methodCodeInitBlock

import java.lang.annotation.Documented; //導入依賴的package包/類
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);
    }
}
 
開發者ID:jeffhain,項目名稱:jadecy,代碼行數:26,代碼來源:ClassDepsParserTest.java

示例10: test_computeDependencies_methodCodeConstructor

import java.lang.annotation.Documented; //導入依賴的package包/類
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);
    }
}
 
開發者ID:jeffhain,項目名稱:jadecy,代碼行數:24,代碼來源:ClassDepsParserTest.java

示例11: test_computeDependencies_methodCodeNonGen

import java.lang.annotation.Documented; //導入依賴的package包/類
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);
    }
}
 
開發者ID:jeffhain,項目名稱:jadecy,代碼行數:24,代碼來源:ClassDepsParserTest.java

示例12: test_computeDependencies_methodCodeGenStrict

import java.lang.annotation.Documented; //導入依賴的package包/類
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);
    }
}
 
開發者ID:jeffhain,項目名稱:jadecy,代碼行數:24,代碼來源:ClassDepsParserTest.java

示例13: test_computeDependencies_methodCodeGenLoose

import java.lang.annotation.Documented; //導入依賴的package包/類
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);
    }
}
 
開發者ID:jeffhain,項目名稱:jadecy,代碼行數:24,代碼來源:ClassDepsParserTest.java

示例14: test_isAnnotationPresent_Cla

import java.lang.annotation.Documented; //導入依賴的package包/類
/**
 *  
 */
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));
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:20,代碼來源:Class1_5Test.java

示例15: test_getAnnotation_Cla

import java.lang.annotation.Documented; //導入依賴的package包/類
/**
 *  
 */
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);
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:20,代碼來源:Class1_5Test.java


注:本文中的java.lang.annotation.Documented類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。