org.joda.time.Partial.withField()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(112)

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

Partial.withField介绍

[英]Gets a copy of this Partial with the specified field set to a new value.

If this partial does not support the field, an exception is thrown. Contrast this behaviour with #with(DateTimeFieldType,int).

For example, if the field type is dayOfMonth then the day would be changed in the returned instance if supported.
[中]获取此分部的副本,并将指定字段设置为新值。
如果此部分不支持该字段,则会引发异常。将此行为与#with(DateTimeFieldType,int)进行对比。
例如,如果字段类型为dayOfMonth,则返回的实例中的日期将被更改(如果支持)。

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

public static Partial getPartial(Instant t, Partial p)
{
 Partial res = new Partial(p);
 for (int i = 0; i < p.size(); i++) {
  res = res.withField(p.getFieldType(i), t.get(p.getFieldType(i)));
 }
 return res;
}

代码示例来源:origin: stanfordnlp/CoreNLP

Partial p2 = p.base.withField(DateTimeFieldType.centuryOfEra(), p.base.get(DateTimeFieldType.centuryOfEra()) + unsupported.getYears() / 100);
p = new PartialTime(p, p2);
unsupported = unsupported.withYears(0);

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

Partial p2 = p.base.withField(DateTimeFieldType.centuryOfEra(), p.base.get(DateTimeFieldType.centuryOfEra()) + unsupported.getYears() / 100);
p = new PartialTime(p, p2);
unsupported = unsupported.withYears(0);

代码示例来源:origin: com.guokr/stan-cn-com

public static Partial getPartial(Instant t, Partial p)
{
 Partial res = new Partial(p);
 for (int i = 0; i < p.size(); i++) {
  res = res.withField(p.getFieldType(i), t.get(p.getFieldType(i)));
 }
 return res;
}

代码示例来源:origin: com.guokr/stan-cn-com

Partial p2 = p.base.withField(DateTimeFieldType.centuryOfEra(), p.base.get(DateTimeFieldType.centuryOfEra()) + unsupported.getYears() / 100);
p = new PartialTime(p, p2);
unsupported = unsupported.withYears(0);

代码示例来源:origin: edu.stanford.nlp/corenlp

public static Partial getPartial(Instant t, Partial p)
{
 Partial res = new Partial(p);
 for (int i = 0; i < p.size(); i++) {
  res = res.withField(p.getFieldType(i), t.get(p.getFieldType(i)));
 }
 return res;
}

代码示例来源:origin: edu.stanford.nlp/corenlp

Partial p2 = p.base.withField(DateTimeFieldType.centuryOfEra(), p.base.get(DateTimeFieldType.centuryOfEra()) + unsupported.getYears() / 100);
p = new PartialTime(p, p2);
unsupported = unsupported.withYears(0);

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

public static Partial getPartial(Instant t, Partial p)
{
 Partial res = new Partial(p);
 for (int i = 0; i < p.size(); i++) {
  res = res.withField(p.getFieldType(i), t.get(p.getFieldType(i)));
 }
 return res;
}

相关文章