javax.xml.bind.Unmarshaller#getUnmarshallerHandler ( )源码实例Demo

下面列出了javax.xml.bind.Unmarshaller#getUnmarshallerHandler ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: TencentKona-8   文件: SCDBasedBindingSet.java
/**
 * Applies the additional binding customizations.
 */
public void apply(XSSchemaSet schema, ErrorReceiver errorReceiver) {
    if(topLevel!=null) {
        this.errorReceiver = errorReceiver;
        Unmarshaller u =  BindInfo.getCustomizationUnmarshaller();
        this.unmarshaller = u.getUnmarshallerHandler();
        ValidatorHandler v = BindInfo.bindingFileSchema.newValidator();
        v.setErrorHandler(errorReceiver);
        loader = new ForkContentHandler(v,unmarshaller);

        topLevel.applyAll(schema.getSchemas());

        this.loader = null;
        this.unmarshaller = null;
        this.errorReceiver = null;
    }
}
 
源代码2 项目: jdk8u60   文件: SCDBasedBindingSet.java
/**
 * Applies the additional binding customizations.
 */
public void apply(XSSchemaSet schema, ErrorReceiver errorReceiver) {
    if(topLevel!=null) {
        this.errorReceiver = errorReceiver;
        Unmarshaller u =  BindInfo.getCustomizationUnmarshaller();
        this.unmarshaller = u.getUnmarshallerHandler();
        ValidatorHandler v = BindInfo.bindingFileSchema.newValidator();
        v.setErrorHandler(errorReceiver);
        loader = new ForkContentHandler(v,unmarshaller);

        topLevel.applyAll(schema.getSchemas());

        this.loader = null;
        this.unmarshaller = null;
        this.errorReceiver = null;
    }
}
 
源代码3 项目: openjdk-jdk8u   文件: SCDBasedBindingSet.java
/**
 * Applies the additional binding customizations.
 */
public void apply(XSSchemaSet schema, ErrorReceiver errorReceiver) {
    if(topLevel!=null) {
        this.errorReceiver = errorReceiver;
        Unmarshaller u =  BindInfo.getCustomizationUnmarshaller();
        this.unmarshaller = u.getUnmarshallerHandler();
        ValidatorHandler v = BindInfo.bindingFileSchema.newValidator();
        v.setErrorHandler(errorReceiver);
        loader = new ForkContentHandler(v,unmarshaller);

        topLevel.applyAll(schema.getSchemas());

        this.loader = null;
        this.unmarshaller = null;
        this.errorReceiver = null;
    }
}
 
源代码4 项目: openjdk-jdk8u-backup   文件: SCDBasedBindingSet.java
/**
 * Applies the additional binding customizations.
 */
public void apply(XSSchemaSet schema, ErrorReceiver errorReceiver) {
    if(topLevel!=null) {
        this.errorReceiver = errorReceiver;
        Unmarshaller u =  BindInfo.getCustomizationUnmarshaller();
        this.unmarshaller = u.getUnmarshallerHandler();
        ValidatorHandler v = BindInfo.bindingFileSchema.newValidator();
        v.setErrorHandler(errorReceiver);
        loader = new ForkContentHandler(v,unmarshaller);

        topLevel.applyAll(schema.getSchemas());

        this.loader = null;
        this.unmarshaller = null;
        this.errorReceiver = null;
    }
}
 
源代码5 项目: openjdk-jdk9   文件: SCDBasedBindingSet.java
/**
 * Applies the additional binding customizations.
 */
public void apply(XSSchemaSet schema, ErrorReceiver errorReceiver) {
    if(topLevel!=null) {
        this.errorReceiver = errorReceiver;
        Unmarshaller u =  BindInfo.getCustomizationUnmarshaller();
        this.unmarshaller = u.getUnmarshallerHandler();
        ValidatorHandler v = BindInfo.bindingFileSchema.newValidator();
        v.setErrorHandler(errorReceiver);
        loader = new ForkContentHandler(v,unmarshaller);

        topLevel.applyAll(schema.getSchemas());

        this.loader = null;
        this.unmarshaller = null;
        this.errorReceiver = null;
    }
}
 
