List of usage examples for java.util Date clone
public Object clone()
From source file:Dates.java
/** * Returns a clone but without hours, minutes, seconds and milliseconds. <p> * /*from www . j a va2 s . c om*/ * @return If null if sent a null is returned. */ public static Date cloneWithoutTime(Date date) { if (date == null) return null; Date result = (Date) date.clone(); removeTime(result); return result; }
From source file:org.zaizi.alfresco.rating.controller.JsonNodeRefUtil.java
private static String toString(Date date) { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); return dateFormat.format(date.clone()); // //011-09-06T13:59:06.000Z }
From source file:Dates.java
/** * Returns a clone but with 23:59:59:999 for hours, minutes, seconds and milliseconds. <p> * /* w w w . j ava 2 s . c om*/ * @return The same date sent as argument (a new date is not created). If null * if sent a null is returned. */ public static Date cloneWith2359(Date date) { if (date == null) return null; Date result = (Date) date.clone(); Calendar cal = Calendar.getInstance(); cal.setTime(result); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 999); result.setTime(cal.getTime().getTime()); return result; }
From source file:de.micromata.genome.util.types.DateUtils.java
/** * Kopie des Dates als Date zurckliefern (<code>null</code>-save). * * @param date the date/*from ww w. j av a2s .c o m*/ * @return the date */ public static Date clone(Date date) { if (date == null) { return null; } return (Date) date.clone(); }
From source file:nl.clockwork.mule.ebms.util.EbMSMessageUtils.java
public static List<EbMSSendEvent> getEbMSSendEvents(CollaborationProtocolAgreement cpa, MessageHeader messageHeader) {//ww w . j a v a 2s. c om List<EbMSSendEvent> result = new ArrayList<EbMSSendEvent>(); Date sendTime = messageHeader.getMessageData().getTimestamp().toGregorianCalendar().getTime(); ReliableMessaging rm = CPAUtils.getReliableMessaging(cpa, messageHeader); if (rm != null) { for (int i = 0; i < rm.getRetries().intValue() + 1; i++) { result.add( new EbMSSendEvent(messageHeader.getMessageData().getMessageId(), (Date) sendTime.clone())); rm.getRetryInterval().addTo(sendTime); } } return result; }
From source file:org.apache.usergrid.apm.service.NetworkTestData.java
public static ClientLog generateLog(long givenAppId, Date start, Date end, int logLevel) { ClientLog logRecord = new ClientLog(); int rand = generator.nextInt(5); logRecord.setAppId(givenAppId);//from w w w . j a v a 2 s . co m logRecord.setLogLevel(ApigeeMobileAPMConstants.logLevelsString[logLevel]); logRecord.setLogMessage(logMessages[rand]); logRecord.setTimeStamp((Date) end.clone()); logRecord.setDeviceId(Integer.toString(generator.nextInt(20))); //this is a hack !!! return logRecord; }
From source file:org.sventon.web.tags.AgeTag.java
/** * Sets the date.//from w ww . j av a 2 s. c om * Needed by the framework. * * @param date Date. */ public void setDate(final Date date) { this.date = date != null ? (Date) date.clone() : null; }
From source file:com.adaptris.core.event.LicenseExpiryWarningEvent.java
/** Set the expiry date using an actual Date object. * @param d the expiry date/*from w w w . jav a 2 s . com*/ */ public void setExpiryDate(Date d) { expiryDate = (Date) d.clone(); licenseExpiry = sdf.format(expiryDate); }
From source file:uk.me.sa.android.notify_smtp.net.SendEmail.java
public SendEmail(ValidatedPrefs prefs, String subject, Date ts) { this.prefs = prefs; this.subject = subject; this.ts = (Date) ts.clone(); }
From source file:com.autonomy.aci.client.services.AciErrorException.java
public void setErrorTime(final Date errorTime) { this.errorTime = (errorTime == null) ? null : (Date) errorTime.clone(); }