當前位置: 首頁>>代碼示例>>Java>>正文


Java Date.clone方法代碼示例

本文整理匯總了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);
}
 
開發者ID:RETIT,項目名稱:continuous-performance-evaluation,代碼行數:33,代碼來源:HandlingEvent.java

示例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)
        );
    }
}
 
開發者ID:PacktPublishing,項目名稱:Hands-On-Android-UI-Development,代碼行數:20,代碼來源:DatePickerWrapper.java

示例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;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:19,代碼來源:DeactivateOperation.java

示例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;
}
 
開發者ID:jboz,項目名稱:living-documentation,代碼行數:30,代碼來源:HandlingEvent.java

示例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();
    }
}
 
開發者ID:Zigin,項目名稱:MonitorPlatform,代碼行數:12,代碼來源:RedisConfig.java

示例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();
}
 
開發者ID:RETIT,項目名稱:continuous-performance-evaluation,代碼行數:18,代碼來源:RouteSpecification.java

示例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();
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:12,代碼來源:AbstractBuildScriptGenerator.java

示例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;
}
 
開發者ID:Crunchy-Torch,項目名稱:coddy,代碼行數:13,代碼來源:JWTPrincipal.java

示例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();
    }
}
 
開發者ID:Zigin,項目名稱:MonitorPlatform,代碼行數:12,代碼來源:RedisConfig.java

示例10: setDueOn

import java.util.Date; //導入方法依賴的package包/類
@JsonProperty("due_on")
public void setDueOn(Date dueOn) {
    this.dueOn = dueOn == null ? null : (Date) dueOn.clone();
}
 
開發者ID:jenkinsci,項目名稱:gitea-plugin,代碼行數:5,代碼來源:GiteaMilestone.java

示例11: setCreatedAt

import java.util.Date; //導入方法依賴的package包/類
@JsonProperty("created_at")
public void setCreatedAt(Date createdAt) {
    this.createdAt = createdAt == null ? null : (Date) createdAt.clone();
}
 
開發者ID:jenkinsci,項目名稱:gitea-plugin,代碼行數:5,代碼來源:GiteaCommitStatus.java

示例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;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:18,代碼來源:PKIXParameters.java

示例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();
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:9,代碼來源:AbstractBuildScriptGenerator.java


注:本文中的java.util.Date.clone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。