|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.xml.bind.helpers Class AbstractUnmarshallerImpl
java.lang.Object javax.xml.bind.helpers.AbstractUnmarshallerImpl
- All Implemented Interfaces:
- Unmarshaller
public abstract class AbstractUnmarshallerImpl
- extends Object
- implements Unmarshaller
部分默认 Unmarshaller 实现。
此类提供 javax.xml.bind.Unmarshaller
接口的部分默认实现。
JAXB 提供者必须实现 5 个方法:getUnmarshallerHandler、unmarshal(Node)、unmarshal(XMLReader,InputSource)、unmarshal(XMLStreamReader) 和 unmarshal(XMLEventReader)。
version |
| |
since | JAXB1.0 | |
See also | javax.xml.bind.Unmarshaller |
Partial default Unmarshaller implementation.
This class provides a partial default implementation for the
Unmarshaller
interface.
A JAXB Provider has to implement five methods (getUnmarshallerHandler, unmarshal(Node), unmarshal(XMLReader,InputSource), unmarshal(XMLStreamReader), and unmarshal(XMLEventReader).
- Since:
- JAXB1.0
- Version:
- $Revision: 1.14 $ $Date: 2006/03/08 17:01:00 $
- Author:
- Kohsuke Kawaguchi, Sun Microsystems, Inc.
- See Also:
Unmarshaller
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface javax.xml.bind.Unmarshaller |
---|
Unmarshaller.Listener |
Field Summary | |
---|---|
protected boolean |
validating
whether or not the unmarshaller will validate |
Constructor Summary | |
---|---|
AbstractUnmarshallerImpl()
|
Method Summary | |
---|---|
protected UnmarshalException |
createUnmarshalException(SAXException e)
Creates an UnmarshalException from a SAXException. |
<A extends XmlAdapter>
|
getAdapter(Class<A> type)
Gets the adapter associated with the specified type.
AttachmentUnmarshaller
getAttachmentUnmarshaller()
ValidationEventHandler
getEventHandler()
Return the current event handler or the default event handler if one hasn't been set.
Unmarshaller.Listener
getListener()
Return
Unmarshaller.Listener
registered with this Unmarshaller
.
Object
getProperty(String name)
Default implementation of the getProperty method always throws PropertyException since there are no required properties.
Schema
getSchema()
Get the JAXP 1.3
Schema
object
being used to perform unmarshal-time validation.
protected XMLReader
getXMLReader()
Obtains a configured XMLReader.
boolean
isValidating()
Indicates whether or not the Unmarshaller is configured to validate during unmarshal operations.
<A extends XmlAdapter>
void
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)
Associate a context that resolves cid's, content-id URIs, to binary data passed as attachments.
void
setEventHandler(ValidationEventHandler handler)
Allow an application to register a validation event handler.
void
setListener(Unmarshaller.Listener listener)
Register unmarshal event callback
Unmarshaller.Listener
with this Unmarshaller
.
void
setProperty(String name,
Object value)
Default implementation of the setProperty method always throws PropertyException since there are no required properties.
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)
Specifies whether or not the Unmarshaller should validate during unmarshal operations.
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.
<T> JAXBElement<T>
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.
<T> JAXBElement<T>
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.
<T> JAXBElement<T>
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)
Unmarshals an object by using the specified XMLReader and the InputSource.
Object
unmarshal(XMLStreamReader reader)
Unmarshal XML data from the specified pull parser and return the resulting content tree.
<T> JAXBElement<T>
unmarshal(XMLStreamReader reader,
Class<T> expectedType)
Unmarshal root element to JAXB mapped declaredType and return the resulting content tree.
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.xml.bind.Unmarshaller |
---|
getUnmarshallerHandler, unmarshal |
Field Detail |
---|
英文文档:
validating
protected boolean validating
- whether or not the unmarshaller will validate
Constructor Detail |
---|
public
AbstractUnmarshallerImpl()
英文文档:
AbstractUnmarshallerImpl
public AbstractUnmarshallerImpl()
Method Detail |
---|
protected org.xml.sax.XMLReader
getXMLReader() throws JAXBException
获取配置好的 XMLReader。
此方法在客户端指定的 SAXSource
对象没有 XMLReader 时使用。
Unmarshaller
不可重入,因此我们只能使用一个 XMLReader 实例。
英文文档:
getXMLReader
protected XMLReader getXMLReader() throws JAXBException
- Obtains a configured XMLReader.
This method is used when the client-specified
SAXSource
object doesn't have XMLReader.Unmarshaller
is not re-entrant, so we will only use one instance of XMLReader. - Throws:
JAXBException
public Object
unmarshal(javax.xml.transform.Source source) throws JAXBException
英文文档:
unmarshal
public Object unmarshal(Source source) throws JAXBException
- Description copied from interface:
Unmarshaller
- Unmarshal XML data from the specified XML Source and return the
resulting content tree.
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.
- Specified by:
unmarshal
in interfaceUnmarshaller
- Parameters:
source
- the XML Source to unmarshal XML data from (providers are only required to support SAXSource, DOMSource, and StreamSource)- Returns:
- the newly created root object of the java content tree
- Throws:
JAXBException
- If any unexpected errors occur while unmarshallingUnmarshalException
- If theValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Data- See Also:
Unmarshaller.unmarshal(javax.xml.transform.Source, Class)
abstract protected Object
unmarshal(org.xml.sax.XMLReader reader, org.xml.sax.InputSource source) throws JAXBException
使用指定的 XMLReader 和 InputSource 解组对象。
被调用者应调用 XMLReader 的 setErrorHandler 方法,这样错误才能传递给客户端指定的 ValidationEventHandler。
英文文档:
unmarshal
protected abstract Object unmarshal(XMLReader reader, InputSource source) throws JAXBException
- Unmarshals an object by using the specified XMLReader and the InputSource.
The callee should call the setErrorHandler method of the XMLReader
so that errors are passed to the client-specified ValidationEventHandler.
- Throws:
JAXBException
final public Object
unmarshal(org.xml.sax.InputSource source) throws JAXBException
英文文档:
unmarshal
public final Object unmarshal(InputSource source) throws JAXBException
- Description copied from interface:
Unmarshaller
- Unmarshal XML data from the specified SAX InputSource and return the
resulting content tree.
Implements Unmarshal Global Root Element.
- Specified by:
unmarshal
in interfaceUnmarshaller
- Parameters:
source
- the input source to unmarshal XML data from- Returns:
- the newly created root object of the java content tree
- Throws:
JAXBException
- If any unexpected errors occur while unmarshallingUnmarshalException
- If theValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Data
final public Object
unmarshal(java.net.URL url) throws JAXBException
英文文档:
unmarshal
public final Object unmarshal(URL url) throws JAXBException
- Description copied from interface:
Unmarshaller
- Unmarshal XML data from the specified URL and return the resulting
content tree.
Implements Unmarshal Global Root Element.
- Specified by:
unmarshal
in interfaceUnmarshaller
- Parameters:
url
- the url to unmarshal XML data from- Returns:
- the newly created root object of the java content tree
- Throws:
JAXBException
- If any unexpected errors occur while unmarshallingUnmarshalException
- If theValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Data
final public Object
unmarshal(java.io.File f) throws JAXBException
英文文档:
unmarshal
public final Object unmarshal(File f) throws JAXBException
- Description copied from interface:
Unmarshaller
- Unmarshal XML data from the specified file and return the resulting
content tree.
Implements Unmarshal Global Root Element.
- Specified by:
unmarshal
in interfaceUnmarshaller
- Parameters:
f
- the file to unmarshal XML data from- Returns:
- the newly created root object of the java content tree
- Throws:
JAXBException
- If any unexpected errors occur while unmarshallingUnmarshalException
- If theValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Data
final public Object
unmarshal(java.io.InputStream is) throws JAXBException
英文文档:
unmarshal
public final Object unmarshal(InputStream is) throws JAXBException
- Description copied from interface:
Unmarshaller
- Unmarshal XML data from the specified InputStream and return the
resulting content tree. Validation event location information may
be incomplete when using this form of the unmarshal API.
Implements Unmarshal Global Root Element.
- Specified by:
unmarshal
in interfaceUnmarshaller
- Parameters:
is
- the InputStream to unmarshal XML data from- Returns:
- the newly created root object of the java content tree
- Throws:
JAXBException
- If any unexpected errors occur while unmarshallingUnmarshalException
- If theValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Data
final public Object
unmarshal(java.io.Reader reader) throws JAXBException
英文文档:
unmarshal
public final Object unmarshal(Reader reader) throws JAXBException
- Description copied from interface:
Unmarshaller
- Unmarshal XML data from the specified Reader and return the
resulting content tree. Validation event location information may
be incomplete when using this form of the unmarshal API,
because a Reader does not provide the system ID.
Implements Unmarshal Global Root Element.
- Specified by:
unmarshal
in interfaceUnmarshaller
- Parameters:
reader
- the Reader to unmarshal XML data from- Returns:
- the newly created root object of the java content tree
- Throws:
JAXBException
- If any unexpected errors occur while unmarshallingUnmarshalException
- If theValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Data
public boolean
isValidating() throws JAXBException
指示 Unmarshaller 是否被配置为在执行解组操作期间进行验证。
注: 为了与 JAXP 保持一致,我将该方法命名为 isValidating(),而不是 getValidating()。
return | 如果 Unmarshaller 被配置为在执行解组操作期间进行验证,则返回 true,否则返回 false |
Throws | JAXBException: 如果检索验证标志时发生错误 |
isValidating
public boolean isValidating() throws JAXBException
- Indicates whether or not the Unmarshaller is configured to validate
during unmarshal operations.
Note: I named this method isValidating() to stay in-line with JAXP, as opposed to naming it getValidating().
- Specified by:
isValidating
in interfaceUnmarshaller
- Returns:
- true if the Unmarshaller is configured to validate during unmarshal operations, false otherwise
- Throws:
JAXBException
- if an error occurs while retrieving the validating flag
public void
setEventHandler(ValidationEventHandler handler) throws JAXBException
允许应用程序注册一个验证事件处理程序。
如果在调用任一 unmarshal 方法期间发生验证错误,则 JAXB 提供者将调用验证事件处理程序。如果在调用解组方法之前客户端应用程序没有注册验证事件处理程序,那么将忽略所有验证事件,并有可能导致不可预料的行为。
handler | 验证事件处理程序 |
Throws | JAXBException: 如果在设置事件处理程序时发生错误 |
setEventHandler
public void setEventHandler(ValidationEventHandler handler) throws JAXBException
- Allow an application to register a validation event handler.
The validation event handler will be called by the JAXB Provider if any validation errors are encountered during calls to any of the unmarshal methods. If the client application does not register a validation event handler before invoking the unmarshal methods, then all validation events will be silently ignored and may result in unexpected behaviour.
- Specified by:
setEventHandler
in interfaceUnmarshaller
- Parameters:
handler
- the validation event handler- Throws:
JAXBException
- if an error was encountered while setting the event handler
public void
setValidating(boolean validating) throws JAXBException
指定 Unmarshaller 是否应该在执行解组操作期间进行验证。默认情况下,Unmarshaller 不进行验证。
此方法仅在调用某一解组方法之前或之后调用。
validating | 如果 Unmarshaller 应该在执行解组操作期间进行验证,则该参数为 true,否则为 false |
Throws | JAXBException: 如果在执行解组操作期间启用或禁用验证时发生错误 |
setValidating
public void setValidating(boolean validating) throws JAXBException
- Specifies whether or not the Unmarshaller should validate during
unmarshal operations. By default, the Unmarshaller does
not validate.
This method may only be invoked before or after calling one of the unmarshal methods.
- Specified by:
setValidating
in interfaceUnmarshaller
- Parameters:
validating
- true if the Unmarshaller should validate during unmarshal, false otherwise- Throws:
JAXBException
- if an error occurred while enabling or disabling validation at unmarshal time
public ValidationEventHandler
getEventHandler() throws JAXBException
当前的事件处理程序;如果没有设置,则返回默认事件处理程序。
return | 当前 ValidationEventHandler,如果没有设置该处理程序,则返回默认的事件处理程序 |
Throws | JAXBException: 如果获取当前事件处理程序时发生错误 |
getEventHandler
public ValidationEventHandler getEventHandler() throws JAXBException
- Return the current event handler or the default event handler if one
hasn't been set.
- Specified by:
getEventHandler
in interfaceUnmarshaller
- Returns:
- the current ValidationEventHandler or the default event handler if it hasn't been set
- Throws:
JAXBException
- if an error was encountered while getting the current event handler
protected UnmarshalException
createUnmarshalException(org.xml.sax.SAXException e)
从 SAXException 创建 UnmarshalException。
这是一个为派生类提供的实用方法。
当提供者实现的 ContentHandler 希望抛出 JAXBException 时,它需要通过 SAXException 包装该异常。如果 unmarshaller 实现盲目地使用 JAXBException 包装 SAXException ,则异常将是用另一个 JAXBException 包装的 SAXException 包装的 JAXBException。这样做很不明智。
此方法检查 SAXException 的嵌套异常并可减少过多的包装。
return | 得到的 UnmarshalException |
createUnmarshalException
protected UnmarshalException createUnmarshalException(SAXException e)
- Creates an UnmarshalException from a SAXException.
This is an utility method provided for the derived classes.
When a provider-implemented ContentHandler wants to throw a JAXBException, it needs to wrap the exception by a SAXException. If the unmarshaller implementation blindly wrap SAXException by JAXBException, such an exception will be a JAXBException wrapped by a SAXException wrapped by another JAXBException. This is silly.
This method checks the nested exception of SAXException and reduce those excessive wrapping.
- Returns:
- the resulting UnmarshalException
public void
setProperty(String name, Object value) throws PropertyException
由于没有必需的属性,setProperty 方法的默认实现总是抛出 PropertyException。如果提供商需要处理其他属性,则应该在派生类中重写此方法。
英文文档:
setProperty
public void setProperty(String name, Object value) throws PropertyException
- Default implementation of the setProperty method always
throws PropertyException since there are no required
properties. If a provider needs to handle additional
properties, it should override this method in a derived class.
- Specified by:
setProperty
in interfaceUnmarshaller
- Parameters:
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- Throws:
PropertyException
- when there is an error processing the given property or value
public Object
getProperty(String name) throws PropertyException
由于没有必需的属性,getProperty 方法的默认实现总是抛出 PropertyException。如果提供者需要处理其他属性,则应该在派生类中重写此方法。
英文文档:
getProperty
public Object getProperty(String name) throws PropertyException
- Default implementation of the getProperty method always
throws PropertyException since there are no required
properties. If a provider needs to handle additional
properties, it should override this method in a derived class.
- Specified by:
getProperty
in interfaceUnmarshaller
- Parameters:
name
- the name of the property to retrieve- Returns:
- the value of the requested property
- Throws:
PropertyException
- when there is an error retrieving the given property or value property name
public Object
unmarshal(XMLEventReader reader) throws JAXBException
英文文档:
unmarshal
public Object unmarshal(XMLEventReader reader) throws JAXBException
- Description copied from interface:
Unmarshaller
- Unmarshal XML data from the specified pull parser and return the
resulting content tree.
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.
- Specified by:
unmarshal
in interfaceUnmarshaller
- Parameters:
reader
- The parser to be read.- Returns:
- the newly created root object of the java content tree.
- Throws:
JAXBException
- If any unexpected errors occur while unmarshallingUnmarshalException
- If theValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Data- See Also:
Unmarshaller.unmarshal(javax.xml.stream.XMLEventReader, Class)
public Object
unmarshal(XMLStreamReader reader) throws JAXBException
英文文档:
unmarshal
public Object unmarshal(XMLStreamReader reader) throws JAXBException
- Description copied from interface:
Unmarshaller
- Unmarshal XML data from the specified pull parser and return the
resulting content tree.
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.
- Specified by:
unmarshal
in interfaceUnmarshaller
- Parameters:
reader
- The parser to be read.- Returns:
- the newly created root object of the java content tree.
- Throws:
JAXBException
- If any unexpected errors occur while unmarshallingUnmarshalException
- If theValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Data- See Also:
Unmarshaller.unmarshal(javax.xml.stream.XMLStreamReader, Class)
英文文档:
unmarshal
public <T> JAXBElement<T> unmarshal(Node node, Class<T> expectedType) throws JAXBException
- Description copied from interface:
Unmarshaller
- Unmarshal XML data by JAXB mapped declaredType
and return the resulting content tree.
Implements Unmarshal by Declared Type
- Specified by:
unmarshal
in interfaceUnmarshaller
- Parameters:
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.- Returns:
- JAXB Element representation of node
- Throws:
JAXBException
- If any unexpected errors occur while unmarshallingUnmarshalException
- If theValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Data
英文文档:
unmarshal
public <T> JAXBElement<T> unmarshal(Source source, Class<T> expectedType) throws JAXBException
- Description copied from interface:
Unmarshaller
- Unmarshal XML data from the specified XML Source by declaredType and return the
resulting content tree.
Implements Unmarshal by Declared Type
See SAX 2.0 Parser Pluggability
- Specified by:
unmarshal
in interfaceUnmarshaller
- Parameters:
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- Returns:
- Java content rooted by JAXB Element
- Throws:
JAXBException
- If any unexpected errors occur while unmarshallingUnmarshalException
- If theValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Data
英文文档:
unmarshal
public <T> JAXBElement<T> unmarshal(XMLStreamReader reader, Class<T> expectedType) throws JAXBException
- Description copied from interface:
Unmarshaller
- Unmarshal root element to JAXB mapped declaredType
and return the resulting content tree.
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.
- Specified by:
unmarshal
in interfaceUnmarshaller
- Parameters:
reader
- The parser to be read.expectedType
- appropriate JAXB mapped class to hold reader's START_ELEMENT XML data.- Returns:
- content tree rooted by JAXB Element representation
- Throws:
JAXBException
- If any unexpected errors occur while unmarshallingUnmarshalException
- If theValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Data
英文文档:
unmarshal
public <T> JAXBElement<T> unmarshal(XMLEventReader reader, Class<T> expectedType) throws JAXBException
- Description copied from interface:
Unmarshaller
- Unmarshal root element to JAXB mapped declaredType
and return the resulting content tree.
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.
- Specified by:
unmarshal
in interfaceUnmarshaller
- Parameters:
reader
- The parser to be read.expectedType
- appropriate JAXB mapped class to hold reader's START_ELEMENT XML data.- Returns:
- content tree rooted by JAXB Element representation
- Throws:
JAXBException
- If any unexpected errors occur while unmarshallingUnmarshalException
- If theValidationEventHandler
returns false from its handleEvent method or the Unmarshaller is unable to perform the XML to Java binding. See Unmarshalling XML Data
public void
setSchema(javax.xml.validation.Schema schema)
英文文档:
setSchema
public void setSchema(Schema schema)
- Description copied from interface:
Unmarshaller
- Specify the JAXP 1.3
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.
- Specified by:
setSchema
in interfaceUnmarshaller
- Parameters:
schema
- Schema object to validate unmarshal operations against or null to disable validation
public javax.xml.validation.Schema
getSchema()
英文文档:
getSchema
public Schema getSchema()
- Description copied from interface:
Unmarshaller
- Get the JAXP 1.3
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;
- Specified by:
getSchema
in interfaceUnmarshaller
- Returns:
- the Schema object being used to perform unmarshal-time validation or null if not present
public void
setAdapter(">XmlAdapter adapter)
英文文档:
setAdapter
public void setAdapter(XmlAdapter adapter)
- Description copied from interface:
Unmarshaller
- Associates a configured instance of
XmlAdapter
with this unmarshaller.This is a convenience method that invokes
setAdapter(adapter.getClass(),adapter);
. - Specified by:
setAdapter
in interfaceUnmarshaller
英文文档:
setAdapter
public <A extends XmlAdapter> void setAdapter(Class<A> type, A adapter)
- Description copied from interface:
Unmarshaller
- Associates a configured instance of
XmlAdapter
with this unmarshaller.Every unmarshaller internally maintains a
Map
<Class
,XmlAdapter
>, which it uses for unmarshalling classes whose fields/methods are annotated withXmlJavaTypeAdapter
.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. - Specified by:
setAdapter
in interfaceUnmarshaller
- Parameters:
type
- The type of the adapter. The specified instance will be used whenXmlJavaTypeAdapter.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.
英文文档:
getAdapter
public <A extends XmlAdapter> A getAdapter(Class<A> type)
- Description copied from interface:
Unmarshaller
- Gets the adapter associated with the specified type.
This is the reverse operation of the
Unmarshaller.setAdapter(javax.xml.bind.annotation.adapters.XmlAdapter)
method. - Specified by:
getAdapter
in interfaceUnmarshaller
public void
setAttachmentUnmarshaller(AttachmentUnmarshaller au)
英文文档:
setAttachmentUnmarshaller
public void setAttachmentUnmarshaller(AttachmentUnmarshaller au)
- Description copied from interface:
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.- Specified by:
setAttachmentUnmarshaller
in interfaceUnmarshaller
public AttachmentUnmarshaller
getAttachmentUnmarshaller()
英文文档:
getAttachmentUnmarshaller
public AttachmentUnmarshaller getAttachmentUnmarshaller()
- Specified by:
getAttachmentUnmarshaller
in interfaceUnmarshaller
public void
setListener(Unmarshaller.Listener listener)
英文文档:
setListener
public void setListener(Unmarshaller.Listener listener)
- Description copied from interface:
Unmarshaller
Register unmarshal event callback
Unmarshaller.Listener
with thisUnmarshaller
.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.
- Specified by:
setListener
in interfaceUnmarshaller
- Parameters:
listener
- provides unmarshal event callbacks for thisUnmarshaller
public Unmarshaller.Listener
getListener()
英文文档:
getListener
public Unmarshaller.Listener getListener()
- Description copied from interface:
Unmarshaller
Return
Unmarshaller.Listener
registered with thisUnmarshaller
.- Specified by:
getListener
in interfaceUnmarshaller
- Returns:
- registered
Unmarshaller.Listener
ornull
if no Listener is registered with this Unmarshaller.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!