当前位置: 首页>>代码示例>>Java>>正文


Java XmlAdapter.unmarshal方法代码示例

本文整理汇总了Java中javax.xml.bind.annotation.adapters.XmlAdapter.unmarshal方法的典型用法代码示例。如果您正苦于以下问题:Java XmlAdapter.unmarshal方法的具体用法?Java XmlAdapter.unmarshal怎么用?Java XmlAdapter.unmarshal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.xml.bind.annotation.adapters.XmlAdapter的用法示例。


在下文中一共展示了XmlAdapter.unmarshal方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createConstant

import javax.xml.bind.annotation.adapters.XmlAdapter; //导入方法依赖的package包/类
public JExpression createConstant(Outline outline, XmlString lexical) {
    if(isCollection())  return null;

    if(adapter==null)     return coreType.createConstant(outline, lexical);

    // [RESULT] new Adapter().unmarshal(CONSTANT);
    JExpression cons = coreType.createConstant(outline, lexical);
    Class<? extends XmlAdapter> atype = adapter.getAdapterIfKnown();

    // try to run the adapter now rather than later.
    if(cons instanceof JStringLiteral && atype!=null) {
        JStringLiteral scons = (JStringLiteral) cons;
        XmlAdapter a = ClassFactory.create(atype);
        try {
            Object value = a.unmarshal(scons.str);
            if(value instanceof String) {
                return JExpr.lit((String)value);
            }
        } catch (Exception e) {
            // assume that we can't eagerly bind this
        }
    }

    return JExpr._new(adapter.getAdapterClass(outline)).invoke("unmarshal").arg(cons);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:TypeUseImpl.java

示例2: adaptU

import javax.xml.bind.annotation.adapters.XmlAdapter; //导入方法依赖的package包/类
private @NotNull InMemory adaptU(Unmarshaller _u, OnWire v) throws JAXBException {
    UnmarshallerImpl u = (UnmarshallerImpl) _u;
    XmlAdapter<OnWire,InMemory> a = u.coordinator.getAdapter(adapter);
    u.coordinator.pushCoordinator();
    try {
        return a.unmarshal(v);
    } catch (Exception e) {
        throw new UnmarshalException(e);
    } finally {
        u.coordinator.popCoordinator();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:BridgeAdapter.java

示例3: adaptU

import javax.xml.bind.annotation.adapters.XmlAdapter; //导入方法依赖的package包/类
private @NotNull InMemory adaptU(Unmarshaller _u, OnWire v) throws JAXBException {
    UnmarshallerImpl u = (UnmarshallerImpl) _u;
    XmlAdapter<OnWire,InMemory> a = u.coordinator.getAdapter(adapter);
    u.coordinator.setThreadAffinity();
    u.coordinator.pushCoordinator();
    try {
        return a.unmarshal(v);
    } catch (Exception e) {
        throw new UnmarshalException(e);
    } finally {
        u.coordinator.popCoordinator();
        u.coordinator.resetThreadAffinity();
    }
}
 
开发者ID:GeeQuery,项目名称:cxf-plus,代码行数:15,代码来源:BridgeAdapter.java

示例4: createConstant

import javax.xml.bind.annotation.adapters.XmlAdapter; //导入方法依赖的package包/类
public JExpression createConstant(Outline outline, XmlString lexical) {
	if (isCollection())
		return null;

	if (adapter == null)
		return coreType.createConstant(outline, lexical);

	// [RESULT] new Adapter().unmarshal(CONSTANT);
	JExpression cons = coreType.createConstant(outline, lexical);
	@SuppressWarnings("unchecked")
	Class<? extends XmlAdapter<?, ?>> atype = (Class<? extends XmlAdapter<?, ?>>) adapter
			.getAdapterIfKnown();

	// try to run the adapter now rather than later.
	if (cons instanceof JStringLiteral && atype != null) {
		JStringLiteral scons = (JStringLiteral) cons;
		@SuppressWarnings("unchecked")
		XmlAdapter<Object, String> a = (XmlAdapter<Object, String>) ClassFactory
				.create(atype);
		try {
			Object value = a.unmarshal(scons.str);
			if (value instanceof String) {
				return JExpr.lit((String) value);
			}
		} catch (Exception e) {
			// assume that we can't eagerly bind this
		}
	}

	return JExpr._new(adapter.getAdapterClass(outline)).invoke("unmarshal")
			.arg(cons);
}
 
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:33,代码来源:DefaultTypeUse.java

示例5: unmarshall

import javax.xml.bind.annotation.adapters.XmlAdapter; //导入方法依赖的package包/类
public static <ValueType, BoundType> BoundType unmarshall(
		Class<? extends XmlAdapter<ValueType, BoundType>> xmlAdapterClass,
		ValueType v) {
	try {
		final XmlAdapter<ValueType, BoundType> xmlAdapter = getXmlAdapter(xmlAdapterClass);
		return xmlAdapter.unmarshal(v);
	} catch (Exception ex) {
		throw new RuntimeException(ex);
	}
}
 
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:11,代码来源:XmlAdapterUtils.java

示例6: unmarshallJAXBElement

import javax.xml.bind.annotation.adapters.XmlAdapter; //导入方法依赖的package包/类
public static <ValueType, BoundType> ValueType unmarshallJAXBElement(
		Class<? extends XmlAdapter<BoundType, ValueType>> xmlAdapterClass,
		JAXBElement<? extends BoundType> v) {
	try {
		if (v == null) {
			return null;
		} else {
			final XmlAdapter<BoundType, ValueType> xmlAdapter = getXmlAdapter(xmlAdapterClass);
			return xmlAdapter.unmarshal(v.getValue());
		}
	} catch (Exception ex) {
		throw new RuntimeException(ex);
	}
}
 
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:15,代码来源:XmlAdapterUtils.java

示例7: uncheckedUnmarshal

import javax.xml.bind.annotation.adapters.XmlAdapter; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static <T> MutableLocatable<?> uncheckedUnmarshal(Object object, XmlAdapter<T, ?> xmlAdapter)
        throws Exception {
    return (MutableLocatable<?>) xmlAdapter.unmarshal((T) object);
}
 
开发者ID:cloudkeeper-project,项目名称:cloudkeeper,代码行数:6,代码来源:MutableLocatableContract.java


注:本文中的javax.xml.bind.annotation.adapters.XmlAdapter.unmarshal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。