源代码6 项目: hottub   文件: SCDBasedBindingSet.java
/**
 * Applies the additional binding customizations.
 */
public void apply(XSSchemaSet schema, ErrorReceiver errorReceiver) {
    if(topLevel!=null) {
        this.errorReceiver = errorReceiver;
        Unmarshaller u =  BindInfo.getCustomizationUnmarshaller();
        this.unmarshaller = u.getUnmarshallerHandler();
        ValidatorHandler v = BindInfo.bindingFileSchema.newValidator();
        v.setErrorHandler(errorReceiver);
        loader = new ForkContentHandler(v,unmarshaller);

        topLevel.applyAll(schema.getSchemas());

        this.loader = null;
        this.unmarshaller = null;
        this.errorReceiver = null;
    }
}
 
源代码7 项目: tomee   文件: JaxbPersistenceFactory.java
public static <T> T getPersistence(final Class<T> clazz, final InputStream persistenceDescriptor) throws Exception {
    final JAXBContext jc = clazz.getClassLoader() == JaxbPersistenceFactory.class.getClassLoader() ?
            JaxbJavaee.getContext(clazz) : JAXBContextFactory.newInstance(clazz);
    final Unmarshaller u = jc.createUnmarshaller();
    final UnmarshallerHandler uh = u.getUnmarshallerHandler();

    // create a new XML parser
    final SAXParserFactory factory = SAXParserFactory.newInstance();
    factory.setNamespaceAware(true);
    factory.setValidating(true);
    final SAXParser parser = factory.newSAXParser();

    final XMLReader xmlReader = parser.getXMLReader();

    // Create a filter to intercept events
    final PersistenceFilter xmlFilter = new PersistenceFilter(xmlReader);

    // Be sure the filter has the JAXB content handler set (or it wont work)
    xmlFilter.setContentHandler(uh);
    final SAXSource source = new SAXSource(xmlFilter, new InputSource(persistenceDescriptor));

    return (T) u.unmarshal(source);
}
 
源代码8 项目: openjdk-8   文件: SCDBasedBindingSet.java
/**
 * Applies the additional binding customizations.
 */
public void apply(XSSchemaSet schema, ErrorReceiver errorReceiver) {
    if(topLevel!=null) {
        this.errorReceiver = errorReceiver;
        Unmarshaller u =  BindInfo.getCustomizationUnmarshaller();
        this.unmarshaller = u.getUnmarshallerHandler();
        ValidatorHandler v = BindInfo.bindingFileSchema.newValidator();
        v.setErrorHandler(errorReceiver);
        loader = new ForkContentHandler(v,unmarshaller);

        topLevel.applyAll(schema.getSchemas());

        this.loader = null;
        this.unmarshaller = null;
        this.errorReceiver = null;
    }
}
 
源代码9 项目: rice   文件: JAXBConfigImpl.java
protected org.kuali.rice.core.impl.config.property.Config unmarshal(Unmarshaller unmarshaller, InputStream in)
        throws SAXException, ParserConfigurationException, IOException,
        IllegalStateException, JAXBException {
    SAXParserFactory spf = SAXParserFactory.newInstance();
    spf.setNamespaceAware(true);

    XMLFilter filter = new ConfigNamespaceURIFilter();
    filter.setParent(spf.newSAXParser().getXMLReader());

    UnmarshallerHandler handler = unmarshaller.getUnmarshallerHandler();
    filter.setContentHandler(handler);

    filter.parse(new InputSource(in));

    return (org.kuali.rice.core.impl.config.property.Config) handler.getResult();
}
 
