Package com.hubspot.jinjava.objects.date
Class PyishDate
- java.lang.Object
-
- java.util.Date
-
- com.hubspot.jinjava.objects.date.PyishDate
-
- All Implemented Interfaces:
PyWrapper
,PyishSerializable
,Serializable
,Cloneable
,Comparable<Date>
public final class PyishDate extends Date implements Serializable, PyWrapper, PyishSerializable
an object which quacks like a python date- Author:
- jstehler
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
FULL_DATE_FORMAT
static String
PYISH_DATE_CUSTOM_DATE_FORMAT_CONTEXT_KEY
static String
PYISH_DATE_FORMAT
-
Fields inherited from interface com.hubspot.jinjava.objects.serialization.PyishSerializable
SELF_WRITER
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Appendable & CharSequence>
TappendPyishString(T appendable)
Allows for a class to append the custom string representation in Jinjava.boolean
equals(Object obj)
String
getDateFormat()
int
getDay()
int
getHour()
int
getMicrosecond()
int
getMinute()
int
getMonth()
int
getSecond()
int
getYear()
int
hashCode()
String
isoformat()
void
setDateFormat(String dateFormat)
String
strftime(String fmt)
Date
toDate()
ZonedDateTime
toDateTime()
String
toString()
PyishDate
withDateFormat(String dateFormat)
-
Methods inherited from class java.util.Date
after, before, clone, compareTo, from, getDate, getHours, getMinutes, getSeconds, getTime, getTimezoneOffset, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setTime, setYear, toGMTString, toInstant, toLocaleString, UTC
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.hubspot.jinjava.objects.serialization.PyishSerializable
writePyishSelf
-
-
-
-
Field Detail
-
PYISH_DATE_FORMAT
public static final String PYISH_DATE_FORMAT
- See Also:
- Constant Field Values
-
FULL_DATE_FORMAT
public static final String FULL_DATE_FORMAT
- See Also:
- Constant Field Values
-
PYISH_DATE_CUSTOM_DATE_FORMAT_CONTEXT_KEY
public static final String PYISH_DATE_CUSTOM_DATE_FORMAT_CONTEXT_KEY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PyishDate
public PyishDate(ZonedDateTime dt)
-
PyishDate
public PyishDate(Date d)
-
PyishDate
public PyishDate(String publishDateStr)
-
PyishDate
public PyishDate(Long epochMillis)
-
PyishDate
public PyishDate(Instant instant)
-
-
Method Detail
-
isoformat
public String isoformat()
-
getHour
public int getHour()
-
getMinute
public int getMinute()
-
getSecond
public int getSecond()
-
getMicrosecond
public int getMicrosecond()
-
getDateFormat
public String getDateFormat()
-
setDateFormat
public void setDateFormat(String dateFormat)
-
toDate
public Date toDate()
-
toDateTime
public ZonedDateTime toDateTime()
-
appendPyishString
public <T extends Appendable & CharSequence> T appendPyishString(T appendable) throws IOException
Description copied from interface:PyishSerializable
Allows for a class to append the custom string representation in Jinjava. This method will be used byPyishSerializable.writePyishSelf(JsonGenerator, SerializerProvider)
to specify what will be written to the json generator.- Specified by:
appendPyishString
in interfacePyishSerializable
- Parameters:
appendable
- Appendable to append the pyish string representation to.- Returns:
- The same appendable with an appended result
- Throws:
IOException
-
-