当前位置: 首页>>代码示例>>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;未经允许,请勿转载。