源代码10 项目: jdk1.8-source-analysis   文件: JAXBResult.java
/**
 * Creates a new instance that uses the specified
 * Unmarshaller to unmarshal an object.
 *
 * <p>
 * This JAXBResult object will use the specified Unmarshaller
 * instance. It is the caller's responsibility not to use the
 * same Unmarshaller for other purposes while it is being
 * used by this object.
 *
 * <p>
 * The primary purpose of this method is to allow the client
 * to configure Unmarshaller. Unless you know what you are doing,
 * it's easier and safer to pass a JAXBContext.
 *
 * @param _unmarshaller the unmarshaller.  This parameter must not be null.
 * @throws JAXBException if an error is encountered while creating the
 * JAXBResult or the Unmarshaller parameter is null.
 */
public JAXBResult( Unmarshaller _unmarshaller ) throws JAXBException {
    if( _unmarshaller == null )
        throw new JAXBException(
            Messages.format( Messages.RESULT_NULL_UNMARSHALLER ) );

    this.unmarshallerHandler = _unmarshaller.getUnmarshallerHandler();

    super.setHandler(unmarshallerHandler);
}
 
源代码11 项目: TencentKona-8   文件: JAXBResult.java
/**
 * Creates a new instance that uses the specified
 * Unmarshaller to unmarshal an object.
 *
 * <p>
 * This JAXBResult object will use the specified Unmarshaller
 * instance. It is the caller's responsibility not to use the
 * same Unmarshaller for other purposes while it is being
 * used by this object.
 *
 * <p>
 * The primary purpose of this method is to allow the client
 * to configure Unmarshaller. Unless you know what you are doing,
 * it's easier and safer to pass a JAXBContext.
 *
 * @param _unmarshaller the unmarshaller.  This parameter must not be null.
 * @throws JAXBException if an error is encountered while creating the
 * JAXBResult or the Unmarshaller parameter is null.
 */
public JAXBResult( Unmarshaller _unmarshaller ) throws JAXBException {
    if( _unmarshaller == null )
        throw new JAXBException(
            Messages.format( Messages.RESULT_NULL_UNMARSHALLER ) );

    this.unmarshallerHandler = _unmarshaller.getUnmarshallerHandler();

    super.setHandler(unmarshallerHandler);
}
 
源代码12 项目: jdk8u60   文件: JAXBResult.java
/**
 * Creates a new instance that uses the specified
 * Unmarshaller to unmarshal an object.
 *
 * <p>
 * This JAXBResult object will use the specified Unmarshaller
 * instance. It is the caller's responsibility not to use the
 * same Unmarshaller for other purposes while it is being
 * used by this object.
 *
 * <p>
 * The primary purpose of this method is to allow the client
 * to configure Unmarshaller. Unless you know what you are doing,
 * it's easier and safer to pass a JAXBContext.
 *
 * @param _unmarshaller the unmarshaller.  This parameter must not be null.
 * @throws JAXBException if an error is encountered while creating the
 * JAXBResult or the Unmarshaller parameter is null.
 */
public JAXBResult( Unmarshaller _unmarshaller ) throws JAXBException {
    if( _unmarshaller == null )
        throw new JAXBException(
            Messages.format( Messages.RESULT_NULL_UNMARSHALLER ) );

    this.unmarshallerHandler = _unmarshaller.getUnmarshallerHandler();

    super.setHandler(unmarshallerHandler);
}
 
源代码13 项目: JDKSourceCode1.8   文件: JAXBResult.java
/**
 * Creates a new instance that uses the specified
 * Unmarshaller to unmarshal an object.
 *
 * <p>
 * This JAXBResult object will use the specified Unmarshaller
 * instance. It is the caller's responsibility not to use the
 * same Unmarshaller for other purposes while it is being
 * used by this object.
 *
 * <p>
 * The primary purpose of this method is to allow the client
 * to configure Unmarshaller. Unless you know what you are doing,
 * it's easier and safer to pass a JAXBContext.
 *
 * @param _unmarshaller the unmarshaller.  This parameter must not be null.
 * @throws JAXBException if an error is encountered while creating the
 * JAXBResult or the Unmarshaller parameter is null.
 */
public JAXBResult( Unmarshaller _unmarshaller ) throws JAXBException {
    if( _unmarshaller == null )
        throw new JAXBException(
            Messages.format( Messages.RESULT_NULL_UNMARSHALLER ) );

    this.unmarshallerHandler = _unmarshaller.getUnmarshallerHandler();

    super.setHandler(unmarshallerHandler);
}
 
