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


Java Generated類代碼示例

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


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

示例1: findPathInGeneratedAnnotation

import javax.annotation.Generated; //導入依賴的package包/類
/**
 * @param project
 * @param itype
 * @return
 * @throws JavaModelException
 */
private static IPath findPathInGeneratedAnnotation(IProject project, IType itype) throws JavaModelException {
	ICompilationUnit cu = itype.getCompilationUnit();
	List<IAnnotationBinding> annotations = resolveAnnotation(cu, Generated.class).getAnnotations();
	if ((annotations != null) && (annotations.size() > 0)) {
		IAnnotationBinding ab = annotations.get(0);
		IMemberValuePairBinding[] attributes = ab.getAllMemberValuePairs();
		for (int i = 0; i < attributes.length; i++) {
			IMemberValuePairBinding attribut = attributes[i];
			if (attribut.getName().equalsIgnoreCase("value")) {
				Object[] o = (Object[]) attribut.getValue();
				if (o != null && o.length > 0 && String.valueOf(o[0]).trim().length() > 0) {
					try {
						IPath p = ResourceManager.find(project, String.valueOf(o[0]).trim());
						return p;
					} catch (Exception e) {
						ResourceManager.logException(e);
						return null;
					}
				}
			}
		}
	}
	return null;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:31,代碼來源:JDTManager.java

示例2: getTypeSpec

import javax.annotation.Generated; //導入依賴的package包/類
/**
 * genera classe di test per clazz
 * 
 * @param clazz
 * @param prop
 * @param mongo
 * @return
 */
@Override
public TypeSpec getTypeSpec(Class<?> clazz) {
	Builder classTestBuilder = TypeSpec.classBuilder(clazz.getSimpleName() + TEST);
	ClassName superClass = ClassName.get(
			PropertiesUtils.getRequiredProperty(prop, PropertiesUtils.TEST_BASE_PACKAGE),
			PropertiesUtils.getRequiredProperty(prop, PropertiesUtils.TEST_BASE_CLASS));
	classTestBuilder.superclass(superClass);
	classTestBuilder.addJavadoc("@author \n");
	classTestBuilder.addModifiers(Modifier.PUBLIC);
	AnnotationSpec.Builder annSpecBuilder = AnnotationSpec.builder(Generated.class);
	annSpecBuilder.addMember("value", "\"it.fratta.jerkoff.Generator\"");
	annSpecBuilder.addMember("date", "\"" + Calendar.getInstance().getTime().toString() + "\"");
	AnnotationSpec annGenSpec = annSpecBuilder.build();
	classTestBuilder.addAnnotation(annGenSpec);
	/*
	 * for spring test
	 */
	// FieldSpec.Builder spec = FieldSpec.builder(clazz,
	// getNewInstanceOfNoParameters(clazz), Modifier.PRIVATE);
	// spec.addAnnotation(Autowired.class);
	// classTestBuilder.addField(spec.build());
	addClassMethodsToBuilder(classTestBuilder, clazz);
	return classTestBuilder.build();
}
 
開發者ID:sap-nocops,項目名稱:Jerkoff,代碼行數:33,代碼來源:PojoCreatorImpl.java

示例3: CamundaRestService

import javax.annotation.Generated; //導入依賴的package包/類
@SneakyThrows
public CamundaRestService(final ModelRepository repository, final Class<?> serviceInterfaceClass, final Class<?> serviceImplClass) {

  super(repository);

  if (!serviceInterfaceClass.isAssignableFrom(serviceImplClass)) {
    throw new IllegalStateException(String.format("%s does not implement %s", serviceImplClass, serviceInterfaceClass));
  }

  this.serviceInterfaceClass = serviceInterfaceClass;
  this.serviceImplClass = serviceImplClass;

  this.codeModel = new JCodeModel();
  this.codeModel._package(PACKAGE);
  this.definedClass = this.codeModel._class(getFullQualifiedName());
  this.definedClass.annotate(Generated.class).param("value", GenerateSwaggerServicesMojo.class.getCanonicalName());

  // add doc reference
  restService = new RestService();
  getModelRepository().addService(this.serviceInterfaceClass.getName(), restService);
}
 
開發者ID:camunda,項目名稱:camunda-bpm-swagger,代碼行數:22,代碼來源:CamundaRestService.java

示例4: defineClass

import javax.annotation.Generated; //導入依賴的package包/類
public JDefinedClass defineClass(AbstractType t, ClassType type) {
	String fullyQualifiedName = nameGenerator.fullyQualifiedName(t);
	try {
		JDefinedClass _class = mdl._class(fullyQualifiedName, type);
		if (config.addGenerated) {
			_class.annotate(Generated.class).param("value", JavaWriter.class.getPackage().getName()).param("date",
					new Date().toString());
		}
		if (t.hasDirectMeta(Description.class)) {
			String description = t.oneMeta(Description.class).value();
			_class.javadoc().add(description);
		}
		return _class;
	} catch (JClassAlreadyExistsException e) {
		throw new IllegalStateException(e);
	}
}
 
開發者ID:OnPositive,項目名稱:aml,代碼行數:18,代碼來源:JavaWriter.java

示例5: getJavaFile

import javax.annotation.Generated; //導入依賴的package包/類
public JavaFile getJavaFile() {
	ClassName bsoneerCodecProviderClassName = ClassName.get(basePackage, "BsoneeCodecProvider");

	TypeSpec.Builder codecProviderBuilder = TypeSpec.classBuilder(bsoneerCodecProviderClassName.simpleName())
	        .addJavadoc(ProcessorJavadocs.GENERATED_BY_BSONEER)
	        .addSuperinterface(CodeUtil.bsonCodecProviderTypeName())
	        .addModifiers(PUBLIC).addAnnotation(AnnotationSpec.builder(Generated.class)
	        		.addMember("value", "$S", BsonProcessor.class.getCanonicalName())
	        		.build());;

	addBaseConstructor(codecProviderBuilder);
	addGetCodecMethod(codecProviderBuilder);

	return JavaFile.builder(bsoneerCodecProviderClassName.packageName(), codecProviderBuilder.build())
			.addFileComment(ProcessorJavadocs.GENERATED_BY_BSONEER)
			.indent("\t")
			.build();
}
 
開發者ID:guicamest,項目名稱:bsoneer,代碼行數:19,代碼來源:BsoneeCodecProviderGenerator.java

示例6: isIsPermaLink

import javax.annotation.Generated; //導入依賴的package包/類
/**
 * Gets the value of the isPermaLink property.
 * 
 * @return
 *     possible object is
 *     {@link Boolean }
 *     
 */
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2017-03-01T09:39:56+01:00", comments = "JAXB RI v2.2.8-b130911.1802")
public boolean isIsPermaLink() {
    if (isPermaLink == null) {
        return true;
    } else {
        return isPermaLink;
    }
}
 
開發者ID:petrbalat,項目名稱:kares,代碼行數:17,代碼來源:Guid.java

示例7: getGenerationDetails

import javax.annotation.Generated; //導入依賴的package包/類
public static AnnotationSpec getGenerationDetails(Class className) {
    DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.ENGLISH);
    return AnnotationSpec.builder(Generated.class)
            .addMember("value", "$S", className.getCanonicalName())
            .addMember("date", "$S", dateFormat.format(new Date()))
            .addMember("comments", "$S", "Auto Generated by GreenDAO Migrator. DO NOT EDIT.")
            .build();
}
 
