本文整理了Java中javax.xml.datatype.XMLGregorianCalendar.setYear()
方法的一些代码示例,展示了XMLGregorianCalendar.setYear()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLGregorianCalendar.setYear()
方法的具体详情如下:
包路径:javax.xml.datatype.XMLGregorianCalendar
类名称:XMLGregorianCalendar
方法名:setYear
[英]Set year of XSD dateTime
year field.
Unset this field by invoking the setter with a parameter value of DatatypeConstants#FIELD_UNDEFINED.
Note: if the absolute value of the year
parameter is less than 10^9, the eon component of the XSD year field is set to null
by this method.
[中]设置XSD的年份dateTime
年字段。
通过调用参数值为DatatypeConstants#field_UNDEFINED的setter来取消设置此字段。
注意:如果year
参数的绝对值小于10^9,则XSD年份字段的eon组件将通过此方法设置为null
。
代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore
@Override
public void setYear(BigInteger year)
{
xmlGregorianCalendar.setYear(year);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore
@Override
public void setYear(BigInteger year)
{
xmlGregorianCalendar.setYear(year);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore
@Override
public void setYear(int year)
{
xmlGregorianCalendar.setYear(year);
}
代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore
@Override
public void setYear(int year)
{
xmlGregorianCalendar.setYear(year);
}
代码示例来源:origin: mulesoft/mule
@Test
public void fromXMLCalendar() throws DatatypeConfigurationException {
XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
xmlCal.setYear(1900);
xmlCal.setMonth(1);
xmlCal.setDay(1);
assertEquals(1900, new DateTime(xmlCal).getYear());
assertEquals(1, new DateTime(xmlCal).getMonth());
assertEquals(1, new DateTime(xmlCal).getDayOfMonth());
}
代码示例来源:origin: mulesoft/mule
@Test
public void fromXMLCalendar() throws DatatypeConfigurationException {
XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
xmlCal.setYear(1900);
xmlCal.setMonth(1);
xmlCal.setDay(1);
assertEquals(1900, new DateTime(xmlCal).getYear());
assertEquals(1, new DateTime(xmlCal).getMonth());
assertEquals(1, new DateTime(xmlCal).getDayOfMonth());
}
代码示例来源:origin: mulesoft/mule
@Test
public void fromXMLCalendar() throws DatatypeConfigurationException {
XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
xmlCal.setYear(1900);
xmlCal.setMonth(1);
xmlCal.setDay(1);
assertEquals(1900, new DateTime(xmlCal).getYear());
assertEquals(1, new DateTime(xmlCal).getMonth());
assertEquals(1, new DateTime(xmlCal).getDayOfMonth());
}
代码示例来源:origin: org.openprovenance.prov/prov-model
public XMLGregorianCalendar newYear(int year) {
XMLGregorianCalendar res=dataFactory.newXMLGregorianCalendar();
res.setYear(year);
return res;
}
public Collection<Attribute> getAttributes(Statement statement) {
代码示例来源:origin: highsource/hyperjaxb3
@SuppressWarnings("deprecation")
@Override
public void createCalendar(Date date, XMLGregorianCalendar calendar) {
calendar.setYear(date.getYear() + 1900);
}
代码示例来源:origin: org.openprovenance.prov/prov-model
public XMLGregorianCalendar newGYear(int year) {
XMLGregorianCalendar cal=dataFactory.newXMLGregorianCalendar();
cal.setYear(year);
return cal;
}
代码示例来源:origin: lucmoreau/ProvToolbox
public XMLGregorianCalendar newYear(int year) {
XMLGregorianCalendar res=dataFactory.newXMLGregorianCalendar();
res.setYear(year);
return res;
}
public Collection<Attribute> getAttributes(Statement statement) {
代码示例来源:origin: stackoverflow.com
XMLGregorianCalendar xmlC;
Calendar cal=Calendar.getInstance();
try {
xmlC = DatatypeFactory.newInstance().newXMLGregorianCalendar();
xmlC.setYear(cal.get(Calendar.YEAR));
....
代码示例来源:origin: org.jvnet.hyperjaxb3/hyperjaxb3-ejb-runtime
@SuppressWarnings("deprecation")
@Override
public void createCalendar(Date date, XMLGregorianCalendar calendar) {
calendar.setYear(date.getYear() + 1900);
calendar.setMonth(date.getMonth() + 1);
}
}
代码示例来源:origin: stackoverflow.com
XMLGregorianCalendar xgc = DatatypeFactory.newInstance().newXMLGregorianCalendar();
GregorianCalendar now = new GregorianCalendar();
xgc.setYear(now.get(Calendar.YEAR));
xgc.setMonth(now.get(Calendar.MONTH) + 1);
xgc.setDay(now.get(Calendar.DAY_OF_MONTH));
System.out.println(xgc);
代码示例来源:origin: org.jvnet.hyperjaxb3/hyperjaxb3-ejb-runtime
@SuppressWarnings("deprecation")
@Override
public void createCalendar(Date date, XMLGregorianCalendar calendar) {
calendar.setYear(date.getYear() + 1900);
calendar.setMonth(date.getMonth() + 1);
calendar.setDay(date.getDate());
}
}
代码示例来源:origin: org.jvnet.hyperjaxb3/hyperjaxb3-ejb-runtime
@SuppressWarnings("deprecation")
@Override
public void createCalendar(Date date, XMLGregorianCalendar calendar) {
calendar.setYear(date.getYear() + 1900);
calendar.setMonth(date.getMonth() + 1);
calendar.setDay(date.getDate());
calendar.setHour(date.getHours());
calendar.setMinute(date.getMinutes());
calendar.setSecond(date.getSeconds());
calendar.setMillisecond((int) (date.getTime() % 1000));
}
}
代码示例来源:origin: highsource/hyperjaxb3
@SuppressWarnings("deprecation")
@Override
public void createCalendar(Date date, XMLGregorianCalendar calendar) {
calendar.setYear(date.getYear() + 1900);
calendar.setMonth(date.getMonth() + 1);
calendar.setDay(date.getDate());
calendar.setHour(date.getHours());
calendar.setMinute(date.getMinutes());
calendar.setSecond(date.getSeconds());
calendar.setMillisecond((int) (date.getTime() % 1000));
}
}
代码示例来源:origin: org.mule.runtime/mule-core-tests
@Test
public void fromXMLCalendar() throws DatatypeConfigurationException {
XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
xmlCal.setYear(1900);
xmlCal.setMonth(1);
xmlCal.setDay(1);
assertEquals(1900, new DateTime(xmlCal).getYear());
assertEquals(1, new DateTime(xmlCal).getMonth());
assertEquals(1, new DateTime(xmlCal).getDayOfMonth());
}
代码示例来源:origin: org.mule.runtime/mule-core-tests
@Test
public void fromXMLCalendar() throws DatatypeConfigurationException {
XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
xmlCal.setYear(1900);
xmlCal.setMonth(1);
xmlCal.setDay(1);
assertEquals(1900, new DateTime(xmlCal).getYear());
assertEquals(1, new DateTime(xmlCal).getMonth());
assertEquals(1, new DateTime(xmlCal).getDayOfMonth());
}
代码示例来源:origin: org.mule.runtime/mule-core-tests
@Test
public void fromXMLCalendar() throws DatatypeConfigurationException {
XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
xmlCal.setYear(1900);
xmlCal.setMonth(1);
xmlCal.setDay(1);
assertEquals(1900, new DateTime(xmlCal).getYear());
assertEquals(1, new DateTime(xmlCal).getMonth());
assertEquals(1, new DateTime(xmlCal).getDayOfMonth());
}
内容来源于网络,如有侵权,请联系作者删除!