当前位置: 首页>>代码示例>>Java>>正文


Java JAnnotationArrayMember类代码示例

本文整理汇总了Java中com.helger.jcodemodel.JAnnotationArrayMember的典型用法代码示例。如果您正苦于以下问题:Java JAnnotationArrayMember类的具体用法?Java JAnnotationArrayMember怎么用?Java JAnnotationArrayMember使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JAnnotationArrayMember类属于com.helger.jcodemodel包,在下文中一共展示了JAnnotationArrayMember类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildFactory

import com.helger.jcodemodel.JAnnotationArrayMember; //导入依赖的package包/类
JMethod buildFactory(Map<String, JMethod> constructorMethods) throws JClassAlreadyExistsException {
    JDefinedClass factory = buildFactoryClass(constructorMethods);

    JFieldVar factoryField = environment.buildValueClassField(JMod.PRIVATE | JMod.STATIC | JMod.FINAL, factory, "FACTORY");
    JAnnotationUse fieldAnnotationUse = factoryField.annotate(SuppressWarnings.class);
    JAnnotationArrayMember paramArray = fieldAnnotationUse.paramArray("value");
    paramArray.param("unchecked");
    paramArray.param("rawtypes");

    factoryField.init(JExpr._new(factory));
    JMethod factoryMethod = environment.buildValueClassMethod(Source.toJMod(environment.factoryMethodAccessLevel()) | JMod.STATIC, "factory");
    Source.annotateNonnull(factoryMethod);
    JAnnotationUse methodAnnotationUse = factoryMethod.annotate(SuppressWarnings.class);
    methodAnnotationUse.param("value", "unchecked");
    for (JTypeVar visitorTypeParameter: environment.getValueTypeParameters()) {
        JTypeVar typeParameter = factoryMethod.generify(visitorTypeParameter.name());
        typeParameter.boundLike(visitorTypeParameter);
    }
    AbstractJClass usedValueClassType = environment.wrappedValueClassType(factoryMethod.typeParams());
    factoryMethod.type(environment.visitor(usedValueClassType, usedValueClassType, types._RuntimeException).getVisitorType());
    factoryMethod.body()._return(factoryField);
    return factoryMethod;
}
 
开发者ID:sviperll,项目名称:adt4j,代码行数:24,代码来源:FinalValueClassModel.java

示例2: annotate

import com.helger.jcodemodel.JAnnotationArrayMember; //导入依赖的package包/类
public void annotate(final MethodStep methodStep, final Method m) {

    // resources are not annotated at all, because the resource itself will contain a method
    // that will get into the public API.
    if (!TypeHelper.isResource(methodStep.getReturnType()) && restOperation != null) {
      final Map<String, ParameterDescription> responseCodes = restOperation.getResponseCodes();
      if (!responseCodes.isEmpty()) {
        final JAnnotationArrayMember responseArray = getMethod().annotate(ApiResponses.class).paramArray("value");
        for (final String code : responseCodes.keySet()) {
          responseArray.annotate(ApiResponse.class).param("code", Integer.valueOf(code)).param("message", responseCodes.get(code).getDescription());
        }
      }

    }
  }
 
开发者ID:camunda,项目名称:camunda-bpm-swagger,代码行数:16,代码来源:ApiResponsesStep.java


注:本文中的com.helger.jcodemodel.JAnnotationArrayMember类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。