javassist.bytecode.annotation.Annotation Java Examples
The following examples show how to use
javassist.bytecode.annotation.Annotation.
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: JField.java From jadira with Apache License 2.0 | 6 votes |
@Override public Set<JAnnotation<?>> getAnnotations() { AnnotationsAttribute visible = (AnnotationsAttribute) fieldInfo.getAttribute(AnnotationsAttribute.visibleTag); AnnotationsAttribute invisible = (AnnotationsAttribute) fieldInfo.getAttribute(AnnotationsAttribute.invisibleTag); Set<JAnnotation<?>> annotations = new HashSet<JAnnotation<?>>(); List<Annotation> annotationsList = new ArrayList<Annotation>(); if (visible != null) { annotationsList.addAll(Arrays.asList(visible.getAnnotations())); } if (invisible != null) { annotationsList.addAll(Arrays.asList(invisible.getAnnotations())); } for (Annotation nextAnnotation : annotationsList) { annotations.add(JAnnotation.getJAnnotation(nextAnnotation, this, getResolver())); } return annotations; }
Example #2
Source File: JavassistUtils.java From statefulj with Apache License 2.0 | 6 votes |
public static void addClassAnnotation(CtClass clazz, Class<?> annotationClass, Object... values) { ClassFile ccFile = clazz.getClassFile(); ConstPool constPool = ccFile.getConstPool(); AnnotationsAttribute attr = getAnnotationsAttribute(ccFile); Annotation annot = new Annotation(annotationClass.getName(), constPool); for(int i = 0; i < values.length; i = i + 2) { String valueName = (String)values[i]; Object value = values[i+1]; if (valueName != null && value != null) { MemberValue memberValue = createMemberValue(constPool, value); annot.addMemberValue(valueName, memberValue); } } attr.addAnnotation(annot); }
Example #3
Source File: ClassTemplate.java From anno4j with Apache License 2.0 | 6 votes |
public void addAnnotation(Class<?> type, Class<?>... values) { ClassFile cf = cc.getClassFile(); ConstPool cp = cf.getConstPool(); ClassMemberValue[] elements = new ClassMemberValue[values.length]; for (int i = 0; i < values.length; i++) { elements[i] = cb.createClassMemberValue(values[i], cp); } ArrayMemberValue value = new ArrayMemberValue(cp); value.setValue(elements); AnnotationsAttribute ai = (AnnotationsAttribute) cf .getAttribute(visibleTag); if (ai == null) { ai = new AnnotationsAttribute(cp, visibleTag); cf.addAttribute(ai); } try { Annotation annotation = new Annotation(cp, get(type)); annotation.addMemberValue("value", value); ai.addAnnotation(annotation); } catch (NotFoundException e) { throw new AssertionError(e); } }
Example #4
Source File: AbstractRestfulBinder.java From statefulj with Apache License 2.0 | 6 votes |
protected Annotation[] addIdParameter( CtMethod ctMethod, Class<?> idType, ClassPool cp) throws NotFoundException, CannotCompileException { // Clone the parameter Class // CtClass ctParm = cp.get(idType.getName()); // Add the parameter to the method // ctMethod.addParameter(ctParm); // Add the Parameter Annotations to the Method // MethodInfo methodInfo = ctMethod.getMethodInfo(); ConstPool constPool = methodInfo.getConstPool(); Annotation annot = new Annotation(getPathAnnotationClass().getName(), constPool); StringMemberValue valueVal = new StringMemberValue("id", constPool); annot.addMemberValue("value", valueVal); return new Annotation[]{ annot }; }
Example #5
Source File: JavassistAdapter.java From panda with Apache License 2.0 | 6 votes |
private List<String> getAnnotationNames(AnnotationsAttribute... annotationsAttributes) { List<String> result = new ArrayList<>(); if (annotationsAttributes == null) { return result; } for (AnnotationsAttribute annotationsAttribute : annotationsAttributes) { if (annotationsAttribute == null) { continue; } for (Annotation annotation : annotationsAttribute.getAnnotations()) { result.add(annotation.getTypeName()); } } return result; }
Example #6
Source File: JavassistDynamicField.java From gecco with MIT License | 6 votes |
@Override public DynamicField href(boolean click, String... value) { Annotation annot = new Annotation(Href.class.getName(), cpool); annot.addMemberValue("click", new BooleanMemberValue(click, cpool)); ArrayMemberValue arrayMemberValue = new ArrayMemberValue(cpool); MemberValue[] memberValues = new StringMemberValue[value.length]; for(int i = 0; i < value.length; i++) { memberValues[i] = new StringMemberValue(value[i], cpool); } arrayMemberValue.setValue(memberValues); annot.addMemberValue("value", arrayMemberValue); attr.addAnnotation(annot); return this; }
Example #7
Source File: CreateMethodCreator.java From minnal with Apache License 2.0 | 6 votes |
@Override protected void addParamAnnotations(CtMethod ctMethod) { Annotation[][] annotations = new Annotation[4][1]; Annotation headersParam = new Annotation(Context.class.getCanonicalName(), ctMethod.getMethodInfo().getConstPool()); annotations[0][0] = headersParam; Annotation uriInfoParam = new Annotation(Context.class.getCanonicalName(), ctMethod.getMethodInfo().getConstPool()); annotations[1][0] = uriInfoParam; Annotation providersParam = new Annotation(Context.class.getCanonicalName(), ctMethod.getMethodInfo().getConstPool()); annotations[2][0] = providersParam; Annotation apiParam = new Annotation(ApiParam.class.getCanonicalName(), ctMethod.getMethodInfo().getConstPool()); apiParam.addMemberValue("name", new StringMemberValue("body", ctMethod.getMethodInfo().getConstPool())); apiParam.addMemberValue("access", new StringMemberValue("internal", ctMethod.getMethodInfo().getConstPool())); apiParam.addMemberValue("paramType", new StringMemberValue("body", ctMethod.getMethodInfo().getConstPool())); annotations[3][0] = apiParam; JavassistUtils.addParameterAnnotation(ctMethod, annotations); }
Example #8
Source File: CtMethodBuilder.java From japicmp with Apache License 2.0 | 6 votes |
public CtMethod addToClass(CtClass declaringClass) throws CannotCompileException { if (this.returnType == null) { this.returnType = declaringClass; } CtMethod ctMethod = CtNewMethod.make(this.modifier, this.returnType, this.name, this.parameters, this.exceptions, this.body, declaringClass); ctMethod.setModifiers(this.modifier); declaringClass.addMethod(ctMethod); for (String annotation : annotations) { ClassFile classFile = declaringClass.getClassFile(); ConstPool constPool = classFile.getConstPool(); AnnotationsAttribute attr = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag); Annotation annot = new Annotation(annotation, constPool); attr.setAnnotation(annot); ctMethod.getMethodInfo().addAttribute(attr); } return ctMethod; }
Example #9
Source File: JavassistDynamicField.java From gecco with MIT License | 6 votes |
@Override public DynamicField image(String download, String... value) { Annotation annot = new Annotation(Image.class.getName(), cpool); annot.addMemberValue("download", new StringMemberValue(download, cpool)); ArrayMemberValue arrayMemberValue = new ArrayMemberValue(cpool); MemberValue[] memberValues = new StringMemberValue[value.length]; for(int i = 0; i < value.length; i++) { memberValues[i] = new StringMemberValue(value[i], cpool); } arrayMemberValue.setValue(memberValues); annot.addMemberValue("value", arrayMemberValue); attr.addAnnotation(annot); return this; }
Example #10
Source File: JavassistUtilsTest.java From geowave with Apache License 2.0 | 6 votes |
private void annotateField( final CtField ctfield, final String annotationName, final int annotationValue) { final AnnotationsAttribute attr = new AnnotationsAttribute( ctfield.getFieldInfo().getConstPool(), AnnotationsAttribute.visibleTag); final Annotation anno = new Annotation("java.lang.Integer", ctfield.getFieldInfo().getConstPool()); anno.addMemberValue( annotationName, new IntegerMemberValue(ctfield.getFieldInfo().getConstPool(), annotationValue)); attr.addAnnotation(anno); ctfield.getFieldInfo().addAttribute(attr); }
Example #11
Source File: SpringMVCBinder.java From statefulj with Apache License 2.0 | 6 votes |
@Override protected void addEndpointMapping(CtMethod ctMethod, String method, String request) { MethodInfo methodInfo = ctMethod.getMethodInfo(); ConstPool constPool = methodInfo.getConstPool(); AnnotationsAttribute attr = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag); Annotation requestMapping = new Annotation(RequestMapping.class.getName(), constPool); ArrayMemberValue valueVals = new ArrayMemberValue(constPool); StringMemberValue valueVal = new StringMemberValue(constPool); valueVal.setValue(request); valueVals.setValue(new MemberValue[]{valueVal}); requestMapping.addMemberValue("value", valueVals); ArrayMemberValue methodVals = new ArrayMemberValue(constPool); EnumMemberValue methodVal = new EnumMemberValue(constPool); methodVal.setType(RequestMethod.class.getName()); methodVal.setValue(method); methodVals.setValue(new MemberValue[]{methodVal}); requestMapping.addMemberValue("method", methodVals); attr.addAnnotation(requestMapping); methodInfo.addAttribute(attr); }
Example #12
Source File: ProviderSupplierBrideBuilder.java From jweb-cms with GNU Affero General Public License v3.0 | 6 votes |
@SuppressWarnings("unchecked") public Class<? extends Supplier<T>> build() { ClassPool classPool = ClassPool.getDefault(); CtClass classBuilder = classPool.makeClass(providerClass.getCanonicalName() + "$Bride" + INDEX.incrementAndGet()); try { classBuilder.addInterface(classPool.get(Supplier.class.getName())); ConstPool constPool = classBuilder.getClassFile().getConstPool(); CtField field = CtField.make(String.format("%s provider;", Types.className(providerClass)), classBuilder); Annotation ctAnnotation = new Annotation(Inject.class.getCanonicalName(), constPool); AnnotationsAttribute attr = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag); attr.addAnnotation(ctAnnotation); field.getFieldInfo().addAttribute(attr); classBuilder.addField(field); CtMethod ctMethod = CtMethod.make("public Object get() {return provider.get();}", classBuilder); classBuilder.addMethod(ctMethod); return classBuilder.toClass(); } catch (CannotCompileException | NotFoundException e) { throw new ApplicationException("failed to create provider bride, providerType={}", providerClass, e); } }
Example #13
Source File: JClass.java From jadira with Apache License 2.0 | 6 votes |
@Override public Set<JAnnotation<?>> getAnnotations() { AnnotationsAttribute visible = (AnnotationsAttribute) getClassFile().getAttribute(AnnotationsAttribute.visibleTag); AnnotationsAttribute invisible = (AnnotationsAttribute) getClassFile().getAttribute(AnnotationsAttribute.invisibleTag); Set<JAnnotation<?>> annotations = new HashSet<JAnnotation<?>>(); List<Annotation> annotationsList = new ArrayList<Annotation>(); if (visible != null) { annotationsList.addAll(Arrays.asList(visible.getAnnotations())); } if (invisible != null) { annotationsList.addAll(Arrays.asList(invisible.getAnnotations())); } for (Annotation nextAnnotation : annotationsList) { annotations.add(JAnnotation.getJAnnotation(nextAnnotation, this, getResolver())); } return annotations; }
Example #14
Source File: JApiAnnotation.java From japicmp with Apache License 2.0 | 6 votes |
private Map<String, Optional<MemberValue>> buildMemberValueMap(Annotation annotation) { Map<String, Optional<MemberValue>> map = new HashMap<>(); @SuppressWarnings("unchecked") Set<String> memberNames = annotation.getMemberNames(); if (memberNames != null) { for (String memberName : memberNames) { MemberValue memberValue = annotation.getMemberValue(memberName); if (memberValue == null) { map.put(memberName, Optional.<MemberValue>absent()); } else { map.put(memberName, Optional.of(memberValue)); } } } return map; }
Example #15
Source File: JavassistUtils.java From statefulj with Apache License 2.0 | 6 votes |
public static List<Method> getMethodsAnnotatedWith(final Class<?> type, final Class<? extends java.lang.annotation.Annotation> annotation) { final List<Method> methods = new ArrayList<Method>(); Class<?> clazz = type; while (clazz != Object.class) { // need to iterated thought hierarchy in order to retrieve methods from above the current instance // iterate though the list of methods declared in the class represented by clazz variable, and add those annotated with the specified annotation final List<Method> allMethods = new ArrayList<Method>(Arrays.asList(clazz.getDeclaredMethods())); for (final Method method : allMethods) { if (annotation == null || method.isAnnotationPresent(annotation)) { methods.add(method); } } // move to the upper class in the hierarchy in search for more methods clazz = clazz.getSuperclass(); } return methods; }
Example #16
Source File: JavassistUtils.java From statefulj with Apache License 2.0 | 6 votes |
public static void addMethodAnnotations(CtMethod ctMethod, Method method) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { if (method != null) { MethodInfo methodInfo = ctMethod.getMethodInfo(); ConstPool constPool = methodInfo.getConstPool(); AnnotationsAttribute attr = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag); methodInfo.addAttribute(attr); for(java.lang.annotation.Annotation anno : method.getAnnotations()) { // If it's a Transition skip // TODO : Make this a parameterized set of Filters instead of hardcoding // Annotation clone = null; if (anno instanceof Transitions || anno instanceof Transition) { // skip } else { clone = cloneAnnotation(constPool, anno); attr.addAnnotation(clone); } } } }
Example #17
Source File: JAnnotation.java From jadira with Apache License 2.0 | 6 votes |
public A getActualAnnotation() throws ClasspathAccessException { final java.lang.annotation.Annotation[] annotations; if (enclosingElement instanceof JOperation) { annotations = JavassistAnnotationsHelper.getAnnotationsForMethod(((JOperation)enclosingElement).getMethodInfo()); } else if (enclosingElement instanceof JField) { annotations = JavassistAnnotationsHelper.getAnnotationsForFieldInfo(((JField)enclosingElement).getFieldInfo()); } else if (enclosingElement instanceof JParameter) { annotations = JavassistAnnotationsHelper.getAnnotationsForMethodParameter(((JMethod)enclosingElement).getMethodInfo(), ((JParameter)enclosingElement).getIndex()); } else if (enclosingElement instanceof JPackage) { annotations = ((JPackage)enclosingElement).getAnnotationsForPackage(); } else { annotations = JavassistAnnotationsHelper.getAnnotationsForClass(((JType)enclosingElement).getClassFile()); } String requiredName = getActualClass().getName(); for (java.lang.annotation.Annotation next : annotations) { String nextName = next.annotationType().getName(); if (nextName.equals(requiredName)) { @SuppressWarnings("unchecked") final A retVal = (A) next; return retVal; } } throw new ClasspathAccessException("Could not find annotation of type " + getActualClass() + " for " + enclosingElement); }
Example #18
Source File: AbstractMethodCreator.java From minnal with Apache License 2.0 | 6 votes |
/** * Returns the security annotation * * @return */ protected Annotation getSecurityAnnotation() { Set<String> permissions = getPermissions(); if (permissions == null || permissions.isEmpty()) { return null; } Annotation rolesAllowed = new Annotation(RolesAllowed.class.getCanonicalName(), ctClass.getClassFile().getConstPool()); ArrayMemberValue values = new ArrayMemberValue(ctClass.getClassFile().getConstPool()); List<StringMemberValue> memberValues = new ArrayList<StringMemberValue>(); for (String permission : permissions) { memberValues.add(new StringMemberValue(permission, ctClass.getClassFile().getConstPool())); } values.setValue(memberValues.toArray(new StringMemberValue[0])); rolesAllowed.addMemberValue("value", values); return rolesAllowed; }
Example #19
Source File: JInterface.java From jadira with Apache License 2.0 | 6 votes |
@Override public Set<JAnnotation<?>> getAnnotations() throws ClasspathAccessException { AnnotationsAttribute visible = (AnnotationsAttribute) getClassFile().getAttribute(AnnotationsAttribute.visibleTag); AnnotationsAttribute invisible = (AnnotationsAttribute) getClassFile().getAttribute(AnnotationsAttribute.invisibleTag); Set<JAnnotation<?>> annotations = new HashSet<JAnnotation<?>>(); List<Annotation> annotationsList = new ArrayList<Annotation>(); if (visible != null) { annotationsList.addAll(Arrays.asList(visible.getAnnotations())); } if (invisible != null) { annotationsList.addAll(Arrays.asList(invisible.getAnnotations())); } for (Annotation nextAnnotation : annotationsList) { annotations.add(JAnnotation.getJAnnotation(nextAnnotation, this, getResolver())); } return annotations; }
Example #20
Source File: JavassistUtils.java From CrossMobile with GNU Lesser General Public License v3.0 | 6 votes |
private static AttributeInfo constructAttribute(AttributeInfo info, ConstPool cp, int fields, int fieldIdx, String annotationName, JavassistAnnParam... params) { ParameterAnnotationsAttribute attribute = (ParameterAnnotationsAttribute) info; if (attribute == null) attribute = new ParameterAnnotationsAttribute(cp, ParameterAnnotationsAttribute.visibleTag); Annotation[][] annotations = attribute.getAnnotations(); if (annotations == null || annotations.length == 0) annotations = new Annotation[fields][]; for (int i = 0; i < annotations.length; i++) if (annotations[i] == null) annotations[i] = new Annotation[0]; Annotation[] oldA = annotations[fieldIdx]; annotations[fieldIdx] = new Annotation[oldA.length + 1]; System.arraycopy(oldA, 0, annotations[fieldIdx], 0, oldA.length); annotations[fieldIdx][oldA.length] = constructAnnotation(cp, annotationName, params); attribute.setAnnotations(annotations); return attribute; }
Example #21
Source File: ActionMethodCreator.java From minnal with Apache License 2.0 | 5 votes |
@Override protected Annotation getApiOperationAnnotation() { ConstPool constPool = getCtClass().getClassFile().getConstPool(); Annotation annotation = new Annotation(ApiOperation.class.getCanonicalName(), constPool); annotation.addMemberValue("value", new StringMemberValue("Performs action on " + getResourcePath().getNodePath().getName(), constPool)); return annotation; }
Example #22
Source File: CreateMethodCreator.java From minnal with Apache License 2.0 | 5 votes |
@Override protected Annotation getApiOperationAnnotation() { ConstPool constPool = getCtClass().getClassFile().getConstPool(); EntityNodePath path = getResourcePath().getNodePath(); EntityMetaData metaData = path.get(path.size() - 1).getEntityMetaData(); Annotation annotation = new Annotation(ApiOperation.class.getCanonicalName(), constPool); annotation.addMemberValue("value", new StringMemberValue("Create " + metaData.getName(), constPool)); annotation.addMemberValue("response", new ClassMemberValue(metaData.getEntityClass().getCanonicalName(), constPool)); annotation.addMemberValue("responseContainer", new StringMemberValue("List", constPool)); return annotation; }
Example #23
Source File: JavassistUtils.java From statefulj with Apache License 2.0 | 5 votes |
public static void addResourceAnnotation(CtField field, String beanName) { FieldInfo fi = field.getFieldInfo(); AnnotationsAttribute attr = new AnnotationsAttribute( field.getFieldInfo().getConstPool(), AnnotationsAttribute.visibleTag); Annotation annot = new Annotation(Resource.class.getName(), fi.getConstPool()); StringMemberValue nameValue = new StringMemberValue(fi.getConstPool()); nameValue.setValue(beanName); annot.addMemberValue("name", nameValue); attr.addAnnotation(annot); fi.addAttribute(attr); }
Example #24
Source File: JerseyBinder.java From statefulj with Apache License 2.0 | 5 votes |
@Override protected void addEndpointMapping( CtMethod ctMethod, String method, String request) { // Add Path Annotation // MethodInfo methodInfo = ctMethod.getMethodInfo(); ConstPool constPool = methodInfo.getConstPool(); AnnotationsAttribute annoAttr = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag); Annotation pathMapping = new Annotation(Path.class.getName(), constPool); StringMemberValue valueVal = new StringMemberValue(constPool); valueVal.setValue(request); pathMapping.addMemberValue("value", valueVal); annoAttr.addAnnotation(pathMapping); // Add Verb Annotation (GET|POST|PUT|DELETE) // String verbClassName = "javax.ws.rs." + method; Annotation verb = new Annotation(verbClassName, constPool); annoAttr.addAnnotation(verb); methodInfo.addAttribute(annoAttr); }
Example #25
Source File: CamelBinder.java From statefulj with Apache License 2.0 | 5 votes |
private void addConsumeAnnotation(CtMethod ctMethod, String uri) { MethodInfo methodInfo = ctMethod.getMethodInfo(); ConstPool constPool = methodInfo.getConstPool(); Annotation consume = new Annotation(Consume.class.getName(), constPool); StringMemberValue valueVal = new StringMemberValue(constPool); valueVal.setValue(uri); consume.addMemberValue("uri", valueVal); AnnotationsAttribute attr = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag); attr.addAnnotation(consume); methodInfo.addAttribute(attr); }
Example #26
Source File: SpringMVCBinder.java From statefulj with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private void addProxyMethods(CtClass mvcProxyClass, Class<?> ctrlClass, ClassPool cp) throws IllegalArgumentException, NotFoundException, IllegalAccessException, InvocationTargetException, CannotCompileException { for(Class<?> annotation : this.proxyable) { List<Method> methods = getMethodsAnnotatedWith(ctrlClass, (Class<java.lang.annotation.Annotation>)annotation); for(Method method : methods) { addProxyMethod(mvcProxyClass, method, cp); } } }
Example #27
Source File: AbstractMethodCreator.java From minnal with Apache License 2.0 | 5 votes |
/** * Returns the 404 not found response annotation * * @param responseClass * @return */ protected Annotation getNotFoundResponseAnnotation() { ConstPool constPool = ctClass.getClassFile().getConstPool(); Annotation annotation = new Annotation(ApiResponse.class.getCanonicalName(), constPool); IntegerMemberValue code = new IntegerMemberValue(constPool); code.setValue(Response.Status.NOT_FOUND.getStatusCode()); annotation.addMemberValue("code", code); annotation.addMemberValue("message", new StringMemberValue(Response.Status.NOT_FOUND.getReasonPhrase(), constPool)); return annotation; }
Example #28
Source File: DefaultRepositoryGenerator.java From business with Mozilla Public License 2.0 | 5 votes |
private Annotation copyAnnotation(ConstPool constPool, java.lang.annotation.Annotation annotation) throws NotFoundException { // Create annotation from specified type Annotation byteCodeAnnotation = createAnnotation( constPool, annotation.annotationType() ); // Copy annotation methods for (Method m : annotation.annotationType().getDeclaredMethods()) { Object value = invoke(m, annotation); MemberValue memberValue = createMemberValue( constPool, classPool.get(value.getClass().getName()) ); invoke(from(memberValue.getClass()) .method("setValue", new Class[]{value.getClass()}) .orElseThrow(() -> new NotFoundException("Cannot copy value of qualifier parameter " + m.getName())), memberValue, value); byteCodeAnnotation.addMemberValue( m.getName(), memberValue ); } return byteCodeAnnotation; }
Example #29
Source File: JApiAnnotationElementValue.java From japicmp with Apache License 2.0 | 5 votes |
@XmlAttribute(name = "value") public String getValueString() { if (type != Type.Array && type != Type.Annotation) { return XmlEscapers.xmlAttributeEscaper().escape(value.toString()); } return "n.a."; }
Example #30
Source File: JavassistDynamicBean.java From gecco with MIT License | 5 votes |
@Override public JavassistDynamicBean gecco(String[] matchUrl, String downloader, int timeout, String... pipelines) { AnnotationsAttribute attr = new AnnotationsAttribute(cpool, AnnotationsAttribute.visibleTag); Annotation annot = new Annotation(Gecco.class.getName(), cpool); // matchUrl //annot.addMemberValue("matchUrl", new StringMemberValue(matchUrl, cpool)); ArrayMemberValue arrayMemberValueMatchUrl = new ArrayMemberValue(cpool); MemberValue[] elementMatchUrls = new StringMemberValue[matchUrl.length]; for (int i = 0; i < matchUrl.length; i++) { elementMatchUrls[i] = new StringMemberValue(matchUrl[i], cpool); } arrayMemberValueMatchUrl.setValue(elementMatchUrls); annot.addMemberValue("matchUrl", arrayMemberValueMatchUrl); // downloader annot.addMemberValue("downloader", new StringMemberValue(downloader, cpool)); // timeout annot.addMemberValue("timeout", new IntegerMemberValue(cpool, timeout)); // pipelines ArrayMemberValue arrayMemberValue = new ArrayMemberValue(cpool); MemberValue[] elements = new StringMemberValue[pipelines.length]; for (int i = 0; i < pipelines.length; i++) { elements[i] = new StringMemberValue(pipelines[i], cpool); } arrayMemberValue.setValue(elements); annot.addMemberValue("pipelines", arrayMemberValue); attr.addAnnotation(annot); cfile.addAttribute(attr); return this; }