本文整理汇总了Java中java.util.Date.clone方法的典型用法代码示例。如果您正苦于以下问题:Java Date.clone方法的具体用法?Java Date.clone怎么用?Java Date.clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Date
的用法示例。
在下文中一共展示了Date.clone方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HandlingEvent
import java.util.Date; //导入方法依赖的package包/类
/**
* @param cargo The cargo
* @param completionTime completion time, the reported time that the event
* actually happened (e.g. the receive took place).
* @param registrationTime registration time, the time the message is
* received
* @param type type of event
* @param location where the event took place
* @param voyage the voyage
*/
public HandlingEvent(Cargo cargo, Date completionTime,
Date registrationTime, Type type, Location location, Voyage voyage) {
Validate.notNull(cargo, "Cargo is required");
Validate.notNull(completionTime, "Completion time is required");
Validate.notNull(registrationTime, "Registration time is required");
Validate.notNull(type, "Handling event type is required");
Validate.notNull(location, "Location is required");
Validate.notNull(voyage, "Voyage is required");
if (type.prohibitsVoyage()) {
throw new IllegalArgumentException(
"Voyage is not allowed with event type " + type);
}
this.voyage = voyage;
this.completionTime = (Date) completionTime.clone();
this.registrationTime = (Date) registrationTime.clone();
this.type = type;
this.location = location;
this.cargo = cargo;
this.id=(long)(Math.random()*Long.MAX_VALUE);
}
示例2: setDate
import java.util.Date; //导入方法依赖的package包/类
public void setDate(final Date date) {
if (date == null) {
throw new IllegalArgumentException("date may not be null");
}
this.currentDate = (Date) date.clone();
this.display.setText(dateFormat.format(currentDate));
if (this.dialog != null) {
final GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(getDate());
this.dialog.updateDate(
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH)
);
}
}
示例3: doOperation
import java.util.Date; //导入方法依赖的package包/类
@Override
protected boolean doOperation(ActivateRequest request, ActivateRequestDao dao)
{
Date now = params.getDateNow();
if( request.getUntil().after(now) && request.getStatus() == ActivateRequest.TYPE_ACTIVE )
{
Date cancellationDate = (Date) now.clone();
// Just before 'from'/'now': Don't want crossover!
cancellationDate.setTime(cancellationDate.getTime() - 1);
request.setStatus(ActivateRequest.TYPE_INACTIVE);
request.setUntil(cancellationDate);
dao.update(request);
}
return true;
}
示例4: HandlingEvent
import java.util.Date; //导入方法依赖的package包/类
/**
* @param cargo cargo
* @param completionTime completion time, the reported time that the event actually happened (e.g. the receive took place).
* @param registrationTime registration time, the time the message is received
* @param type type of event
* @param location where the event took place
*/
public HandlingEvent(final Cargo cargo,
final Date completionTime,
final Date registrationTime,
final HandlingEventType type,
final Location location) {
Validate.notNull(cargo, "Cargo is required");
Validate.notNull(completionTime, "Completion time is required");
Validate.notNull(registrationTime, "Registration time is required");
Validate.notNull(type, "Handling event type is required");
Validate.notNull(location, "Location is required");
if (type.requiresVoyage()) {
throw new IllegalArgumentException("Voyage is required for event type " + type);
}
this.completionTime = (Date) completionTime.clone();
this.registrationTime = (Date) registrationTime.clone();
this.type = type;
this.location = location;
this.cargo = cargo;
this.voyage = null;
}
示例5: setStartTime
import java.util.Date; //导入方法依赖的package包/类
/**
*
* @param startTime 开始时间
*/
public void setStartTime(final Date startTime) {
if(startTime==null){
this.startTime = null;
}else{
this.startTime = (Date) startTime.clone();
}
}
示例6: RouteSpecification
import java.util.Date; //导入方法依赖的package包/类
/**
* @param origin origin location - can't be the same as the destination
* @param destination destination location - can't be the same as the origin
* @param arrivalDeadline arrival deadline
*/
public RouteSpecification(Location origin, Location destination,
Date arrivalDeadline) {
Validate.notNull(origin, "Origin is required");
Validate.notNull(destination, "Destination is required");
Validate.notNull(arrivalDeadline, "Arrival deadline is required");
Validate.isTrue(!origin.sameIdentityAs(destination),
"Origin and destination can't be the same: " + origin);
this.origin = origin;
this.destination = destination;
this.arrivalDeadline = (Date) arrivalDeadline.clone();
}
示例7: setChangeListDate
import java.util.Date; //导入方法依赖的package包/类
/**
* Change list date.
*
* @param changeListDate
*/
public void setChangeListDate(final Date changeListDate) {
if (changeListDate == null) {
return;
}
this.changeListDate = (Date) changeListDate.clone();
}
示例8: JWTPrincipal
import java.util.Date; //导入方法依赖的package包/类
public JWTPrincipal(
final String login,
final String firstName,
final String lastName,
final List<String> permissions,
final Date beginActivationSession) {
this.login = login;
this.firstName = firstName;
this.lastName = lastName;
this.permissions = permissions;
this.beginActivationSession = beginActivationSession != null ? (Date) beginActivationSession.clone() : null;
}
示例9: setRefreshTime
import java.util.Date; //导入方法依赖的package包/类
/**
*
* @param refreshTime 更新时间
*/
public void setRefreshTime(final Date refreshTime) {
if(refreshTime==null){
this.refreshTime = null;
}else{
this.refreshTime = (Date) refreshTime.clone();
}
}
示例10: setDueOn
import java.util.Date; //导入方法依赖的package包/类
@JsonProperty("due_on")
public void setDueOn(Date dueOn) {
this.dueOn = dueOn == null ? null : (Date) dueOn.clone();
}
示例11: setCreatedAt
import java.util.Date; //导入方法依赖的package包/类
@JsonProperty("created_at")
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt == null ? null : (Date) createdAt.clone();
}
示例12: setDate
import java.util.Date; //导入方法依赖的package包/类
/**
* Sets the time for which the validity of the certification path
* should be determined. If {@code null}, the current time is used.
* <p>
* Note that the {@code Date} supplied here is copied to protect
* against subsequent modifications.
*
* @param date the {@code Date}, or {@code null} for the
* current time
* @see #getDate
*/
public void setDate(Date date) {
if (date != null)
this.date = (Date) date.clone();
else
date = null;
}
示例13: setBuildStartedAt
import java.util.Date; //导入方法依赖的package包/类
/**
* Sets required date and time the build started at.
*
* @param startedAt date and time the build started at.
*/
public final void setBuildStartedAt(final Date startedAt) {
this.buildStartedAt = (Date) startedAt.clone();
}