01: /*
02: * Copyright 2005 Joe Walker
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.directwebremoting.drapgen.ast;
17:
18: import static org.directwebremoting.drapgen.ast.SerializationStrings.*;
19:
20: /**
21: * Element it the parent type for anything in Drapgen that can be documented.
22: * @author Joe Walker [joe at getahead dot ltd dot uk]
23: */
24: public class Element {
25: /**
26: * @return the documentation
27: */
28: public String getDocumentation() {
29: return documentation;
30: }
31:
32: /**
33: * @param documentation the documentation to set
34: */
35: public void setDocumentation(String documentation) {
36: this .documentation = documentation;
37: }
38:
39: /**
40: * Add a documentation element to the given element
41: * @param element The element to which to add a documentation element
42: */
43: protected void writeDocumentation(nu.xom.Element element) {
44: if (documentation != null && documentation.length() != 0) {
45: nu.xom.Element docElement = new nu.xom.Element(
46: DOCUMENTATION);
47: docElement.appendChild(documentation);
48: element.appendChild(docElement);
49: }
50: }
51:
52: /**
53: * Read a documentation element child of the given element
54: * @param element The element from which to read a documentation element
55: */
56: protected void readDocumentation(nu.xom.Element element) {
57: nu.xom.Element docElement = element
58: .getFirstChildElement(DOCUMENTATION);
59: if (docElement != null) {
60: documentation = docElement.getValue();
61: }
62: }
63:
64: private String documentation;
65: }
|