01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.jetspeed.serializer.objects;
18:
19: import javolution.xml.*;
20: import javolution.xml.stream.XMLStreamException;
21:
22: import org.apache.commons.lang.StringEscapeUtils;
23:
24: public class JSGroup {
25: // private int refID;
26:
27: String name;
28:
29: public JSGroup() {
30: // refID = id;
31: }
32:
33: /***************************************************************************
34: * SERIALIZER
35: */
36: private static final XMLFormat XML = new XMLFormat(JSGroup.class) {
37: public void write(Object o, OutputElement xml)
38: throws XMLStreamException {
39:
40: try {
41: JSGroup g = (JSGroup) o;
42: xml.addText(g.getName());
43: } catch (Exception e) {
44: e.printStackTrace();
45: }
46: }
47:
48: public void read(InputElement xml, Object o) {
49: try {
50: JSGroup g = (JSGroup) o;
51: g.setName(StringEscapeUtils.unescapeHtml(xml.getText()
52: .toString()));
53: } catch (Exception e) {
54: e.printStackTrace();
55: }
56: }
57: };
58:
59: /**
60: * @return Returns the name.
61: */
62: public String getName() {
63: return name;
64: }
65:
66: /**
67: * @param name
68: * The name to set.
69: */
70: public void setName(String name) {
71: this.name = name;
72: }
73:
74: }
|