Example usage for java.util Date clone

List of usage examples for java.util Date clone

Introduction

In this page you can find the example usage for java.util Date clone.

Prototype

public Object clone() 

Source Link

Document

Return a copy of this object.

Usage

From source file:org.silverpeas.components.formsonline.model.FormDetail.java

/**
 * @param creationDate the creationDate to set
 */// w w  w  . j  a  v a  2  s  .  c  o m
public void setCreationDate(Date creationDate) {
    this.creationDate = (creationDate != null ? (Date) creationDate.clone() : null);
}

From source file:org.tonguetied.audit.AuditLogRecord.java

/**
 * @param created the date the record was created
 *//*from  w  w  w  . j  a v  a  2  s .com*/
public void setCreated(final Date created) {
    // assign a copy of this parameter to avoid later changes to mutable 
    // object
    this.created = (Date) created.clone();
}

From source file:se.vgregion.portal.rss.client.beans.FeedEntryBean.java

public void setPublishedDate(Date publishedDate) {
    this.publishedDate = (publishedDate == null) ? null : (Date) publishedDate.clone();
}

From source file:nl.mpi.lamus.workspace.model.implementation.LamusWorkspace.java

@Override
public void setEndDate(Date endDate) {
    Date toSet = null;/*from  w  ww . j a v  a2s  .co m*/
    if (endDate != null) {
        toSet = (Date) endDate.clone();
    }
    this.endDate = toSet;
}

From source file:nl.mpi.lamus.workspace.model.implementation.LamusWorkspace.java

@Override
public void setStartDate(Date startDate) {
    Date toSet = null;//from w  w w  .j  a  va  2  s .  c o  m
    if (startDate != null) {
        toSet = (Date) startDate.clone();
    }
    this.startDate = toSet;
}

From source file:nl.mpi.lamus.workspace.model.implementation.LamusWorkspace.java

@Override
public void setSessionEndDate(Date sessionEndDate) {
    Date toSet = null;//from   w  ww. j a v  a2 s.  c  om
    if (sessionEndDate != null) {
        toSet = (Date) sessionEndDate.clone();
    }
    this.sessionEndDate = toSet;
}

From source file:nl.mpi.lamus.workspace.model.implementation.LamusWorkspace.java

@Override
public void setSessionStartDate(Date sessionStartDate) {
    Date toSet = null;//from   ww w  .  j  a va 2s . c om
    if (sessionStartDate != null) {
        toSet = (Date) sessionStartDate.clone();
    }
    this.sessionStartDate = toSet;
}

From source file:org.apache.roller.weblogger.pojos.User.java

public User(String id, String userName, String password, String fullName, String emailAddress, String locale,
        String timeZone, Date dateCreated, Boolean isEnabled) {
    //this.id = id;
    this.userName = userName;
    this.password = password;
    this.fullName = fullName;
    this.emailAddress = emailAddress;
    this.dateCreated = (Date) dateCreated.clone();
    this.locale = locale;
    this.timeZone = timeZone;
    this.enabled = isEnabled;
}

From source file:com.autentia.tnt.manager.holiday.UserHolidaysStateManager.java

/**
 * @return Devuelve el nmero de das laborables que hay entre dos fechas
 *//*from ww w  .j a va2 s .  c om*/
public int getWorkingDays(Date fromDate, Date toDate) {
    int total = 0;

    // Evitamos un bucle infinito en el bucle que viene a continuacin
    if (fromDate.before(toDate) || DateUtils.isSameDay(fromDate, toDate)) {
        HolidaySearch fiestaSearch = new HolidaySearch();
        Date current = (Date) fromDate.clone();

        fiestaSearch.setStartDate(fromDate);
        fiestaSearch.setEndDate(toDate);
        List<Holiday> fiestas = HolidayManager.getDefault().getAllEntities(fiestaSearch, null);

        while (current.before(toDate) || DateUtils.isSameDay(current, toDate)) {
            if (!this.isHoliday(fiestas, current)) {
                total++;
            }
            current = DateUtils.addDays(current, 1);
        }
    }

    return total;
}

From source file:org.alfresco.util.CachingDateFormat.java

/**
 * Parses and caches date strings./*from  www  .ja v a 2s.c  o m*/
 * 
 * @see java.text.DateFormat#parse(java.lang.String,
 *      java.text.ParsePosition)
 */
public Date parse(String text, ParsePosition pos) {
    Date cached = cacheDates.get(text);
    if (cached == null) {
        Date date = super.parse(text, pos);
        if ((date != null) && (pos.getIndex() == text.length())) {
            cacheDates.put(text, date);
            Date clonedDate = (Date) date.clone();
            return clonedDate;
        } else {
            return date;
        }
    } else {
        pos.setIndex(text.length());
        Date clonedDate = (Date) cached.clone();
        return clonedDate;
    }
}