Coverage report

| %line | %branch
--- | --- | ---
tsukuba_bunko.resource.SimpleDeserializer |
100% |
100% |

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: SimpleDeserializer.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.SAXException;
14 |  |
15 |  |
16 |  |
     /**
17 |  |
      * 階層構造を持たない，シンプルな値のデシリアライズを行う <code>ResourceDeserializer</code> です.
18 |  |
      * @author	$Author
19 |  |
      */
20 |  |
     public abstract class SimpleDeserializer extends BasicDeserializer	{
21 |  |
22 |  |
     	/**
23 |  |
     	 * テキストバッファ
24 |  |
     	 */
25 | 560 |
     	protected StringBuffer	_text = null;
26 |  |
27 |  |
28 |  |
     	/**
29 |  |
     	 * <code>SimpleDeserializer</code> のインスタンスを作成します.
30 |  |
     	 */
31 |  |
     	protected SimpleDeserializer()
32 |  |
     	{
33 | 560 |
     		super();
34 | 560 |
     	}
35 |  |
36 |  |
     	/**
37 |  |
     	 * 文字列から適切な型のオブジェクトへ変換します.
38 |  |
     	 * @param	source	変換元の文字列
39 |  |
     	 * @return	変換結果
40 |  |
     	 * @exception	SAXException	変換に失敗した場合
41 |  |
     	 */
42 |  |
     	protected abstract Object convertValue( String source )
43 |  |
     		throws SAXException;
44 |  |
45 |  |
46 |  |
     //
47 |  |
     //	ContentHandler の実装
48 |  |
     //
49 |  |
     	public void startElement( String namespaceURI, String localName, String qName, Attributes attrs )
50 |  |
     		throws SAXException
51 |  |
     	{
52 | 175 |
     		if( _text == null )	{
53 | 160 |
     			_text = new StringBuffer();
54 | 160 |
     		}
55 |  |
     		else	{
56 | 15 |
     			throw new SAXException( "illegal structure.(nested element was illegal structure)" );
57 |  |
     		}
58 | 160 |
     	}
59 |  |
60 |  |
     	public void endElement( String namespaceURI, String localName, String qName )
61 |  |
     		throws SAXException
62 |  |
     	{
63 | 150 |
     		setValue( convertValue(new String(_text)) );
64 | 140 |
     		_text = null;
65 | 140 |
     	}
66 |  |
67 |  |
     	public void characters( char[] ch, int begin, class="keyword">int length )
68 |  |
     	{
69 | 165 |
     		if( _text != null )	{
70 | 165 |
     			_text.append( ch, begin, length );
71 |  |
     		}
72 | 165 |
     	}
73 |  |
     }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.