gpt4 book ai didi

org.eclipse.persistence.internal.oxm.XMLConversionManager.getDatatypeFactory()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 10:48:40 27 4
gpt4 key购买 nike

本文整理了Java中org.eclipse.persistence.internal.oxm.XMLConversionManager.getDatatypeFactory()方法的一些代码示例,展示了XMLConversionManager.getDatatypeFactory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLConversionManager.getDatatypeFactory()方法的具体详情如下:
包路径:org.eclipse.persistence.internal.oxm.XMLConversionManager
类名称:XMLConversionManager
方法名:getDatatypeFactory

XMLConversionManager.getDatatypeFactory介绍

[英]INTERNAL: Return the DatatypeFactory instance.
[中]内部:返回DatatypeFactory实例。

代码示例

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Return a Duration created with a given date string.
 *
 * @param dateString
 * @return
 */
public Duration convertStringToDuration(String sourceString) {
  return getDatatypeFactory().newDuration(sourceString);
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Return a Duration created with a given date string.
 *
 * @param dateString
 * @return
 */
public Duration convertStringToDuration(String sourceString) {
  if(sourceString == null || sourceString.length() == 0) {
    return null;
  }
  return getDatatypeFactory().newDuration(sourceString);
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * Return a Duration created with a given date string.
 *
 * @param dateString
 * @return
 */
public Duration convertStringToDuration(String sourceString) {
  if(sourceString == null || sourceString.length() == 0) {
    return null;
  }
  return getDatatypeFactory().newDuration(sourceString);
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Return an XMLGregorianCalander created with a given date string
 *
 * @param dateString
 * @return
 */
public XMLGregorianCalendar convertStringToXMLGregorianCalendar(String sourceString) {
  XMLGregorianCalendar calToReturn = null;
  try {
    calToReturn = getDatatypeFactory().newXMLGregorianCalendar(sourceString);
  } catch (IllegalArgumentException e1) {
    try {
      // GMonths have different representations depending on JDK version:
      // JDK 1.5: "--MM--"   JDK 1.6: "--MM"
      // If we caught an IllegalArgument, try the 1.5 syntax
      calToReturn = getDatatypeFactory().newXMLGregorianCalendar(sourceString + "--");
    } catch (IllegalArgumentException e2) {
      throw e1;
    }
  }
      
  return calToReturn;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

calToReturn = getDatatypeFactory().newXMLGregorianCalendar(trimmedSourceString);
} catch (IllegalArgumentException e1) {
  try {
      calToReturn = getDatatypeFactory().newXMLGregorianCalendar(retryString);
    } else {
      throw e1;

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

calToReturn = getDatatypeFactory().newXMLGregorianCalendar(trimmedSourceString);
} catch (IllegalArgumentException e1) {
  try {
      calToReturn = getDatatypeFactory().newXMLGregorianCalendar(retryString);
    } else {
      throw e1;

代码示例来源: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/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: 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: com.haulmont.thirdparty/eclipselink

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();
  string = appendMillis(string, sourceTime.getTime());
  return appendTimeZone(string, sourceTime);
}

代码示例来源: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/com.springsource.org.eclipse.persistence

private String stringFromSQLDate(java.sql.Date sourceDate) {
  XMLGregorianCalendar xgc = getDatatypeFactory().newXMLGregorianCalendar();
  GregorianCalendar cal = new GregorianCalendar(getTimeZone());
  cal.setGregorianChange(new Date(Long.MIN_VALUE));
  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

private String stringFromSQLDate(java.sql.Date sourceDate) {
  XMLGregorianCalendar xgc = getDatatypeFactory().newXMLGregorianCalendar();
  GregorianCalendar cal = new GregorianCalendar(getTimeZone());
  cal.setGregorianChange(new Date(Long.MIN_VALUE));
  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

/**
 * 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: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * This method returns a dateTime string representing a given
 * Timestamp.
 *
 * BC dates (sourceDate.getTime() < YEAR_ONE_AD_TIME) are handled
 * as follows: '2007 BC' --> '-2006 AD'
 *
 * @param sourceDate
 * @return
 */
private String stringFromTimestamp(Timestamp sourceDate) {
  Calendar cal = Calendar.getInstance(getTimeZone());
  cal.setTime(sourceDate);
  XMLGregorianCalendar xgc = getDatatypeFactory().newXMLGregorianCalendar();
  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));
  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 = appendNanos(string, sourceDate);
  return appendTimeZone(string, sourceDate);
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * 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) {
  XMLGregorianCalendar xgc = getDatatypeFactory().newXMLGregorianCalendar();
  GregorianCalendar cal = new GregorianCalendar(getTimeZone());
  cal.setGregorianChange(new Date(Long.MIN_VALUE));
  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));
  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, sourceDate.getTime());
  string = appendTimeZone(string);
  return string;
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * This method returns a dateTime string representing a given
 * Timestamp.
 *
 * BC dates (sourceDate.getTime() < YEAR_ONE_AD_TIME) are handled
 * as follows: '2007 BC' --> '-2006 AD'
 *
 * @param sourceDate
 * @return
 */
private String stringFromTimestamp(Timestamp sourceDate) {
  GregorianCalendar cal = new GregorianCalendar(getTimeZone());
  cal.setGregorianChange(new Date(Long.MIN_VALUE));
  cal.setTime(sourceDate);
  XMLGregorianCalendar xgc = getDatatypeFactory().newXMLGregorianCalendar();
  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));
  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 = appendNanos(string, sourceDate);
  return appendTimeZone(string);
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * This method returns a dateTime string representing a given
 * Timestamp.
 *
 * BC dates (sourceDate.getTime() < YEAR_ONE_AD_TIME) are handled
 * as follows: '2007 BC' --> '-2006 AD'
 *
 * @param sourceDate
 * @return
 */
private String stringFromTimestamp(Timestamp sourceDate) {
  GregorianCalendar cal = new GregorianCalendar(getTimeZone());
  cal.setGregorianChange(new Date(Long.MIN_VALUE));
  cal.setTime(sourceDate);
  XMLGregorianCalendar xgc = getDatatypeFactory().newXMLGregorianCalendar();
  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));
  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 = appendNanos(string, sourceDate);
  return appendTimeZone(string, sourceDate);
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

XMLGregorianCalendar xgc = getDatatypeFactory().newXMLGregorianCalendar();

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com