1 /*
2 * Copyright (C) 2002 Carsten Krebs (Team-Konzept GmbH & Co.KG)
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 package com.teamkonzept.dom4jb.beans.infos;
19
20 import com.teamkonzept.dom4jb.schema.DataDescriptor;
21 import com.teamkonzept.dom4jb.schema.GroupDescriptor;
22 import com.teamkonzept.dom4jb.schema.Groupable;
23 import com.teamkonzept.dom4jb.schema.Sequence;
24 import com.teamkonzept.dom4jb.schema.TextDescriptor;
25 import com.teamkonzept.dom4jb.beans.Property;
26
27 /***
28 * This is the default XMLBeanInfo defining how a string will be represented.
29 * <p>
30 * Every java.lang.String object will be represented as follows:
31 * <p>
32 * <ul>
33 * <li>as text element content, representing the String returned by the
34 * method toString()</li>
35 * <li>as attribute value, representing the String returned by the
36 * method toString()</li>
37 * <li>which contributes no attributes</li>
38 * <li>if the string is an item in a collection, the surrounding element name
39 * is the default item name</li>
40 * </ul>
41 *
42 * @author <a href="mailto:carsten.krebs@team-konzept.de">Carsten Krebs</a>
43 * @version $Revision: 1.2 $
44 *
45 * @see com.teamkonzept.dom4jb.beans.XMLBeanInfo#DEFAULT_ITEM_NAME
46 */
47 public class StringXMLBeanInfo extends ObjectXMLBeanInfo {
48
49 private static final DataDescriptor DATA_DESCRIPTOR = DataDescriptor.STRING;
50 private static final GroupDescriptor CONTENT_DESCRIPTOR =
51 new Sequence(new Groupable[] { new TextDescriptor(Property.IDENTITY)});
52
53 /*** Creates new StringXMLBeanInfo */
54 public StringXMLBeanInfo() {
55 }
56
57 /***
58 * @see com.teamkonzept.dom4jb.beans.XMLBeanInfo#getContentDescriptors()
59 */
60 public GroupDescriptor getContentDescriptors() {
61 return CONTENT_DESCRIPTOR;
62 }
63
64 /***
65 * @see com.teamkonzept.dom4jb.beans.XMLBeanInfo#getDataDescriptor()
66 */
67 public DataDescriptor getDataDescriptor() {
68 return DATA_DESCRIPTOR;
69 }
70 }
This page was automatically generated by Maven