開發者ID:cyrilpillai,項目名稱:GreenDao-Migrator,代碼行數:9,代碼來源:BaseUtil.java

示例8: applyShouldAddGeneratedAnnotation

import javax.annotation.Generated; //導入依賴的package包/類
@Test
public void applyShouldAddGeneratedAnnotation() throws Exception {
    // setup
    final TypeSpec.Builder builder = TypeSpec.classBuilder("Test");

    // exercise
    underTest.apply(builder);

    // verify
    assertThat(builder.build())
            .hasName("Test")
            .hasAnnotation(AnnotationSpec.builder(Generated.class)
                    .addMember("value", "$S", this.getClass().getCanonicalName())
                    .build());
}
 
開發者ID:t28hub,項目名稱:json2java4idea,代碼行數:16,代碼來源:GeneratedAnnotationPolicyTest.java

示例9: store

import javax.annotation.Generated; //導入依賴的package包/類
@Override
public boolean store(DefinitionModel model) {
  String packageName = model.getSourcePackage();
  String className = model.getSourceClass() + "_" + FileStore.STANDARD.getPath();
  String data = getGson().toJson(model);
  
  FieldSpec fieldSpec = FieldSpec.builder(String.class, AptResourceLoader.FIELD_NAME)
      .addModifiers(Modifier.PRIVATE, Modifier.FINAL)
      .initializer("$S", data)
      .addAnnotation(AnnotationSpec.builder(SuppressWarnings.class).addMember("value", "$S", "unused").build())
      .build();

  TypeSpec classSpec = TypeSpec.classBuilder(className)
      .addModifiers(Modifier.PUBLIC)
      .addField(fieldSpec)
      .addAnnotation(AnnotationSpec.builder(Generated.class).addMember("value", "$S", "SpringApt").build())
      .build();
  
  JavaFile javaFile = JavaFile.builder(packageName, classSpec)
      .build();

  try {
    OutputStream stream = getDefinitionOutputStreamProvider().store(model);
    try {
      stream.write(javaFile.toString().getBytes(StandardCharsets.UTF_8));
    } finally {
      stream.close();
    }
    model.setSha256(bytesToHex(getSha256Digest().digest(data.getBytes(StandardCharsets.UTF_8))));
    return true;
  } catch (IOException ex) {
    throw new IllegalStateException("Could not store model to class", ex);
  }
}
 
