private void parseAnnotation(Annotation dest, TypeDesc annType) { while (true) { try { if (mStr.charAt(mPos) == ';') { mPos++; break; } } catch (IndexOutOfBoundsException e) { error("Missing terminator"); } if (mPos >= mStr.length()) { break; } String propName = parseName(); char propTag = peekTag(); Annotation.MemberValue mv; if (propTag == TAG_ARRAY) { mPos++; mv = parseArray(dest, peekTag(), parseTypeDesc()); } else { mv = parseProperty(dest, propTag, parseTypeDesc()); } dest.putMemberValue(propName, mv); } }
return parseTypeDesc().toArrayType(); return parseTypeDesc();
mv = dest.makeMemberValue(propAnn); } else if (propTag == TAG_CLASS) { mv = dest.makeMemberValue(parseTypeDesc()); } else { int endPos = nextTerminator();
/** * Parses the given annotation, returning the root annotation that received * the results. * * @param rootAnnotation root annotation * @return root annotation * @throws IllegalArgumentExcecption if annotation is malformed */ public Annotation parse(Annotation rootAnnotation) { mPos = 0; if (parseTag() != TAG_ANNOTATION) { throw error("Malformed"); } TypeDesc rootAnnotationType = parseTypeDesc(); if (rootAnnotation == null) { rootAnnotation = buildRootAnnotation(rootAnnotationType); } else if (!rootAnnotationType.equals(rootAnnotation.getType())) { throw new IllegalArgumentException ("Annotation type of \"" + rootAnnotationType + "\" does not match expected type of \"" + rootAnnotation.getType()); } parseAnnotation(rootAnnotation, rootAnnotationType); return rootAnnotation; }
private void parseAnnotation(Annotation dest, TypeDesc annType) { while (true) { try { if (mStr.charAt(mPos) == ';') { mPos++; break; } } catch (IndexOutOfBoundsException e) { error("Missing terminator"); } if (mPos >= mStr.length()) { break; } String propName = parseName(); char propTag = peekTag(); Annotation.MemberValue mv; if (propTag == TAG_ARRAY) { mPos++; mv = parseArray(dest, peekTag(), parseTypeDesc()); } else { mv = parseProperty(dest, propTag, parseTypeDesc()); } dest.putMemberValue(propName, mv); } }
return parseTypeDesc().toArrayType(); return parseTypeDesc();
mv = dest.makeMemberValue(propAnn); } else if (propTag == TAG_CLASS) { mv = dest.makeMemberValue(parseTypeDesc()); } else { int endPos = nextTerminator();
/** * Parses the given annotation, returning the root annotation that received * the results. * * @param rootAnnotation root annotation * @return root annotation * @throws IllegalArgumentExcecption if annotation is malformed */ public Annotation parse(Annotation rootAnnotation) { mPos = 0; if (parseTag() != TAG_ANNOTATION) { throw error("Malformed"); } TypeDesc rootAnnotationType = parseTypeDesc(); if (rootAnnotation == null) { rootAnnotation = buildRootAnnotation(rootAnnotationType); } else if (!rootAnnotationType.equals(rootAnnotation.getType())) { throw new IllegalArgumentException ("Annotation type of \"" + rootAnnotationType + "\" does not match expected type of \"" + rootAnnotation.getType()); } parseAnnotation(rootAnnotation, rootAnnotationType); return rootAnnotation; }