org.exolab.castor.types.Year.toString()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(122)

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

Year.toString介绍

[英]convert this Year to a string The format is defined by W3C XML Schema draft and ISO8601 i.e (+|-)CCYY
[中]将今年转换为字符串该格式由W3C XML模式草案和ISO8601定义,即(+|-)CCYY

代码示例

代码示例来源:origin: org.codehaus.castor/castor-xml

/**
 * Returns the value of the field associated with this descriptor from the given target object.
 *
 * @param target the object to get the value from
 * @return the value of the field associated with this descriptor from the given target object.
 */
public Object getValue(Object target) throws java.lang.IllegalStateException {
 // -- check for Year class -- add later
 Year year = (Year) target;
 return year.toString();
} // -- getValue

代码示例来源:origin: org.codehaus.castor/com.springsource.org.castor

/**
 * Returns the value of the field associated with this descriptor from
 * the given target object.
 *
 * @param target
 *            the object to get the value from
 * @return the value of the field associated with this descriptor from
 *         the given target object.
 */
public Object getValue(Object target) throws java.lang.IllegalStateException {
  //-- check for Year class  -- add later
  Year year = (Year) target;
  return year.toString();
} //-- getValue

代码示例来源:origin: org.codehaus.castor/castor-xml

public java.util.Date toDate() throws ParseException {
 java.util.Date date = null;
 SimpleDateFormat df = new SimpleDateFormat(YEAR_FORMAT);
 SimpleTimeZone timeZone = new SimpleTimeZone(0, "UTC");
 // Set the time zone
 if (!isUTC()) {
  int offset = 0;
  offset = ((this.getZoneMinute() + this.getZoneHour() * 60) * 60 * 1000);
  offset = isZoneNegative() ? -offset : offset;
  timeZone.setRawOffset(offset);
  timeZone.setID(TimeZone.getAvailableIDs(offset)[0]);
 }
 df.setTimeZone(timeZone);
 date = df.parse(this.toString());
 return date;
}// toDate()

代码示例来源:origin: org.codehaus.castor/com.springsource.org.castor

public java.util.Date toDate() throws ParseException {
  java.util.Date date = null;
  SimpleDateFormat df = new SimpleDateFormat(YEAR_FORMAT);
  SimpleTimeZone timeZone = new SimpleTimeZone(0,"UTC");
  // Set the time zone
  if ( !isUTC() ) {
    int offset = 0;
    offset = ( (this.getZoneMinute() + this.getZoneHour()*60)*60*1000);
    offset = isZoneNegative() ? -offset : offset;
    timeZone.setRawOffset(offset);
    timeZone.setID(TimeZone.getAvailableIDs(offset)[0]);
  }
  df.setTimeZone(timeZone);
  date = df.parse(this.toString());
  return date;
}//toDate()

相关文章