![JAR search and dependency download from the Maven repository](/logo.png)
nyla.solutions.global.data.conversation.DateBag Maven / Gradle / Ivy
package nyla.solutions.global.data.conversation;
import java.io.Serializable;
import java.util.Date;
/**
* This object support conversations of the java.util.Date objects
* @author Gregory Green
*
*/
public class DateBag implements Serializable, BaggedObject
{
/**
* Default constructor
*/
public DateBag()
{
}// --------------------------------------------------------
/**
*
* @param date the date to wrap
*/
public DateBag(Date date)
{
if(date ==null)
this.time = 0;
else
setTime(date.getTime());
}// --------------------------------------------------------
/**
* @return the time
*/
public long getTime()
{
return time;
}// --------------------------------------------------------
/**
* @param time the time to set
*/
public void setTime(long time)
{
this.time = time;
}
/**
* Wraps a given date in a format that can be easily unbagged
* @see io.pivotal.gemfire_addon.conversions.BaggedObject#bag(java.lang.Object)
*/
@Override
public void bag(Date unBaggedObject)
{
if(unBaggedObject == null)
this.time = 0;
else
this.time = unBaggedObject.getTime();
}// --------------------------------------------------------
/**
*
* @see io.pivotal.gemfire_addon.conversions.BaggedObject#unbag()
*/
@Override
public Date unbag()
{
if(time == 0)
return null;
return new Date(time);
}
private long time = 0;
/**
*
*/
private static final long serialVersionUID = 7751615472903561078L;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy