本文整理汇总了Java中javassist.bytecode.annotation.AnnotationMemberValue类的典型用法代码示例。如果您正苦于以下问题:Java AnnotationMemberValue类的具体用法?Java AnnotationMemberValue怎么用?Java AnnotationMemberValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnnotationMemberValue类属于javassist.bytecode.annotation包,在下文中一共展示了AnnotationMemberValue类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getApiParamAnnotations
import javassist.bytecode.annotation.AnnotationMemberValue; //导入依赖的package包/类
/**
* Returns the api parameter annotations
*
* @return
*/
protected Annotation getApiParamAnnotations() {
Annotation implicitParams = new Annotation(ApiImplicitParams.class.getCanonicalName(), ctClass.getClassFile().getConstPool());
List<AnnotationMemberValue> annotationMemberValues = new ArrayList<AnnotationMemberValue>();
List<Annotation> annotations = Lists.newArrayList();
annotations.addAll(getApiPathParamAnnotations());
annotations.addAll(getApiQueryParamAnnotations());
annotations.addAll(getApiAdditionalParamAnnotations());
for (Annotation annotation : annotations) {
annotationMemberValues.add(new AnnotationMemberValue(annotation, ctClass.getClassFile().getConstPool()));
}
ArrayMemberValue values = new ArrayMemberValue(ctClass.getClassFile().getConstPool());
values.setValue(annotationMemberValues.toArray(new AnnotationMemberValue[0]));
implicitParams.addMemberValue("value", values);
return implicitParams;
}
示例2: getExistingXmlJavaTypeAdapters
import javassist.bytecode.annotation.AnnotationMemberValue; //导入依赖的package包/类
/**
* A narrow-purpose helper method that accepts an {@link
* ArrayMemberValue} parameter whose value is (semantically) the
* return value of the {@link XmlJavaTypeAdapters#value()}
* annotation attribute, and returns a {@link Map} of {@link
* Annotation} objects representing {@link XmlJavaTypeAdapter}
* annotations indexed by the {@linkplain XmlJavaTypeAdapter#type()
* types} that each of them governs.
*
* <p>This method never returns {@code null}.</p>
*
* @param adaptersHolder the {@link ArrayMemberValue} that resulted
* from calling {@link Annotation#getMemberValue(String)
* Annotation#getMemberValue("value")} on an {@link Annotation} that
* is Javassist's representation of the {@link XmlJavaTypeAdapters}
* annotation. This parameter may be {@code null}.
*
* @return a {@link Map} of {@link Annotation} objects representing
* {@link XmlJavaTypeAdapter} annotations indexed by the {@linkplain
* XmlJavaTypeAdapter#type() types} that each of them governs; never
* {@code null}
*/
private static final Map<String, Annotation> getExistingXmlJavaTypeAdapters(final ArrayMemberValue adaptersHolder) {
// Build a Map indexing existing @XmlJavaTypeAdapter annotations
// by the types that they govern.
final Map<String, Annotation> xmlJavaTypeAdapters = new HashMap<String, Annotation>();
if (adaptersHolder != null) {
final MemberValue[] rawMemberValue = adaptersHolder.getValue();
if (rawMemberValue != null && rawMemberValue.length > 0) {
for (final MemberValue mv : rawMemberValue) {
if (mv instanceof AnnotationMemberValue) {
final Annotation xmlJavaTypeAdapter = ((AnnotationMemberValue)mv).getValue();
if (xmlJavaTypeAdapter != null && XmlJavaTypeAdapter.class.getName().equals(xmlJavaTypeAdapter.getTypeName())) {
final ClassMemberValue typeHolder = (ClassMemberValue)xmlJavaTypeAdapter.getMemberValue("type");
if (typeHolder != null) {
final String interfaceTypeName = typeHolder.getValue();
if (interfaceTypeName != null) {
xmlJavaTypeAdapters.put(interfaceTypeName, xmlJavaTypeAdapter);
}
}
}
}
}
}
}
return xmlJavaTypeAdapters;
}
示例3: getApiResponsesAnnotation
import javassist.bytecode.annotation.AnnotationMemberValue; //导入依赖的package包/类
protected Annotation getApiResponsesAnnotation() {
Annotation apiResponses = new Annotation(ApiResponses.class.getCanonicalName(), ctClass.getClassFile().getConstPool());
ArrayMemberValue values = new ArrayMemberValue(ctClass.getClassFile().getConstPool());
List<AnnotationMemberValue> memberValues = new ArrayList<AnnotationMemberValue>();
for (Annotation annotation : getApiResponseAnnotations()) {
memberValues.add(new AnnotationMemberValue(annotation, ctClass.getClassFile().getConstPool()));
}
values.setValue(memberValues.toArray(new AnnotationMemberValue[0]));
apiResponses.addMemberValue("value", values);
return apiResponses;
}
示例4: visitAnnotationMemberValue
import javassist.bytecode.annotation.AnnotationMemberValue; //导入依赖的package包/类
@Override
public void visitAnnotationMemberValue(AnnotationMemberValue node) {
values.add(String.valueOf(node.getValue()));
}
示例5: visitAnnotationMemberValue
import javassist.bytecode.annotation.AnnotationMemberValue; //导入依赖的package包/类
@Override
public void visitAnnotationMemberValue(AnnotationMemberValue node) {
}