javassist.bytecode.annotation.AnnotationMemberValue Java Examples
The following examples show how to use
javassist.bytecode.annotation.AnnotationMemberValue.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractMethodCreator.java From minnal with Apache License 2.0 | 6 votes |
/** * 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; }
Example #2
Source File: ClassGenerator.java From flower with Apache License 2.0 | 5 votes |
private MemberValue getMemberValue(Object obj, ConstPool cp) { if (obj == null) { return null; } if (obj instanceof Integer) { return new IntegerMemberValue(cp, (Integer) obj); } else if (obj instanceof Boolean) { return new BooleanMemberValue((Boolean) obj, cp); } else if (obj instanceof Double) { return new DoubleMemberValue((Double) obj, cp); } else if (obj instanceof Float) { return new FloatMemberValue((Float) obj, cp); } else if (obj instanceof Short) { return new ShortMemberValue((Short) obj, cp); } else if (obj instanceof String) { return new StringMemberValue((String) obj, cp); } else if (obj instanceof String[]) { String[] oo = (String[]) obj; MemberValue[] memberValues = new MemberValue[oo.length]; ArrayMemberValue value = new ArrayMemberValue(cp); for (int i = 0; i < oo.length; i++) { memberValues[i] = getMemberValue(oo[i], cp); } value.setValue(memberValues); return value; } else if (obj instanceof Byte) { return new ByteMemberValue((Byte) obj, cp); } else if (obj instanceof Annotation) { return new AnnotationMemberValue((Annotation) obj, cp); } else if (obj instanceof ArrayMemberValue) { return new ArrayMemberValue((MemberValue) obj, cp); } else if (obj instanceof Character) { return new CharMemberValue((char) obj, cp); } else if (obj instanceof Long) { return new LongMemberValue((Long) obj, cp); } return null; }
Example #3
Source File: AbstractMethodCreator.java From minnal with Apache License 2.0 | 5 votes |
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; }
Example #4
Source File: ClassPathScanner.java From Bats with Apache License 2.0 | 4 votes |
@Override public void visitAnnotationMemberValue(AnnotationMemberValue node) { values.add(String.valueOf(node.getValue())); }
Example #5
Source File: ClassExtractorAnnotationMemberValue.java From smart-testing with Apache License 2.0 | 4 votes |
@Override public void visitAnnotationMemberValue(AnnotationMemberValue node) { }
Example #6
Source File: ClassPathScanner.java From dremio-oss with Apache License 2.0 | 4 votes |
@Override public void visitAnnotationMemberValue(AnnotationMemberValue node) { values.add(String.valueOf(node.getValue())); }