|
|||||||||||||||||||
This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
XmlCode.java | 100% | 85,7% | 75% | 84,6% |
|
1 |
/* |
|
2 |
* JBind |
|
3 |
* |
|
4 |
* Copyright (c) by Stefan Wachter. All rights reserved. |
|
5 |
* |
|
6 |
* Usage, modification, and redistribution is subject to license terms that are |
|
7 |
* available at 'http://www.jbind.org'. The JBind license is like the |
|
8 |
* 'Apache Software License V 1.1'. |
|
9 |
*/ |
|
10 |
package org.jbind.xml.facade; |
|
11 |
|
|
12 |
import java.net.URL; |
|
13 |
|
|
14 |
import org.jbind.xml.code.IXmlCode; |
|
15 |
import org.jbind.xml.core.data.IAnyTypeData; |
|
16 |
import org.jbind.xml.core.data.IDataContext; |
|
17 |
import org.jbind.xml.msg.XmlException; |
|
18 |
import org.xml.sax.InputSource; |
|
19 |
|
|
20 |
public class XmlCode implements IXmlCode { |
|
21 |
|
|
22 |
private InputSource myInputSource = null; |
|
23 |
private IDataContext myDataContext = null; |
|
24 |
|
|
25 |
private IAnyTypeData myCode = null; |
|
26 |
|
|
27 | 1 |
public XmlCode(InputSource anInputSource, IDataContext aContext) { |
28 | 1 |
myInputSource = anInputSource; |
29 | 1 |
myDataContext = aContext; |
30 |
} |
|
31 |
|
|
32 | 1 |
public XmlCode(URL aUrl, IDataContext aContext) { |
33 | 1 |
this(new InputSource(aUrl.toString()), aContext); |
34 |
} |
|
35 |
|
|
36 | 0 |
public String getUrl() { |
37 | 0 |
return myInputSource.getSystemId(); |
38 |
} |
|
39 |
|
|
40 | 4 |
public IAnyTypeData getCode() throws XmlException { |
41 | 4 |
if (null == myCode) { |
42 | 1 |
myCode = JBindFacade.unmarshal(myInputSource, myDataContext); |
43 |
} |
|
44 | 4 |
return myCode; |
45 |
} |
|
46 |
|
|
47 |
} |
|
48 |
|
|