源代码14 项目: openjdk-jdk8u   文件: JAXBResult.java
/**
 * Creates a new instance that uses the specified
 * Unmarshaller to unmarshal an object.
 *
 * <p>
 * This JAXBResult object will use the specified Unmarshaller
 * instance. It is the caller's responsibility not to use the
 * same Unmarshaller for other purposes while it is being
 * used by this object.
 *
 * <p>
 * The primary purpose of this method is to allow the client
 * to configure Unmarshaller. Unless you know what you are doing,
 * it's easier and safer to pass a JAXBContext.
 *
 * @param _unmarshaller the unmarshaller.  This parameter must not be null.
 * @throws JAXBException if an error is encountered while creating the
 * JAXBResult or the Unmarshaller parameter is null.
 */
public JAXBResult( Unmarshaller _unmarshaller ) throws JAXBException {
    if( _unmarshaller == null )
        throw new JAXBException(
            Messages.format( Messages.RESULT_NULL_UNMARSHALLER ) );

    this.unmarshallerHandler = _unmarshaller.getUnmarshallerHandler();

    super.setHandler(unmarshallerHandler);
}
 
源代码15 项目: openjdk-jdk8u-backup   文件: JAXBResult.java
/**
 * Creates a new instance that uses the specified
 * Unmarshaller to unmarshal an object.
 *
 * <p>
 * This JAXBResult object will use the specified Unmarshaller
 * instance. It is the caller's responsibility not to use the
 * same Unmarshaller for other purposes while it is being
 * used by this object.
 *
 * <p>
 * The primary purpose of this method is to allow the client
 * to configure Unmarshaller. Unless you know what you are doing,
 * it's easier and safer to pass a JAXBContext.
 *
 * @param _unmarshaller the unmarshaller.  This parameter must not be null.
 * @throws JAXBException if an error is encountered while creating the
 * JAXBResult or the Unmarshaller parameter is null.
 */
public JAXBResult( Unmarshaller _unmarshaller ) throws JAXBException {
    if( _unmarshaller == null )
        throw new JAXBException(
            Messages.format( Messages.RESULT_NULL_UNMARSHALLER ) );

    this.unmarshallerHandler = _unmarshaller.getUnmarshallerHandler();

    super.setHandler(unmarshallerHandler);
}
 
源代码16 项目: openjdk-jdk9   文件: JAXBResult.java
/**
 * Creates a new instance that uses the specified
 * Unmarshaller to unmarshal an object.
 *
 * <p>
 * This JAXBResult object will use the specified Unmarshaller
 * instance. It is the caller's responsibility not to use the
 * same Unmarshaller for other purposes while it is being
 * used by this object.
 *
 * <p>
 * The primary purpose of this method is to allow the client
 * to configure Unmarshaller. Unless you know what you are doing,
 * it's easier and safer to pass a JAXBContext.
 *
 * @param _unmarshaller the unmarshaller.  This parameter must not be null.
 * @throws JAXBException if an error is encountered while creating the
 * JAXBResult or the Unmarshaller parameter is null.
 */
public JAXBResult( Unmarshaller _unmarshaller ) throws JAXBException {
    if( _unmarshaller == null )
        throw new JAXBException(
            Messages.format( Messages.RESULT_NULL_UNMARSHALLER ) );

    this.unmarshallerHandler = _unmarshaller.getUnmarshallerHandler();

    super.setHandler(unmarshallerHandler);
}
 
源代码17 项目: Java8CN   文件: JAXBResult.java
/**
 * Creates a new instance that uses the specified
 * Unmarshaller to unmarshal an object.
 *
 * <p>
 * This JAXBResult object will use the specified Unmarshaller
 * instance. It is the caller's responsibility not to use the
 * same Unmarshaller for other purposes while it is being
 * used by this object.
 *
 * <p>
 * The primary purpose of this method is to allow the client
 * to configure Unmarshaller. Unless you know what you are doing,
 * it's easier and safer to pass a JAXBContext.
 *
 * @param _unmarshaller the unmarshaller.  This parameter must not be null.
 * @throws JAXBException if an error is encountered while creating the
 * JAXBResult or the Unmarshaller parameter is null.
 */
