本文整理匯總了Java中org.joda.time.Instant.toString方法的典型用法代碼示例。如果您正苦於以下問題:Java Instant.toString方法的具體用法?Java Instant.toString怎麽用?Java Instant.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.joda.time.Instant
的用法示例。
在下文中一共展示了Instant.toString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: apply
import org.joda.time.Instant; //導入方法依賴的package包/類
/**
* input - a tupel that contains the data element (TableRow), the window, the timestamp, and the pane
*/
@Override
public TableDestination apply(ValueInSingleWindow<TableRow> input) {
String partition;
if (this.isTimeField) {
String sTime = (String) input.getValue().get(this.fieldName);
Instant time = Instant.parse(sTime);
partition = time.toString(partitionFormatter);
} else {
partition = ((Integer) input.getValue().get(this.fieldName)).toString();
}
TableReference reference = new TableReference();
reference.setProjectId(this.projectId);
reference.setDatasetId(this.datasetId);
reference.setTableId(this.partitionPrefix + partition);
return new TableDestination(reference, null);
}
示例2: formatTimestamp
import org.joda.time.Instant; //導入方法依賴的package包/類
/**
* Formats a {@link Instant} timestamp with additional Beam-specific metadata, such as indicating
* whether the timestamp is the end of the global window or one of the distinguished values {@link
* #TIMESTAMP_MIN_VALUE} or {@link #TIMESTAMP_MIN_VALUE}.
*/
public static String formatTimestamp(Instant timestamp) {
if (timestamp.equals(TIMESTAMP_MIN_VALUE)) {
return timestamp.toString() + " (TIMESTAMP_MIN_VALUE)";
} else if (timestamp.equals(TIMESTAMP_MAX_VALUE)) {
return timestamp.toString() + " (TIMESTAMP_MAX_VALUE)";
} else if (timestamp.equals(GlobalWindow.INSTANCE.maxTimestamp())) {
return timestamp.toString() + " (end of global window)";
} else {
return timestamp.toString();
}
}