本文整理了Java中org.orcid.jaxb.model.v3.rc2.common.Year
类的一些代码示例,展示了Year
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Year
类的具体详情如下:
包路径:org.orcid.jaxb.model.v3.rc2.common.Year
类名称:Year
[英]Java class for anonymous complex type.
The following schema fragment specifies the expected content contained within this class. *
[中]匿名复杂类型的Java类。
以下架构片段指定了该类中包含的预期内容*
代码示例来源:origin: ORCID/ORCID-Source
public static boolean isEmpty(org.orcid.jaxb.model.v3.rc2.common.Year year) {
if (year==null) return true;
return isEmpty(year.getValue());
}
代码示例来源:origin: ORCID/ORCID-Source
public static FuzzyDate valueOf(Integer year, Integer month, Integer day) {
FuzzyDate fuzzyDate = new FuzzyDate();
fuzzyDate.year = year != null ? new Year(year) : null;
fuzzyDate.month = month != null ? new Month(month) : null;
fuzzyDate.day = day != null ? new Day(day) : null;
return fuzzyDate;
}
代码示例来源:origin: ORCID/ORCID-Source
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
FuzzyDate other = (FuzzyDate) obj;
if (day == null) {
if (other.day != null)
return false;
} else if (!day.equals(other.day))
return false;
if (month == null) {
if (other.month != null)
return false;
} else if (!month.equals(other.month))
return false;
if (year == null) {
if (other.year != null)
return false;
} else if (!year.equals(other.year))
return false;
return true;
}
代码示例来源:origin: ORCID/ORCID-Source
public FuzzyDate(org.orcid.jaxb.model.message.FuzzyDate other) {
if (other == null)
throw new IllegalArgumentException("Invalid init parameter");
if (other.getYear() != null) {
this.year = new Year();
this.year.setValue(other.getYear().getValue());
}
if (other.getMonth() != null) {
this.month = new Month();
this.month.setValue(other.getMonth().getValue());
}
if (other.getDay() != null) {
this.day = new Day();
this.day.setValue(other.getDay().getValue());
}
}
代码示例来源:origin: ORCID/ORCID-Source
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((day == null) ? 0 : day.hashCode());
result = prime * result + ((month == null) ? 0 : month.hashCode());
result = prime * result + ((year == null) ? 0 : year.hashCode());
return result;
}
代码示例来源:origin: ORCID/ORCID-Source
@Override
public String toString() {
StringBuilder builder = new StringBuilder(year.getValue());
if (month != null) {
builder.append("-");
builder.append(month.getValue());
}
if (day != null) {
builder.append("-");
builder.append(day.getValue());
}
return builder.toString();
}
代码示例来源:origin: ORCID/ORCID-Source
public FuzzyDate toFuzzyDate() {
FuzzyDate fd = new FuzzyDate();
if (!PojoUtil.isEmpty(this.getDay()))
fd.setDay(new Day(new Integer(this.getDay())));
if (!PojoUtil.isEmpty(this.getMonth()))
fd.setMonth(new Month(new Integer(this.getMonth())));
if (!PojoUtil.isEmpty(this.getYear()))
fd.setYear(new Year(new Integer(this.getYear())));
return fd;
}
代码示例来源:origin: ORCID/ORCID-Source
private static void populateFromFuzzyDate(FuzzyDateEntity fuzzyDateEntity, FuzzyDate fuzzyDate) {
if (fuzzyDate != null) {
Year Year = fuzzyDate.getYear();
if (Year != null) {
fuzzyDateEntity.setYear(Integer.valueOf(Year.getValue()));
}
Month month = fuzzyDate.getMonth();
if (month != null) {
fuzzyDateEntity.setMonth(Integer.valueOf(month.getValue()));
}
Day day = fuzzyDate.getDay();
if (day != null) {
fuzzyDateEntity.setDay(Integer.valueOf(day.getValue()));
}
}
}
代码示例来源:origin: ORCID/ORCID-Source
public org.orcid.jaxb.model.v3.rc2.common.FuzzyDate toV3FuzzyDate() {
org.orcid.jaxb.model.v3.rc2.common.FuzzyDate fd = new org.orcid.jaxb.model.v3.rc2.common.FuzzyDate();
if (!PojoUtil.isEmpty(this.getDay()))
fd.setDay(new org.orcid.jaxb.model.v3.rc2.common.Day(new Integer(this.getDay())));
if (!PojoUtil.isEmpty(this.getMonth()))
fd.setMonth(new org.orcid.jaxb.model.v3.rc2.common.Month(new Integer(this.getMonth())));
if (!PojoUtil.isEmpty(this.getYear()))
fd.setYear(new org.orcid.jaxb.model.v3.rc2.common.Year(new Integer(this.getYear())));
return fd;
}
代码示例来源:origin: ORCID/ORCID-Source
int year = 0;
try {
year = Integer.parseInt(work.getPublicationDate().getYear().getValue());
} catch (Exception e) {
代码示例来源:origin: ORCID/ORCID-Source
publicationDate.setYear(new Year(c.get(Calendar.YEAR)));
} catch (ParseException e) {
代码示例来源:origin: ORCID/ORCID-Source
public static Date convertDate(org.orcid.jaxb.model.v3.rc2.common.FuzzyDate fuzzyDate) {
if (fuzzyDate != null) {
Integer year = PojoUtil.isEmpty(fuzzyDate.getYear()) ? null : Integer.valueOf(fuzzyDate.getYear().getValue());
Integer month = PojoUtil.isEmpty(fuzzyDate.getMonth()) ? null : Integer.valueOf(fuzzyDate.getMonth().getValue());
Integer day = PojoUtil.isEmpty(fuzzyDate.getDay()) ? null : Integer.valueOf(fuzzyDate.getDay().getValue());
if (year != null && year == 0) {
year = null;
}
if (month != null && month == 0) {
month = null;
}
if (day != null && day == 0) {
day = null;
}
return Date.valueOf(org.orcid.jaxb.model.v3.rc2.common.FuzzyDate.valueOf(year, month, day));
}
return null;
}
}
代码示例来源:origin: ORCID/ORCID-Source
@Override
public void mapBtoA(EndDateEntity entity, FuzzyDate fuzzyDate, MappingContext context) {
if (entity.getYear() != null) {
fuzzyDate.setYear(new Year(entity.getYear()));
} else {
fuzzyDate.setYear(null);
}
if (entity.getMonth() != null) {
fuzzyDate.setMonth(new Month(entity.getMonth()));
} else {
fuzzyDate.setMonth(null);
}
if (entity.getDay() != null) {
fuzzyDate.setDay(new Day(entity.getDay()));
} else {
fuzzyDate.setDay(null);
}
}
}).register();
代码示例来源:origin: ORCID/ORCID-Source
private static Date getCompletionDate(FuzzyDate completionDate) {
if (completionDate != null) {
Integer year = PojoUtil.isEmpty(completionDate.getYear()) ? null : Integer.valueOf(completionDate.getYear().getValue());
Integer month = PojoUtil.isEmpty(completionDate.getMonth()) ? null : Integer.valueOf(completionDate.getMonth().getValue());
Integer day = PojoUtil.isEmpty(completionDate.getDay()) ? null : Integer.valueOf(completionDate.getDay().getValue());
if (year != null && year == 0) {
year = null;
}
if (month != null && month == 0) {
month = null;
}
if (day != null && day == 0) {
day = null;
}
return Date.valueOf(FuzzyDate.valueOf(year, month, day));
}
return null;
}
代码示例来源:origin: ORCID/ORCID-Source
@Override
public void mapBtoA(StartDateEntity entity, FuzzyDate fuzzyDate, MappingContext context) {
if (entity.getYear() != null) {
fuzzyDate.setYear(new Year(entity.getYear()));
} else {
fuzzyDate.setYear(null);
}
if (entity.getMonth() != null) {
fuzzyDate.setMonth(new Month(entity.getMonth()));
} else {
fuzzyDate.setMonth(null);
}
if (entity.getDay() != null) {
fuzzyDate.setDay(new Day(entity.getDay()));
} else {
fuzzyDate.setDay(null);
}
}
}).register();
代码示例来源:origin: ORCID/ORCID-Source
@Override
public void mapAtoB(FuzzyDate fuzzyDate, StartDateEntity entity, MappingContext context) {
if (fuzzyDate.getYear() != null) {
entity.setYear(Integer.valueOf(fuzzyDate.getYear().getValue()));
} else {
entity.setYear(null);
}
if (fuzzyDate.getMonth() != null) {
entity.setMonth(Integer.valueOf(fuzzyDate.getMonth().getValue()));
} else {
entity.setMonth(null);
}
if (fuzzyDate.getDay() != null) {
entity.setDay(Integer.valueOf(fuzzyDate.getDay().getValue()));
} else {
entity.setDay(null);
}
}
代码示例来源:origin: ORCID/ORCID-Source
publicationDate.setYear(new Year(c.get(Calendar.YEAR)));
代码示例来源:origin: ORCID/ORCID-Source
@Override
public void mapAtoB(FuzzyDate fuzzyDate, EndDateEntity entity, MappingContext context) {
if (fuzzyDate.getYear() != null) {
entity.setYear(Integer.valueOf(fuzzyDate.getYear().getValue()));
} else {
entity.setYear(null);
}
if (fuzzyDate.getMonth() != null) {
entity.setMonth(Integer.valueOf(fuzzyDate.getMonth().getValue()));
} else {
entity.setMonth(null);
}
if (fuzzyDate.getDay() != null) {
entity.setDay(Integer.valueOf(fuzzyDate.getDay().getValue()));
} else {
entity.setDay(null);
}
}
代码示例来源:origin: ORCID/ORCID-Source
JSONArray dateArray = dateParts.getJSONArray(0);
publicationDate.setYear(new Year(dateArray.getInt(0)));
publicationDate.setMonth(new Month(dateArray.getInt(1)));
publicationDate.setDay(new Day(dateArray.getInt(2)));
publicationDate.setYear(new Year(year));
if (month != 0) {
publicationDate.setMonth(new Month(month));
代码示例来源:origin: ORCID/ORCID-Source
public static Date valueOf(FuzzyDate fuzzyDate) {
Date d = new Date();
if (fuzzyDate.getDay() != null && fuzzyDate.getDay().getValue() != null)
d.setDay(fuzzyDate.getDay().getValue());
if (fuzzyDate.getMonth() != null && fuzzyDate.getMonth().getValue() != null)
d.setMonth(fuzzyDate.getMonth().getValue());
if (fuzzyDate.getYear() != null && fuzzyDate.getYear().getValue() != null)
d.setYear(fuzzyDate.getYear().getValue());
return d;
}
内容来源于网络,如有侵权,请联系作者删除!