- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.eclipse.persistence.internal.oxm.XMLConversionManager
类的一些代码示例,展示了XMLConversionManager
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLConversionManager
类的具体详情如下:
包路径:org.eclipse.persistence.internal.oxm.XMLConversionManager
类名称:XMLConversionManager
[英]INTERNAL:
Purpose: Primarily used to convert objects from a given XML Schema type to a different type in Java. Uses a singleton instance
[中]内部:
用途:主要用于将对象从给定的XML模式类型转换为Java中的其他类型。使用单例实例
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
public String convertArrayToString(Object[] sourceObject, QName schemaType) throws ConversionException {
StringBuilder returnStringBuilder = new StringBuilder();
for (int i = 0, listSize = sourceObject.length; i < listSize; i++) {
Object next = sourceObject[i];
if (i > 0) {
returnStringBuilder.append(' ');
}
returnStringBuilder.append((String)convertObject(next, String.class, schemaType));
}
return returnStringBuilder.toString();
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
public ConversionManager getConversionManager() {
// Lazy init for serialization.
if (conversionManager == null) {
//Clone the default to allow customers to easily override the conversion manager
conversionManager = (XMLConversionManager)XMLConversionManager.getDefaultXMLManager().clone();
}
return conversionManager;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
public static XMLConversionManager getDefaultXMLManager() {
if (defaultXMLManager == null) {
defaultXMLManager = new XMLConversionManager();
}
return defaultXMLManager;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
public Calendar convertStringToCalendar(String sourceString, QName schemaTypeQName) {
XMLGregorianCalendar xmlGregorianCalender = convertStringToXMLGregorianCalendar(sourceString, schemaTypeQName);
if(xmlGregorianCalender == null) {
return null;
}
return toCalendar(xmlGregorianCalender);
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
protected java.sql.Date convertObjectToSQLDate(Object sourceObject, QName schemaTypeQName) {
if (sourceObject instanceof String) {
Date date = convertStringToDate((String) sourceObject, schemaTypeQName);
return new java.sql.Date((date.getTime() / 1000) * 1000);
}
return convertObjectToDate(sourceObject);
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.moxy
String typeStr = param.getType();
XMLConversionManager mgr = new XMLConversionManager();
mgr.setLoader(helper.getClassLoader());
Class typeClass = mgr.convertClassNameToClass(typeStr);
Object parameterValue = mgr.convertObject(valueStr, typeClass);
parameters.add(parameterValue);
parameterTypes.add(typeClass);
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
private void addChoiceElementMapping(XMLField xmlField, String className){
if (xmlField.getLastXPathFragment().nameIsText()) {
XMLDirectMapping xmlMapping = new XMLDirectMapping();
xmlMapping.setAttributeAccessor(temporaryAccessor);
Class theClass = XMLConversionManager.getDefaultXMLManager().convertClassNameToClass(className);
xmlMapping.setAttributeClassification(theClass);
xmlMapping.setField(xmlField);
this.choiceElementMappings.put(xmlField, xmlMapping);
} else {
XMLCompositeObjectMapping xmlMapping = new XMLCompositeObjectMapping();
xmlMapping.setAttributeAccessor(temporaryAccessor);
if(!className.equals("java.lang.Object")){
xmlMapping.setReferenceClassName(className);
}
xmlMapping.setField(xmlField);
this.choiceElementMappings.put(xmlField, xmlMapping);
}
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.moxy
/**
* Return a Map of user-defined properties. The List of properties (from
* xml) will be merged with the given Map (from annotations). In the
* case of a conflict, xml will win.
*
* Note that this intended to be used when processing type-level user
* properties, as at the property-level, xml completely replaces any
* properties set via annotation.
*
* Typically the key will be a String (property name) and the value a
* String or some other simple type that was converted by
* ConversionManager, i.e. numerical, boolean, temporal.
*
* @param propList
* @return
*/
private Map mergeUserPropertyMap(List<XmlProperty> propList, Map existingMap) {
Map propMap = existingMap;
for (XmlProperty prop : propList) {
Object pvalue = prop.getValue();
if (prop.isSetValueType()) {
pvalue = XMLConversionManager.getDefaultXMLManager().convertObject(
prop.getValue(), XMLConversionManager.getDefaultXMLManager().convertClassNameToClass(prop.getValueType()));
}
propMap.put(prop.getName(), pvalue);
}
return propMap;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
private String stringFromSQLTime(Time sourceTime) {
XMLGregorianCalendar xgc = getDatatypeFactory().newXMLGregorianCalendar();
Calendar cal = Calendar.getInstance(getTimeZone());
cal.setTime(sourceTime);
xgc.setHour(cal.get(Calendar.HOUR_OF_DAY));
xgc.setMinute(cal.get(Calendar.MINUTE));
xgc.setSecond(cal.get(Calendar.SECOND));
String string= xgc.toXMLFormat();
string = appendMillis(string, sourceTime.getTime());
return appendTimeZone(string, sourceTime);
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
private Object convertToSimpleTypeIfPresent(Object objectToAdd, AbstractRecord nestedRow, AbstractSession executionSession){
String stringValue = null;
Element theElement = ((Element) ((DOMRecord)nestedRow).getDOM());
Node textchild = theElement.getFirstChild();
if ((textchild != null) && (textchild.getNodeType() == Node.TEXT_NODE)) {
stringValue = ((Text) textchild).getNodeValue();
if(stringValue != null && getKeepAsElementPolicy() != UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT && getKeepAsElementPolicy()!=UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT){
objectToAdd = stringValue;
}
}
if ((stringValue == null) || stringValue.length() == 0 ) {
return objectToAdd;
}
String type = theElement.getAttributeNS(XMLConstants.SCHEMA_INSTANCE_URL, XMLConstants.SCHEMA_TYPE_ATTRIBUTE);
if ((null != type) && type.length() > 0) {
XPathFragment typeFragment = new XPathFragment(type);
String namespaceURI = ((DOMRecord)nestedRow).resolveNamespacePrefix(typeFragment.getPrefix());
typeFragment.setNamespaceURI(namespaceURI);
QName schemaTypeQName = new QName(namespaceURI, typeFragment.getLocalName());
Class theClass = (Class) XMLConversionManager.getDefaultXMLTypes().get(schemaTypeQName);
if (theClass != null) {
objectToAdd = ((XMLConversionManager) executionSession.getDatasourcePlatform().getConversionManager()).convertObject(stringValue, theClass, schemaTypeQName);
}
}
return objectToAdd;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.sdo
return toCalendar(getXMLConversionManager().convertStringToDuration(dateString), locale);
XMLGregorianCalendar xgc = getXMLConversionManager().convertStringToXMLGregorianCalendar(dateString);
Calendar cal;
if (xgc.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
cal = xgc.toGregorianCalendar(getXMLConversionManager().getTimeZone(), locale, null);
cal.clear(Calendar.ZONE_OFFSET);
} else {
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.moxy
private Map<Object, Object> createUserPropertiesMap(XmlProperty[] properties) {
Map<Object, Object> propMap = new HashMap<Object, Object>();
for (XmlProperty prop : properties) {
Object pvalue = prop.value();
if (!(prop.valueType() == String.class)) {
pvalue = XMLConversionManager.getDefaultXMLManager().convertObject(prop.value(), prop.valueType());
}
propMap.put(prop.name(), pvalue);
}
return propMap;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* The platform holds its own instance of conversion manager to allow customization.
*/
public ConversionManager getConversionManager() {
// For XML we need an XMLConversionManager instance
if (isDOMRecordSupported()) {
// Lazy init for serialization.
if (xmlConversionManager == null) {
// Clone the default to allow customers to easily override the conversion manager
xmlConversionManager = (XMLConversionManager) XMLConversionManager.getDefaultXMLManager().clone();
xmlConversionManager.setLoader(super.getConversionManager().getLoader());
}
return xmlConversionManager;
}
// For non-XML, return the ConversionManager instance from DatasourcePlatform
return super.getConversionManager();
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* This method returns a dateTime string representing a given
* java.util.Date.
*
* BC dates (sourceDate.getTime() < YEAR_ONE_AD_TIME) are handled
* as follows: '2007 BC' --> '-2006 AD'
*
* @param sourceDate
* @return
*/
private String stringFromDate(java.util.Date sourceDate) {
GregorianCalendar cal = new GregorianCalendar(getTimeZone());
cal.setTime(sourceDate);
XMLGregorianCalendar xgc = getDatatypeFactory().newXMLGregorianCalendar(cal);
String string = xgc.toXMLFormat();
string = truncateMillis(string);
return string;
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
public java.util.Date convertStringToDate(String sourceString, QName schemaType) {
XMLGregorianCalendar xmlGregorianCalender = convertStringToXMLGregorianCalendar(sourceString, schemaType);
if (schemaType == null) {
schemaType = xmlGregorianCalender.getXMLSchemaType();
}
XMLGregorianCalendar defaults = getDatatypeFactory().newXMLGregorianCalendar();
defaults.setTimezone(getTimeZone().getRawOffset()/60000);
GregorianCalendar cal;
if(xmlGregorianCalender.getTimezone() == DatatypeConstants.FIELD_UNDEFINED){
cal = xmlGregorianCalender.toGregorianCalendar(getTimeZone(), null, null);
}else{
cal = xmlGregorianCalender.toGregorianCalendar();
}
cal.setGregorianChange(new Date(Long.MAX_VALUE));
Date returnDate= cal.getTime();
return returnDate;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* @since EclipseLink 2.6.0
* @param javaType The type you want to find a corresponding schema type for.
* @return the schema type for the Java class.
*/
@Override
public QName schemaType(Class<?> javaType) {
return (QName) getDefaultJavaTypes().get(javaType);
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
private String stringFromSQLTime(Time sourceTime) {
XMLGregorianCalendar xgc = getDatatypeFactory().newXMLGregorianCalendar();
GregorianCalendar cal = new GregorianCalendar(getTimeZone());
cal.setGregorianChange(new Date(Long.MIN_VALUE));
cal.setTime(sourceTime);
xgc.setHour(cal.get(Calendar.HOUR_OF_DAY));
xgc.setMinute(cal.get(Calendar.MINUTE));
xgc.setSecond(cal.get(Calendar.SECOND));
String string= xgc.toXMLFormat();
return appendTimeZone(string);
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* INTERNAL
* Return the class for a given qualified XML Schema type
* @param qname The qualified name of the XML Schema type to use as a key in the lookup
* @return The class corresponding to the specified schema type, if no corresponding match found returns null
*/
public Class getJavaClass(QName qname) {
return getJavaClass(qname, XMLConversionManager.getDefaultXMLManager());
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
private String stringFromSQLDate(java.sql.Date sourceDate) {
XMLGregorianCalendar xgc = getDatatypeFactory().newXMLGregorianCalendar();
Calendar cal = Calendar.getInstance(getTimeZone());
cal.setTime(sourceDate);
if(cal.get(Calendar.ERA) == GregorianCalendar.BC){
xgc.setYear(-cal.get(Calendar.YEAR));
}else{
xgc.setYear(cal.get(Calendar.YEAR));
}
xgc.setMonth(cal.get(Calendar.MONTH)+1);
xgc.setDay(cal.get(Calendar.DAY_OF_MONTH));
return xgc.toXMLFormat();
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* Ensures that XSD dateTimes will always be unmarshalled as XMLGregorianCalendars, and never
* as GregorianCalendars. CALENDAR entries are removed from the default XMLConversionManager,
* and replaced with XML_GREGORIAN_CALENDAR.
*/
private static void fixDateTimeConversion(DynamicJAXBContext ctx) {
XMLConversionManager conversionManager = (XMLConversionManager) ctx.getXMLContext().getSession().getDatasourcePlatform().getConversionManager();
Map defaultXmlTypes = conversionManager.getDefaultXMLTypes();
defaultXmlTypes.remove(Constants.DATE_TIME_QNAME);
defaultXmlTypes.put(Constants.DATE_TIME_QNAME, CoreClassConstants.XML_GREGORIAN_CALENDAR);
Map defaultJavaTypes = conversionManager.getDefaultJavaTypes();
defaultJavaTypes.remove(CoreClassConstants.CALENDAR);
defaultJavaTypes.put(CoreClassConstants.XML_GREGORIAN_CALENDAR, Constants.DATE_TIME_QNAME);
}
我正在使用 jersey( 编写 jax-rs Restful 应用程序,GET 请求很好,但 POST、PUT 和 DELETE 请求给出以下错误 SEVERE: Servlet.service()
从旧版自由式 Web 服务中,我收到以下类型的数据: value1 value2 ... valueN 元素名称 key1, key2, ... 事先未知,并且可以
这与 my prior question 相关一般来说,这更针对 JAXB。但这个问题与 spring-oxm 中的解码器更相关。我想看看是否可以使用 spring-oxm 解码器仅解码 XML 中的
本文整理了Java中org.eclipse.persistence.oxm.XMLRoot类的一些代码示例,展示了XMLRoot类的具体用法。这些代码示例主要来源于Github/Stackoverfl
本文整理了Java中org.eclipse.persistence.oxm.XMLMarshaller类的一些代码示例,展示了XMLMarshaller类的具体用法。这些代码示例主要来源于Github
本文整理了Java中org.eclipse.persistence.oxm.XMLLogin类的一些代码示例,展示了XMLLogin类的具体用法。这些代码示例主要来源于Github/Stackover
尽管我已经成为一名开发人员有一段时间了,但我很幸运能够避免使用 XML 进行大量工作。所以现在我有一个项目,我必须在其中与一些 Web 服务进行交互,并且想使用某种对象到 XML 映射解决方案。 我唯
本文整理了Java中org.eclipse.persistence.internal.oxm.XPathFragment类的一些代码示例,展示了XPathFragment类的具体用法。这些代码示例主要
本文整理了Java中org.eclipse.persistence.oxm.annotations.XmlPath类的一些代码示例,展示了XmlPath类的具体用法。这些代码示例主要来源于Github
本文整理了Java中org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping类的一些代码示例,展示了XMLCompositeObje
本文整理了Java中org.eclipse.persistence.internal.oxm.XMLConversionManager类的一些代码示例,展示了XMLConversionManager类
本文整理了Java中org.eclipse.persistence.oxm.mappings.XMLTransformationMapping类的一些代码示例,展示了XMLTransformation
本文整理了Java中org.eclipse.persistence.oxm.mappings.XMLInverseReferenceMapping类的一些代码示例,展示了XMLInverseRefer
本文整理了Java中org.eclipse.persistence.internal.oxm.XPathNode类的一些代码示例,展示了XPathNode类的具体用法。这些代码示例主要来源于Githu
本文整理了Java中org.eclipse.persistence.oxm.mappings.XMLObjectReferenceMapping类的一些代码示例,展示了XMLObjectReferen
本文整理了Java中org.eclipse.persistence.oxm.mappings.XMLBinaryDataMapping类的一些代码示例,展示了XMLBinaryDataMapping类
本文整理了Java中org.eclipse.persistence.oxm.mappings.XMLAnyCollectionMapping类的一些代码示例,展示了XMLAnyCollectionMa
本文整理了Java中org.eclipse.persistence.oxm.schema.XMLSchemaReference类的一些代码示例,展示了XMLSchemaReference类的具体用法。
本文整理了Java中org.eclipse.persistence.oxm.mappings.XMLChoiceObjectMapping类的一些代码示例,展示了XMLChoiceObjectMapp
本文整理了Java中org.eclipse.persistence.oxm.mappings.XMLChoiceCollectionMapping类的一些代码示例,展示了XMLChoiceCollec
我是一名优秀的程序员,十分优秀!