public JAXBResult( Unmarshaller _unmarshaller ) throws JAXBException {
    if( _unmarshaller == null )
        throw new JAXBException(
            Messages.format( Messages.RESULT_NULL_UNMARSHALLER ) );

    this.unmarshallerHandler = _unmarshaller.getUnmarshallerHandler();

    super.setHandler(unmarshallerHandler);
}
 
源代码18 项目: hottub   文件: JAXBResult.java
/**
 * Creates a new instance that uses the specified
 * Unmarshaller to unmarshal an object.
 *
 * <p>
 * This JAXBResult object will use the specified Unmarshaller
 * instance. It is the caller's responsibility not to use the
 * same Unmarshaller for other purposes while it is being
 * used by this object.
 *
 * <p>
 * The primary purpose of this method is to allow the client
 * to configure Unmarshaller. Unless you know what you are doing,
 * it's easier and safer to pass a JAXBContext.
 *
 * @param _unmarshaller the unmarshaller.  This parameter must not be null.
 * @throws JAXBException if an error is encountered while creating the
 * JAXBResult or the Unmarshaller parameter is null.
 */
public JAXBResult( Unmarshaller _unmarshaller ) throws JAXBException {
    if( _unmarshaller == null )
        throw new JAXBException(
            Messages.format( Messages.RESULT_NULL_UNMARSHALLER ) );

    this.unmarshallerHandler = _unmarshaller.getUnmarshallerHandler();

    super.setHandler(unmarshallerHandler);
}
 
源代码19 项目: openjdk-8-source   文件: JAXBResult.java
/**
 * Creates a new instance that uses the specified
 * Unmarshaller to unmarshal an object.
 *
 * <p>
 * This JAXBResult object will use the specified Unmarshaller
 * instance. It is the caller's responsibility not to use the
 * same Unmarshaller for other purposes while it is being
 * used by this object.
 *
 * <p>
 * The primary purpose of this method is to allow the client
 * to configure Unmarshaller. Unless you know what you are doing,
 * it's easier and safer to pass a JAXBContext.
 *
 * @param _unmarshaller the unmarshaller.  This parameter must not be null.
 * @throws JAXBException if an error is encountered while creating the
 * JAXBResult or the Unmarshaller parameter is null.
 */
public JAXBResult( Unmarshaller _unmarshaller ) throws JAXBException {
    if( _unmarshaller == null )
        throw new JAXBException(
            Messages.format( Messages.RESULT_NULL_UNMARSHALLER ) );

    this.unmarshallerHandler = _unmarshaller.getUnmarshallerHandler();

    super.setHandler(unmarshallerHandler);
}
 
源代码20 项目: openjdk-8   文件: JAXBResult.java
/**
 * Creates a new instance that uses the specified
 * Unmarshaller to unmarshal an object.
 *
 * <p>
 * This JAXBResult object will use the specified Unmarshaller
 * instance. It is the caller's responsibility not to use the
 * same Unmarshaller for other purposes while it is being
 * used by this object.
 *
 * <p>
 * The primary purpose of this method is to allow the client
 * to configure Unmarshaller. Unless you know what you are doing,
 * it's easier and safer to pass a JAXBContext.
 *
 * @param _unmarshaller the unmarshaller.  This parameter must not be null.
 * @throws JAXBException if an error is encountered while creating the
 * JAXBResult or the Unmarshaller parameter is null.
 */
public JAXBResult( Unmarshaller _unmarshaller ) throws JAXBException {
    if( _unmarshaller == null )
        throw new JAXBException(
            Messages.format( Messages.RESULT_NULL_UNMARSHALLER ) );

    this.unmarshallerHandler = _unmarshaller.getUnmarshallerHandler();

    super.setHandler(unmarshallerHandler);
}