KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > xmi > impl > XMLInfoImpl


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2002-2004 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: XMLInfoImpl.java,v 1.2 2005/06/08 06:16:07 nickb Exp $
16  */

17 package org.eclipse.emf.ecore.xmi.impl;
18
19 import org.eclipse.emf.ecore.xmi.XMLResource;
20
21 /**
22  * This class is used with the XMLMap class to describe how
23  * to serialize objects and features. You can specify the name
24  * to use instead of the model name, whether a feature will be
25  * serialized as an XML attribute, XML element, or XML content,
26  * and whether to use a namespace when serializing an object.
27  * <p>
28  * The XMLMap class maintains the association between XMLInfo
29  * objects and the ecore constructs they describe.
30  */

31 public class XMLInfoImpl implements XMLResource.XMLInfo
32 {
33   protected int xmlRepresentation;
34   protected String JavaDoc targetNamespace;
35   protected String JavaDoc name;
36   
37   public XMLInfoImpl()
38   {
39     xmlRepresentation = UNSPECIFIED;
40   }
41   
42   /**
43    * Returns ELEMENT if the Ecore construct is to be serialized
44    * as an XML element; ATTRIBUTE if the Ecore construct is
45    * to be serialized as an XML attribute; and CONTENT if the
46    * Ecore construct is to be serialized in element content.
47    * By default, the value is UNSPECIFIED.
48    */

49   public int getXMLRepresentation()
50   {
51     return xmlRepresentation;
52   }
53
54   /**
55    * Set attribute to true to serialize a feature as an
56    * XML attribute.
57    */

58   public void setXMLRepresentation(int representation)
59   {
60     xmlRepresentation = representation;
61   }
62   
63   public String JavaDoc getTargetNamespace()
64   {
65     return targetNamespace;
66   }
67   
68   public void setTargetNamespace(String JavaDoc namespaceURI)
69   {
70     targetNamespace = namespaceURI;
71   }
72   
73   /**
74    * Returns the name to use for the Ecore construct in an
75    * XML file.
76    */

77   public String JavaDoc getName()
78   {
79     return name;
80   }
81   
82   /**
83    * Set the name to be used in an XML file.
84    */

85   public void setName(String JavaDoc name)
86   {
87     this.name = name;
88   }
89 }
90
Popular Tags