|
JavaTM Platform Standard Ed. 6 |
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Object javax.xml.bind.helpers.AbstractUnmarshallerImpl
public abstract class AbstractUnmarshallerImpl
部分的なデフォルト Unmarshaller 実装です。
このクラスは、Unmarshaller
インタフェースの部分的なデフォルト実装を提供します。
JAXB プロバイダは、getUnmarshallerHandler、unmarshal(Node)、unmarshal(XMLReader,InputSource)、unmarshal(XMLStreamReader)、および unmarshal(XMLEventReader) の 5 つのメソッドを実装する必要があります 。
Unmarshaller
入れ子のクラスの概要 |
---|
インタフェース javax.xml.bind.Unmarshaller から継承された入れ子のクラス/インタフェース |
---|
Unmarshaller.Listener |
フィールドの概要 | |
---|---|
protected boolean |
validating
unmarshaller が検証を行うかどうかを示します。 |
コンストラクタの概要 | |
---|---|
AbstractUnmarshallerImpl()
|
メソッドの概要 | ||
---|---|---|
protected UnmarshalException |
createUnmarshalException(SAXException e)
SAXException から UnmarshalException を作成します。 |
|
|
getAdapter(Class<A> type)
Gets the adapter associated with the specified type. |
|
AttachmentUnmarshaller |
getAttachmentUnmarshaller()
|
|
ValidationEventHandler |
getEventHandler()
現在のイベントハンドラ、または、それが設定されていない場合はデフォルトイベントハンドラを返します。 |
|
Unmarshaller.Listener |
getListener()
|
|
Object |
getProperty(String name)
必要なプロパティーがないため、getProperty メソッドのデフォルト実装は常に、PropertyException をスローします。 |
|
Schema |
getSchema()
Get the JAXP 1.3 Schema object
being used to perform unmarshal-time validation. |
|
protected XMLReader |
getXMLReader()
設定された XMLReader を取得します。 |
|
boolean |
isValidating()
Unmarshaller が非整列化操作中に検証を行うように設定されているかどうかを示します。 |
|
|
setAdapter(Class<A> type,
A adapter)
Associates a configured instance of XmlAdapter with this unmarshaller. |
|
void |
setAdapter(XmlAdapter adapter)
Associates a configured instance of XmlAdapter with this unmarshaller. |
|
void |
setAttachmentUnmarshaller(AttachmentUnmarshaller au)
|
|
void |
setEventHandler(ValidationEventHandler handler)
アプリケーションで検証イベントハンドラを登録できるようにします。 |
|
void |
setListener(Unmarshaller.Listener listener)
Register unmarshal event callback Unmarshaller.Listener with this Unmarshaller . |
|
void |
setProperty(String name,
Object value)
必要なプロパティーがないため、setProperty メソッドのデフォルト実装は常に、PropertyException をスローします。 |
|
void |
setSchema(Schema schema)
Specify the JAXP 1.3 Schema
object that should be used to validate subsequent unmarshal operations
against. |
|
void |
setValidating(boolean validating)
Unmarshaller が非整列化操作中に検証を行うかどうかを指定します。 |
|
Object |
unmarshal(File f)
Unmarshal XML data from the specified file and return the resulting content tree. |
|
Object |
unmarshal(InputSource source)
Unmarshal XML data from the specified SAX InputSource and return the resulting content tree. |
|
Object |
unmarshal(InputStream is)
Unmarshal XML data from the specified InputStream and return the resulting content tree. |
|
|
unmarshal(Node node,
Class<T> expectedType)
Unmarshal XML data by JAXB mapped declaredType and return the resulting content tree. |
|
Object |
unmarshal(Reader reader)
Unmarshal XML data from the specified Reader and return the resulting content tree. |
|
Object |
unmarshal(Source source)
Unmarshal XML data from the specified XML Source and return the resulting content tree. |
|
|
unmarshal(Source source,
Class<T> expectedType)
Unmarshal XML data from the specified XML Source by declaredType and return the resulting content tree. |
|
Object |
unmarshal(URL url)
Unmarshal XML data from the specified URL and return the resulting content tree. |
|
Object |
unmarshal(XMLEventReader reader)
Unmarshal XML data from the specified pull parser and return the resulting content tree. |
|
|
unmarshal(XMLEventReader reader,
Class<T> expectedType)
Unmarshal root element to JAXB mapped declaredType and return the resulting content tree. |
|
protected abstract Object |
unmarshal(XMLReader reader,
InputSource source)
指定した XMLReader と InputSource を使用して、オブジェクトを非整列化します。 |
|
Object |
unmarshal(XMLStreamReader reader)
Unmarshal XML data from the specified pull parser and return the resulting content tree. |
|
|
unmarshal(XMLStreamReader reader,
Class<T> expectedType)
Unmarshal root element to JAXB mapped declaredType and return the resulting content tree. |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
インタフェース javax.xml.bind.Unmarshaller から継承されたメソッド |
---|
getUnmarshallerHandler, unmarshal |
フィールドの詳細 |
---|
protected boolean validating
コンストラクタの詳細 |
---|
public AbstractUnmarshallerImpl()
メソッドの詳細 |
---|
protected XMLReader getXMLReader() throws JAXBException
SAXSource
オブジェクトに XMLReader がない場合に使用されます。
Unmarshaller
は再入不可能なため、XMLReader の単一のインスタンスのみが使用されます。
JAXBException
public Object unmarshal(Source source) throws JAXBException
Unmarshaller
の記述:Implements Unmarshal Global Root Element.
A client application can choose not to use the default parser mechanism supplied with their JAXB provider. Any SAX 2.0 compliant parser can be substituted for the JAXB provider's default mechanism. To do so, the client application must properly configure a SAXSource containing an XMLReader implemented by the SAX 2.0 parser provider. If the XMLReader has an org.xml.sax.ErrorHandler registered on it, it will be replaced by the JAXB Provider so that validation errors can be reported via the ValidationEventHandler mechanism of JAXB. If the SAXSource does not contain an XMLReader, then the JAXB provider's default parser mechanism will be used.
This parser replacement mechanism can also be used to replace the JAXB provider's unmarshal-time validation engine. The client application must properly configure their SAX 2.0 compliant parser to perform validation (as shown in the example above). Any SAXParserExceptions encountered by the parser during the unmarshal operation will be processed by the JAXB provider and converted into JAXB ValidationEvent objects which will be reported back to the client via the ValidationEventHandler registered with the Unmarshaller. Note: specifying a substitute validating SAX 2.0 parser for unmarshalling does not necessarily replace the validation engine used by the JAXB provider for performing on-demand validation.
The only way for a client application to specify an alternate parser mechanism to be used during unmarshal is via the unmarshal(SAXSource) API. All other forms of the unmarshal method (File, URL, Node, etc) will use the JAXB provider's default parser and validator mechanisms.
Unmarshaller
内の unmarshal
source
- the XML Source to unmarshal XML data from (providers are only required to support SAXSource, DOMSource, and StreamSource)
JAXBException
- If any unexpected errors occur while unmarshalling
UnmarshalException
- If the ValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML DataUnmarshaller.unmarshal(javax.xml.transform.Source, Class)
protected abstract Object unmarshal(XMLReader reader, InputSource source) throws JAXBException
JAXBException
public final Object unmarshal(InputSource source) throws JAXBException
Unmarshaller
の記述:Implements Unmarshal Global Root Element.
Unmarshaller
内の unmarshal
source
- the input source to unmarshal XML data from
JAXBException
- If any unexpected errors occur while unmarshalling
UnmarshalException
- If the ValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Datapublic final Object unmarshal(URL url) throws JAXBException
Unmarshaller
の記述:Implements Unmarshal Global Root Element.
Unmarshaller
内の unmarshal
url
- the url to unmarshal XML data from
JAXBException
- If any unexpected errors occur while unmarshalling
UnmarshalException
- If the ValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Datapublic final Object unmarshal(File f) throws JAXBException
Unmarshaller
の記述:Implements Unmarshal Global Root Element.
Unmarshaller
内の unmarshal
f
- the file to unmarshal XML data from
JAXBException
- If any unexpected errors occur while unmarshalling
UnmarshalException
- If the ValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Datapublic final Object unmarshal(InputStream is) throws JAXBException
Unmarshaller
の記述:Implements Unmarshal Global Root Element.
Unmarshaller
内の unmarshal
is
- the InputStream to unmarshal XML data from
JAXBException
- If any unexpected errors occur while unmarshalling
UnmarshalException
- If the ValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Datapublic final Object unmarshal(Reader reader) throws JAXBException
Unmarshaller
の記述:Implements Unmarshal Global Root Element.
Unmarshaller
内の unmarshal
reader
- the Reader to unmarshal XML data from
JAXBException
- If any unexpected errors occur while unmarshalling
UnmarshalException
- If the ValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Datapublic boolean isValidating() throws JAXBException
注: getValidating() に対して、JAXP に合わせて isValidating() というメソッド名にしました。
Unmarshaller
内の isValidating
JAXBException
- 検証フラグの取得中にエラーが発生した場合public void setEventHandler(ValidationEventHandler handler) throws JAXBException
検証イベントハンドラは、いずれかの unmarshal メソッドを呼び出している途中で検証エラーが発生した場合、JAXB プロバイダによって呼び出されます。非整列化メソッドを呼び出す前に、クライアントアプリケーションが検証イベントハンドラを登録しなかった場合、すべての検証イベントは通知されることなく無視され、予想外の動作を引き起こす可能性があります。
Unmarshaller
内の setEventHandler
handler
- 検証イベントハンドラ
JAXBException
- イベントハンドラの設定中にエラーが発生した場合public void setValidating(boolean validating) throws JAXBException
このメソッドは、非整列化メソッドのいずれかを呼び出す前、または呼び出したあとにのみ、呼び出すことができます。
Unmarshaller
内の setValidating
validating
- Unmarshaller が非整列化中に検証を行うようにする場合は true、それ以外の場合は false
JAXBException
- 非整列化時の検証を有効または無効にしている途中でエラーが発生した場合public ValidationEventHandler getEventHandler() throws JAXBException
Unmarshaller
内の getEventHandler
JAXBException
- 現在のイベントハンドラの取得中にエラーが発生した場合protected UnmarshalException createUnmarshalException(SAXException e)
プロバイダが実装した ContentHandler が JAXBException をスローすることを望む場合、SAXException によってその例外をラップする必要があります。unmarshaller 実装が JAXBException によって SAXException をやみくもにラップした場合、こうした例外がほかの JAXBException によってラップされた SAXException によってラップされた JAXBException になります。これは非常に無益です。
このメソッドは、SAXException の入れ子の例外をチェックし、こうした過剰なラップを排除します。
public void setProperty(String name, Object value) throws PropertyException
Unmarshaller
内の setProperty
name
- the name of the property to be set. This value can either be specified using one of the constant fields or a user supplied string.value
- the value of the property to be set
PropertyException
- when there is an error processing the given property or valuepublic Object getProperty(String name) throws PropertyException
Unmarshaller
内の getProperty
name
- the name of the property to retrieve
PropertyException
- when there is an error retrieving the given property or value property namepublic Object unmarshal(XMLEventReader reader) throws JAXBException
Unmarshaller
の記述:This method is an Unmarshal Global Root method.
This method assumes that the parser is on a START_DOCUMENT or START_ELEMENT event. Unmarshalling will be done from this start event to the corresponding end event. If this method returns successfully, the reader will be pointing at the token right after the end event.
Unmarshaller
内の unmarshal
reader
- The parser to be read.
JAXBException
- If any unexpected errors occur while unmarshalling
UnmarshalException
- If the ValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML DataUnmarshaller.unmarshal(javax.xml.stream.XMLEventReader, Class)
public Object unmarshal(XMLStreamReader reader) throws JAXBException
Unmarshaller
の記述:Implements Unmarshal Global Root Element.
This method assumes that the parser is on a START_DOCUMENT or START_ELEMENT event. Unmarshalling will be done from this start event to the corresponding end event. If this method returns successfully, the reader will be pointing at the token right after the end event.
Unmarshaller
内の unmarshal
reader
- The parser to be read.
JAXBException
- If any unexpected errors occur while unmarshalling
UnmarshalException
- If the ValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML DataUnmarshaller.unmarshal(javax.xml.stream.XMLStreamReader, Class)
public <T> JAXBElement<T> unmarshal(Node node, Class<T> expectedType) throws JAXBException
Unmarshaller
の記述:Implements Unmarshal by Declared Type
Unmarshaller
内の unmarshal
node
- the document/element to unmarshal XML data from. The caller must support at least Document and Element.expectedType
- appropriate JAXB mapped class to hold node's XML data.
JAXBException
- If any unexpected errors occur while unmarshalling
UnmarshalException
- If the ValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Datapublic <T> JAXBElement<T> unmarshal(Source source, Class<T> expectedType) throws JAXBException
Unmarshaller
の記述:Implements Unmarshal by Declared Type
See SAX 2.0 Parser Pluggability
Unmarshaller
内の unmarshal
source
- the XML Source to unmarshal XML data from (providers are only required to support SAXSource, DOMSource, and StreamSource)expectedType
- appropriate JAXB mapped class to hold source's xml root element
JAXBException
- If any unexpected errors occur while unmarshalling
UnmarshalException
- If the ValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Datapublic <T> JAXBElement<T> unmarshal(XMLStreamReader reader, Class<T> expectedType) throws JAXBException
Unmarshaller
の記述:This method implements unmarshal by declaredType.
This method assumes that the parser is on a START_DOCUMENT or START_ELEMENT event. Unmarshalling will be done from this start event to the corresponding end event. If this method returns successfully, the reader will be pointing at the token right after the end event.
Unmarshaller
内の unmarshal
reader
- The parser to be read.expectedType
- appropriate JAXB mapped class to hold reader's START_ELEMENT XML data.
JAXBException
- If any unexpected errors occur while unmarshalling
UnmarshalException
- If the ValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Datapublic <T> JAXBElement<T> unmarshal(XMLEventReader reader, Class<T> expectedType) throws JAXBException
Unmarshaller
の記述:This method implements unmarshal by declaredType.
This method assumes that the parser is on a START_DOCUMENT or START_ELEMENT event. Unmarshalling will be done from this start event to the corresponding end event. If this method returns successfully, the reader will be pointing at the token right after the end event.
Unmarshaller
内の unmarshal
reader
- The parser to be read.expectedType
- appropriate JAXB mapped class to hold reader's START_ELEMENT XML data.
JAXBException
- If any unexpected errors occur while unmarshalling
UnmarshalException
- If the ValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Datapublic void setSchema(Schema schema)
Unmarshaller
の記述:Schema
object that should be used to validate subsequent unmarshal operations
against. Passing null into this method will disable validation.
This method replaces the deprecated setValidating(boolean)
API.
Initially this property is set to null.
Unmarshaller
内の setSchema
schema
- Schema object to validate unmarshal operations against or null to disable validationpublic Schema getSchema()
Unmarshaller
の記述:Schema
object
being used to perform unmarshal-time validation. If there is no
Schema set on the unmarshaller, then this method will return null
indicating that unmarshal-time validation will not be performed.
This method provides replacement functionality for the deprecated
Unmarshaller.isValidating()
API as well as access to the Schema object.
To determine if the Unmarshaller has validation enabled, simply
test the return type for null:
boolean isValidating = u.getSchema()!=null;
Unmarshaller
内の getSchema
public void setAdapter(XmlAdapter adapter)
Unmarshaller
の記述:XmlAdapter
with this unmarshaller.
This is a convenience method that invokes setAdapter(adapter.getClass(),adapter);
.
Unmarshaller
内の setAdapter
Unmarshaller.setAdapter(Class,XmlAdapter)
public <A extends XmlAdapter> void setAdapter(Class<A> type, A adapter)
Unmarshaller
の記述:XmlAdapter
with this unmarshaller.
Every unmarshaller internally maintains a
Map
<Class
,XmlAdapter
>,
which it uses for unmarshalling classes whose fields/methods are annotated
with XmlJavaTypeAdapter
.
This method allows applications to use a configured instance of XmlAdapter
.
When an instance of an adapter is not given, an unmarshaller will create
one by invoking its default constructor.
Unmarshaller
内の setAdapter
type
- The type of the adapter. The specified instance will be used when XmlJavaTypeAdapter.value()
refers to this type.adapter
- The instance of the adapter to be used. If null, it will un-register the current adapter set for this type.public <A extends XmlAdapter> A getAdapter(Class<A> type)
Unmarshaller
の記述:Unmarshaller.setAdapter(javax.xml.bind.annotation.adapters.XmlAdapter)
method.
Unmarshaller
内の getAdapter
public void setAttachmentUnmarshaller(AttachmentUnmarshaller au)
Unmarshaller
の記述:Associate a context that resolves cid's, content-id URIs, to binary data passed as attachments.
Unmarshal time validation, enabled via Unmarshaller.setSchema(Schema)
,
must be supported even when unmarshaller is performing XOP processing.
Unmarshaller
内の setAttachmentUnmarshaller
public AttachmentUnmarshaller getAttachmentUnmarshaller()
Unmarshaller
内の getAttachmentUnmarshaller
public void setListener(Unmarshaller.Listener listener)
Unmarshaller
の記述:
Register unmarshal event callback Unmarshaller.Listener
with this Unmarshaller
.
There is only one Listener per Unmarshaller. Setting a Listener replaces the previous set Listener. One can unregister current Listener by setting listener to null.
Unmarshaller
内の setListener
listener
- provides unmarshal event callbacks for this Unmarshaller
public Unmarshaller.Listener getListener()
Unmarshaller
の記述:Return Unmarshaller.Listener
registered with this Unmarshaller
.
Unmarshaller
内の getListener
Unmarshaller.Listener
or null
if no Listener is registered with this Unmarshaller.
|
JavaTM Platform Standard Ed. 6 |
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。