開發者ID:salesforce,項目名稱:AptSpring,代碼行數:35,代碼來源:ClassFileGsonDefinitionModelStore.java

示例10: getVersion

import javax.annotation.Generated; //導入依賴的package包/類
/**
 * Gets the value of the version property.
 * 
 * @return
 *     possible object is
 *     {@link BigDecimal }
 *     
 */
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2017-03-01T09:39:56+01:00", comments = "JAXB RI v2.2.8-b130911.1802")
public BigDecimal getVersion() {
    if (version == null) {
        return new BigDecimal("2.0");
    } else {
        return version;
    }
}
 
開發者ID:petrbalat,項目名稱:kares,代碼行數:17,代碼來源:Rss.java

示例11: createFileSpec

import javax.annotation.Generated; //導入依賴的package包/類
private JavaFile createFileSpec() throws Exception {
    AnnotationSpec generated = AnnotationSpec.builder(Generated.class)
            .addMember("value", "$S", "com.vocalabs.egtest.EgTest")
            .build();
    TypeSpec.Builder typeSpecBuilder = TypeSpec.classBuilder(className)
            .addModifiers(Modifier.PUBLIC, Modifier.FINAL)
            .addAnnotation(generated);
    TestWriter.write(this, typeSpecBuilder);
    codeInjector.decorateClass(typeSpecBuilder);
    TypeSpec javaFileSpec = typeSpecBuilder.build();
    JavaFile.Builder fileBuilder = JavaFile.builder(codeInjector.getPackageName(), javaFileSpec);
    return fileBuilder.build();
}
 
開發者ID:dleppik,項目名稱:EgTest,代碼行數:14,代碼來源:ClassWriter.java

示例12: addGeneratedAnnotation

import javax.annotation.Generated; //導入依賴的package包/類
public static void addGeneratedAnnotation(ProcessingEnvironment processingEnvironment, TypeSpec.Builder builder) {
    Elements elements = processingEnvironment.getElementUtils();
    if (elements.getTypeElement(Generated.class.getCanonicalName()) != null) {
        builder.addAnnotation(AnnotationSpec.builder(Generated.class)
                .addMember("value", "$S", SharedPreferenceProcessor.class.getCanonicalName()).build());
    }
}
 
開發者ID:RaunySouza,項目名稱:preferencer,代碼行數:8,代碼來源:CodeGeneration.java

示例13: getTopics

import javax.annotation.Generated; //導入依賴的package包/類
@Generated(value = "com.sun.tools.xjc.Driver", date = "2016-10-02T10:27:12+03:00", comments = "JAXB RI vhudson-jaxb-ri-2.2-147")
public List<Topic> getTopics() {
    if (topics == null) {
        topics = new ArrayList<Topic>();
    }
    return this.topics;
}
 
開發者ID:psyriccio,項目名稱:VoteFlow,代碼行數:8,代碼來源:ResultImpl.java

示例14: getStages

import javax.annotation.Generated; //導入依賴的package包/類
@Generated(value = "com.sun.tools.xjc.Driver", date = "2016-10-02T10:27:16+03:00", comments = "JAXB RI vhudson-jaxb-ri-2.2-147")
public List<Stage> getStages() {
    if (stages == null) {
        stages = new ArrayList<Stage>();
    }
    return this.stages;
}
 
開發者ID:psyriccio,項目名稱:VoteFlow,代碼行數:8,代碼來源:ResultImpl.java

示例15: getPhases

import javax.annotation.Generated; //導入依賴的package包/類
@Generated(value = "com.sun.tools.xjc.Driver", date = "2016-10-02T10:27:16+03:00", comments = "JAXB RI vhudson-jaxb-ri-2.2-147")
public List<Phase> getPhases() {
    if (phases == null) {
        phases = new ArrayList<Phase>();
    }
    return this.phases;
}
 
開發者ID:psyriccio,項目名稱:VoteFlow,代碼行數:8,代碼來源:StageImpl.java


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