View Javadoc
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.CollectionAdapter; 21 import com.teamkonzept.dom4jb.schema.GroupDescriptor; 22 23 /*** 24 * This is the default XMLBeanInfo defining how a collection will be 25 * represented. 26 * <p> 27 * Every java.util.Collection object will be represented as follows: 28 * <p> 29 * <ul> 30 * <li>the element content is a collection of elements. Each element is named 31 * by the name returned by the getItemName() method of the corresponding 32 * XMLBeanInfo object. Also the item itself is represened by means of the 33 * corresponding XMLBeanInfo object. 34 * <p> 35 * Example: A collection of integer-objects will be represented like this: 36 * <p> 37 * <items> <item>1</item> <item>2</item> 38 * <item>3</item> </items> 39 * <p> 40 * whereby the sourrounding element <items> may differ. 41 * </li> 42 * <li>as empty attribute value</li> 43 * <li>which contributes no attributes</li> 44 * <li>if the object is an item in a collection, the surrounding element name 45 * is the item name specified by COLLECTION_ITEM_NAME</li> 46 * </ul> 47 * 48 * @author <a href="mailto:carsten.krebs@team-konzept.de">Carsten Krebs</a> 49 * @version $Revision: 1.2 $ 50 * 51 * @see #COLLECTION_ITEM_NAME 52 * 53 */ 54 public class CollectionXMLBeanInfo extends ObjectXMLBeanInfo { 55 56 /*** 57 * the item name, returned by getItemName(). 58 * @see #getItemName() 59 */ 60 public static final String COLLECTION_ITEM_NAME = "items"; 61 62 private static final CollectionAdapter CONTENT_DESCRIPTOR = 63 new CollectionAdapter((String) null); 64 65 /*** Creates new CollectionXMLBeanInfo */ 66 public CollectionXMLBeanInfo() { 67 /* NOP */ 68 } 69 70 /*** 71 * @see com.teamkonzept.dom4jb.beans.XMLBeanInfo#getContentDescriptors() 72 */ 73 public GroupDescriptor getContentDescriptors() { 74 return CONTENT_DESCRIPTOR; 75 } 76 77 /*** 78 * @see com.teamkonzept.dom4jb.beans.XMLBeanInfo#getItemName() 79 */ 80 public String getItemName() { 81 return CollectionXMLBeanInfo.COLLECTION_ITEM_NAME; 82 } 83 }

This page was automatically generated by Maven