本文整理汇总了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;
}
示例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());
}
}
}
}