public class JibxMarshaller extends AbstractMarshaller implements InitializingBean
Marshaller
および Unmarshaller
インターフェースの実装。 典型的な使用箇所は、この Bean で targetClass
およびオプションで bindingName
プロパティを設定することです。
IMarshallingContext
, IUnmarshallingContext
logger
コンストラクターと説明 |
---|
JibxMarshaller() |
修飾子と型 | メソッドと説明 |
---|---|
void | afterPropertiesSet() |
XmlMappingException | convertJibxException(org.jibx.runtime.JiBXException ex, boolean marshalling) 指定された JiBXException を org.springframework.oxm 階層からの適切な例外に変換します。 |
protected org.jibx.runtime.IMarshallingContext | createMarshallingContext() 正しいインデントで構成された新しい IMarshallingContext を作成します。 |
protected org.jibx.runtime.IUnmarshallingContext | createUnmarshallingContext() 新しい IUnmarshallingContext を作成します。 |
protected java.lang.String | getDefaultEncoding() バイトストリームからのマーシャリングまたはアンマーシャリングに使用するデフォルトエンコーディングを決定します。存在しない場合は null を決定します。 |
protected void | marshalDomNode(java.lang.Object graph, org.w3c.dom.Node node) 指定されたオブジェクトグラフを DOM Node にマーシャリングする抽象テンプレートメソッド。 |
protected void | marshalOutputStream(java.lang.Object graph, java.io.OutputStream outputStream) 指定されたオブジェクトグラフを OutputStream にマーシャリングする抽象テンプレートメソッド。 |
protected void | marshalSaxHandlers(java.lang.Object graph, org.xml.sax.ContentHandler contentHandler, org.xml.sax.ext.LexicalHandler lexicalHandler) 指定されたオブジェクトグラフを SAX ContentHandler にマーシャリングする抽象テンプレートメソッド。 |
protected void | marshalWriter(java.lang.Object graph, java.io.Writer writer) 指定されたオブジェクトグラフを Writer にマーシャリングする抽象テンプレートメソッド。 |
protected void | marshalXmlEventWriter(java.lang.Object graph, javax.xml.stream.XMLEventWriter eventWriter) 指定されたオブジェクトを StAX XMLEventWriter にマーシャリングする抽象テンプレートメソッド。 |
protected void | marshalXmlStreamWriter(java.lang.Object graph, javax.xml.stream.XMLStreamWriter streamWriter) 指定されたオブジェクトを StAX XMLStreamWriter にマーシャリングする抽象テンプレートメソッド。 |
void | setBindingName(java.lang.String bindingName) このインスタンスのオプションのバインディング名を設定します。 |
void | setDocTypeInternalSubset(java.lang.String docTypeInternalSubset) マーシャリング時に書き込まれる DTD 宣言の内部サブセット ID を設定します。 |
void | setDocTypePublicId(java.lang.String docTypePublicId) マーシャリング時に書き込まれる DTD 宣言のパブリック ID を設定します。 |
void | setDocTypeRootElementName(java.lang.String docTypeRootElementName) マーシャリング時に書き込まれる DTD 宣言のルート要素名を設定します。 |
void | setDocTypeSystemId(java.lang.String docTypeSystemId) マーシャリング時に書き込まれる DTD 宣言のシステム ID を設定します。 |
void | setEncoding(java.lang.String encoding) マーシャリングに使用するドキュメントエンコーディングを設定します。 |
void | setIndent(int indent) ネストするインデントスペースの数を設定します。 |
void | setStandalone(java.lang.Boolean standalone) マーシャリング用にドキュメントのスタンドアロンフラグを設定します。 |
void | setTargetClass(java.lang.Class<?> targetClass) このインスタンスのターゲットクラスを設定します。 |
void | setTargetPackage(java.lang.String targetPackage) このインスタンスのターゲットパッケージを設定します。 |
boolean | supports(java.lang.Class<?> clazz) このマーシャラーが、指定された型のインスタンスをマーシャリングできるかどうかを示します。 |
protected java.lang.Object | unmarshalDomNode(org.w3c.dom.Node node) 指定された DOM Node から非整列化するための抽象テンプレートメソッド。 |
protected java.lang.Object | unmarshalInputStream(java.io.InputStream inputStream) 指定された InputStream から非整列化するための抽象テンプレートメソッド。 |
protected java.lang.Object | unmarshalReader(java.io.Reader reader) 指定された Reader から非整列化するための抽象テンプレートメソッド。 |
protected java.lang.Object | unmarshalSaxReader(org.xml.sax.XMLReader xmlReader, org.xml.sax.InputSource inputSource) 特定の SAX XMLReader および InputSource を使用して非整列化するための抽象テンプレートメソッド。 |
protected java.lang.Object | unmarshalXmlEventReader(javax.xml.stream.XMLEventReader eventReader) 指定された Stax XMLEventReader から非整列化するための抽象テンプレートメソッド。 |
protected java.lang.Object | unmarshalXmlStreamReader(javax.xml.stream.XMLStreamReader streamReader) 指定された Stax XMLStreamReader から非整列化するための抽象テンプレートメソッド。 |
buildDocument, createDocumentBuilder, createDocumentBuilderFactory, createXmlReader, isProcessExternalEntities, isSupportDtd, marshal, marshalDomResult, marshalSaxResult, marshalStaxResult, marshalStreamResult, setProcessExternalEntities, setSupportDtd, unmarshal, unmarshalDomSource, unmarshalSaxSource, unmarshalStaxSource, unmarshalStreamSource
public void setTargetClass(java.lang.Class<?> targetClass)
targetPackage
プロパティのいずれかを設定する必要があります。 このプロパティが設定されている場合、targetPackage
は無視されます。
public void setTargetPackage(java.lang.String targetPackage)
targetClass
プロパティのいずれかを設定する必要があります。targetClass
が設定されている場合、このプロパティは無視されます。
public void setBindingName(java.lang.String bindingName)
public void setIndent(int indent)
-1
です。つまり、インデントはありません。public void setEncoding(java.lang.String encoding)
protected java.lang.String getDefaultEncoding()
AbstractMarshaller
null
を決定します。 デフォルトの実装は null
を返します。
AbstractMarshaller
の getDefaultEncoding
public void setStandalone(java.lang.Boolean standalone)
public void setDocTypeRootElementName(java.lang.String docTypeRootElementName)
null
です(つまり、DTD 宣言は記述されていません)。値に設定する場合は、システム ID またはパブリック ID も設定する必要があります。
public void setDocTypeSystemId(java.lang.String docTypeSystemId)
null
です。ルート要素も設定されている場合にのみ使用されます。 このプロパティまたは docTypePublicId
のいずれかを設定します。両方を設定することはできません。
public void setDocTypePublicId(java.lang.String docTypePublicId)
null
です。ルート要素も設定されている場合にのみ使用されます。 このプロパティまたは docTypeSystemId
のいずれかを設定します。両方を設定することはできません。
public void setDocTypeInternalSubset(java.lang.String docTypeInternalSubset)
null
です。ルート要素も設定されている場合にのみ使用されます。public void afterPropertiesSet() throws org.jibx.runtime.JiBXException
InitializingBean
BeanFactoryAware
、ApplicationContextAware
などを満たした後、包含 BeanFactory
によって呼び出されます。このメソッドにより、Bean インスタンスは、すべての Bean プロパティが設定されたときに、その全体的な構成の検証と最終的な初期化を実行できます。
InitializingBean
の afterPropertiesSet
org.jibx.runtime.JiBXException
public boolean supports(java.lang.Class<?> clazz)
Marshaller
Marshaller
の supports
Unmarshaller
の supports
clazz
- このマーシャラーがマーシャリングできるかどうか尋ねられているクラス true
。それ以外の場合は false
protected void marshalOutputStream(java.lang.Object graph, java.io.OutputStream outputStream) throws XmlMappingException, java.io.IOException
AbstractMarshaller
OutputStream
にマーシャリングする抽象テンプレートメソッド。AbstractMarshaller
の marshalOutputStream
graph
- マーシャリングするオブジェクトグラフのルート outputStream
- 書き込む OutputStream
XmlMappingException
- 指定されたオブジェクトをライターにマーシャリングできない場合 java.io.IOException
- I/O 例外が発生した場合 protected void marshalWriter(java.lang.Object graph, java.io.Writer writer) throws XmlMappingException, java.io.IOException
AbstractMarshaller
Writer
にマーシャリングする抽象テンプレートメソッド。AbstractMarshaller
の marshalWriter
graph
- マーシャリングするオブジェクトグラフのルート writer
- 書き込む Writer
XmlMappingException
- 指定されたオブジェクトをライターにマーシャリングできない場合 java.io.IOException
- I/O 例外が発生した場合 protected void marshalDomNode(java.lang.Object graph, org.w3c.dom.Node node) throws XmlMappingException
AbstractMarshaller
Node
にマーシャリングする抽象テンプレートメソッド。 実際には、ノードは Document
ノード、DocumentFragment
ノード、Element
ノードです。つまり、子を受け入れるノードです。
AbstractMarshaller
の marshalDomNode
graph
- マーシャリングするオブジェクトグラフのルート node
- 結果ツリーを含む DOM ノード XmlMappingException
- 指定されたオブジェクトを DOM ノードに整列化できない場合 Document
、DocumentFragment
、Element
protected void marshalXmlEventWriter(java.lang.Object graph, javax.xml.stream.XMLEventWriter eventWriter)
AbstractMarshaller
XMLEventWriter
にマーシャリングする抽象テンプレートメソッド。AbstractMarshaller
の marshalXmlEventWriter
graph
- マーシャリングするオブジェクトグラフのルート eventWriter
- 書き込む XMLEventWriter
protected void marshalXmlStreamWriter(java.lang.Object graph, javax.xml.stream.XMLStreamWriter streamWriter) throws XmlMappingException
AbstractMarshaller
XMLStreamWriter
にマーシャリングする抽象テンプレートメソッド。AbstractMarshaller
の marshalXmlStreamWriter
graph
- マーシャリングするオブジェクトグラフのルート streamWriter
- 書き込む XMLStreamWriter
XmlMappingException
- 指定されたオブジェクトを DOM ノードに整列化できない場合 protected void marshalSaxHandlers(java.lang.Object graph, org.xml.sax.ContentHandler contentHandler, @Nullable org.xml.sax.ext.LexicalHandler lexicalHandler) throws XmlMappingException
AbstractMarshaller
ContentHandler
にマーシャリングする抽象テンプレートメソッド。AbstractMarshaller
の marshalSaxHandlers
graph
- マーシャリングするオブジェクトグラフのルート contentHandler
- SAX ContentHandler
lexicalHandler
- SAX2 LexicalHandler
null
にすることができます。XmlMappingException
- 指定されたオブジェクトをハンドラーにマーシャリングできない場合 protected java.lang.Object unmarshalXmlEventReader(javax.xml.stream.XMLEventReader eventReader)
AbstractMarshaller
XMLEventReader
から非整列化するための抽象テンプレートメソッド。AbstractMarshaller
の unmarshalXmlEventReader
eventReader
- 読み込む XMLEventReader
protected java.lang.Object unmarshalXmlStreamReader(javax.xml.stream.XMLStreamReader streamReader)
AbstractMarshaller
XMLStreamReader
から非整列化するための抽象テンプレートメソッド。AbstractMarshaller
の unmarshalXmlStreamReader
streamReader
- 読み込む XMLStreamReader
protected java.lang.Object unmarshalInputStream(java.io.InputStream inputStream) throws XmlMappingException, java.io.IOException
AbstractMarshaller
InputStream
から非整列化するための抽象テンプレートメソッド。AbstractMarshaller
の unmarshalInputStream
inputStream
- 読み込む InputStreamStream
XmlMappingException
- 指定されたストリームをオブジェクトに変換できない場合 java.io.IOException
- I/O 例外が発生した場合 protected java.lang.Object unmarshalReader(java.io.Reader reader) throws XmlMappingException, java.io.IOException
AbstractMarshaller
Reader
から非整列化するための抽象テンプレートメソッド。AbstractMarshaller
の unmarshalReader
reader
- 読み込む Reader
XmlMappingException
- 指定されたリーダーをオブジェクトに変換できない場合 java.io.IOException
- I/O 例外が発生した場合 protected java.lang.Object unmarshalDomNode(org.w3c.dom.Node node) throws XmlMappingException
AbstractMarshaller
Node
から非整列化するための抽象テンプレートメソッド。AbstractMarshaller
の unmarshalDomNode
node
- 非整列化するオブジェクトを含む DOM ノード XmlMappingException
- 指定された DOM ノードをオブジェクトにマップできない場合 protected java.lang.Object unmarshalSaxReader(org.xml.sax.XMLReader xmlReader, org.xml.sax.InputSource inputSource) throws XmlMappingException, java.io.IOException
AbstractMarshaller
XMLReader
および InputSource
を使用して非整列化するための抽象テンプレートメソッド。AbstractMarshaller
の unmarshalSaxReader
xmlReader
- 解析する SAX XMLReader
inputSource
- 解析する入力ソース XmlMappingException
- 指定されたリーダーと入力ソースをオブジェクトに変換できない場合 java.io.IOException
- I/O 例外が発生した場合 protected org.jibx.runtime.IMarshallingContext createMarshallingContext() throws org.jibx.runtime.JiBXException
IMarshallingContext
を作成します。org.jibx.runtime.JiBXException
- エラーの場合 protected org.jibx.runtime.IUnmarshallingContext createUnmarshallingContext() throws org.jibx.runtime.JiBXException
IUnmarshallingContext
を作成します。org.jibx.runtime.JiBXException
- エラーの場合 public XmlMappingException convertJibxException(org.jibx.runtime.JiBXException ex, boolean marshalling)
JiBXException
を org.springframework.oxm
階層からの適切な例外に変換します。JiBX 自体は例外階層でこの区別を行わないため、ブール化フラグを使用して、この例外がマーシャリング中に発生するかアンマーシャリング中に発生するかを示します。
ex
- 発生した JiBXException
marshalling
- マーシャリング中に例外が発生するか(true
)、アンマーシャリングするかを示します (false
)XmlMappingException