01: package org.kohsuke.rngom.parse.host;
02:
03: import org.kohsuke.rngom.ast.builder.Annotations;
04: import org.kohsuke.rngom.ast.builder.BuildException;
05: import org.kohsuke.rngom.ast.builder.CommentList;
06: import org.kohsuke.rngom.ast.om.Location;
07: import org.kohsuke.rngom.ast.om.ParsedElementAnnotation;
08:
09: /**
10: *
11: * @author
12: * Kohsuke Kawaguchi (kk@kohsuke.org)
13: */
14: class AnnotationsHost extends Base implements Annotations {
15: final Annotations lhs;
16: final Annotations rhs;
17:
18: AnnotationsHost(Annotations lhs, Annotations rhs) {
19: this .lhs = lhs;
20: this .rhs = rhs;
21: }
22:
23: public void addAttribute(String ns, String localName,
24: String prefix, String value, Location _loc)
25: throws BuildException {
26: LocationHost loc = cast(_loc);
27: lhs.addAttribute(ns, localName, prefix, value, loc.lhs);
28: rhs.addAttribute(ns, localName, prefix, value, loc.rhs);
29: }
30:
31: public void addComment(CommentList _comments) throws BuildException {
32: CommentListHost comments = (CommentListHost) _comments;
33: lhs.addComment(comments == null ? null : comments.lhs);
34: rhs.addComment(comments == null ? null : comments.rhs);
35: }
36:
37: public void addElement(ParsedElementAnnotation _ea)
38: throws BuildException {
39: ParsedElementAnnotationHost ea = (ParsedElementAnnotationHost) _ea;
40: lhs.addElement(ea.lhs);
41: rhs.addElement(ea.rhs);
42: }
43:
44: public void addLeadingComment(CommentList _comments)
45: throws BuildException {
46: CommentListHost comments = (CommentListHost) _comments;
47: lhs.addLeadingComment(comments.lhs);
48: rhs.addLeadingComment(comments.rhs);
49: }
50: }
|