View Javadoc

1   /*
2    * Common Library for TBAS Softwares
3    * Language: Java
4    *
5    * All Rights Reserved.
6    * (c) Copyright 2002 by Tsukuba Bunko.
7    *
8    * $Id: BasicDeserializer.java,v 1.1 2005/07/11 12:49:18 ppoi Exp $
9    */
10  package tsukuba_bunko.resource;
11  
12  import	org.xml.sax.Attributes;
13  import	org.xml.sax.Locator;
14  import	org.xml.sax.ContentHandler;
15  import	org.xml.sax.SAXException;
16  
17  
18  /***
19   * 基本的な <code>ResourceDeserializer</code> の実装を提供します.
20   * なお,この実装では何の処理も行いません.
21   * @author	$Author
22   */
23  public class BasicDeserializer	implements ResourceDeserializer, ContentHandler	{
24  
25  	/***
26  	 * デシリアライズされたオブジェクト
27  	 */
28  	protected Object	_deserializedValue = null;
29  
30  	/***
31  	 * リソースの解析に使用する DeserializerMapping
32  	 */
33  	protected DeserializerMapping	_mapping = null;
34  
35  	/***
36  	 * この ResourceDeserializer が関連づけられたデータ型名
37  	 */
38  	protected String	_typeName;
39  
40  
41  	/***
42  	 * <code>BasicDeserializer</code> のインスタンスを作成します。
43  	 */
44  	public BasicDeserializer()
45  	{
46  		super();
47  	}
48  
49  
50  	/***
51  	 * この <code>ResourceDeserializer</code> が関連づけられたデータ型名を取得します。
52  	 * @return	データ型名
53  	 */
54  	protected String getTypeName()
55  	{
56  		return _typeName;
57  	}
58  
59  	/***
60  	 * 使用する <code>DeserializerMapping</code> を取得します.
61  	 * @return <code>DeserializerMapping</code>
62  	 */
63  	protected DeserializerMapping getDeserializerMapping()
64  	{
65  		return _mapping;
66  	}
67  
68  	/***
69  	 * デシリアライズ結果を設定します.
70  	 * @param	value	デシリアライズ結果
71  	 */
72  	protected void setValue( Object value )
73  	{
74  		_deserializedValue = value;
75  	}
76  
77  
78  //
79  //	ResourceDeserializer の実装
80  //
81  	public void setTypeName( String typeName )
82  	{
83  		_typeName = typeName;
84  	}
85  
86  	public void setDeserializerMapping( DeserializerMapping mapping )
87  	{
88  		_mapping = mapping;
89  	}
90  
91  	public Object getValue()
92  	{
93  		return _deserializedValue;
94  	}
95  
96  
97  //
98  //	ContentHandler の実装
99  //
100 	/***
101 	 * @see	org.xml.sax.ContentHandler
102 	 */
103 	public void setDocumentLocator( Locator locator )
104 	{
105 	}
106 
107 	/***
108 	 * @see	org.xml.sax.ContentHandler
109 	 */
110 	public void startPrefixMapping( String namespaceURI, String prefix )
111 		throws SAXException
112 	{
113 	}
114 
115 	/***
116 	 * @see	org.xml.sax.ContentHandler
117 	 */
118 	public void endPrefixMapping( String namespaceURI )
119 		throws SAXException
120 	{
121 	}
122 
123 	/***
124 	 * @see	org.xml.sax.ContentHandler
125 	 */
126 	public void startDocument()
127 		throws SAXException
128 	{
129 	}
130 
131 	/***
132 	 * @see	org.xml.sax.ContentHandler
133 	 */
134 	public void endDocument()
135 		throws SAXException
136 	{
137 	}
138 
139 	/***
140 	 * @see	org.xml.sax.ContentHandler
141 	 */
142 	public void startElement( String namespaceURI, String localName, String qName, Attributes attrs )
143 		throws SAXException
144 	{
145 	}
146 
147 	/***
148 	 * @see	org.xml.sax.ContentHandler
149 	 */
150 	public void endElement( String namespaceURI, String localName, String qName )
151 		throws SAXException
152 	{
153 	}
154 
155 	/***
156 	 * @see	org.xml.sax.ContentHandler
157 	 */
158 	public void processingInstruction( String target, String data )
159 		throws SAXException
160 	{
161 	}
162 
163 	/***
164 	 * @see	org.xml.sax.ContentHandler
165 	 */
166 	public void skippedEntity( String name )
167 		throws SAXException
168 	{
169 	}
170 
171 	/***
172 	 * @see	org.xml.sax.ContentHandler
173 	 */
174 	public void characters( char[] ch, int begin, int length )
175 		throws SAXException
176 	{
177 	}
178 
179 	/***
180 	 * @see	org.xml.sax.ContentHandler
181 	 */
182 	public void ignorableWhitespace( char[] ch, int begin, int length )
183 		throws SAXException
184 	{
185 	}
186 }