Package org.apache.juneau.swaps
Class XMLGregorianCalendarSwap
java.lang.Object
org.apache.juneau.swap.ObjectSwap<T,String>
org.apache.juneau.swap.StringSwap<XMLGregorianCalendar>
org.apache.juneau.swaps.XMLGregorianCalendarSwap
Transforms
XMLGregorianCalendars to ISO8601 date-time Strings.
Objects are converted to strings using XMLGregorianCalendar.toXMLFormat().
Strings are converted to objects using DatatypeFactory.newXMLGregorianCalendar(String).
See Also:
-
Field Summary
Fields inherited from class org.apache.juneau.swap.ObjectSwap
NULL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionswap(BeanSession session, XMLGregorianCalendar b) Converts the specifiedXMLGregorianCalendar to aString.unswap(BeanSession session, String s, ClassMeta<?> hint) Converts the specifiedStringto anXMLGregorianCalendar .Methods inherited from class org.apache.juneau.swap.ObjectSwap
forMediaTypes, forMediaTypes, getNormalClass, getSwapClass, getSwapClassMeta, isNormalObject, isSwappedObject, match, swap, toString, unswap, withTemplate, withTemplate
-
Constructor Details
-
XMLGregorianCalendarSwap
public XMLGregorianCalendarSwap()Constructor.
-
-
Method Details
-
swap
Converts the specifiedXMLGregorianCalendar to aString.- Overrides:
swapin classStringSwap<XMLGregorianCalendar>- Parameters:
session- The bean session to use to get the class meta. This is always going to be the same bean context that created this swap.b- The object to be transformed.- Returns:
- The transformed object.
- Throws:
Exception- If a problem occurred trying to convert the output.
-
unswap
public XMLGregorianCalendar unswap(BeanSession session, String s, ClassMeta<?> hint) throws Exception Converts the specifiedStringto anXMLGregorianCalendar .- Overrides:
unswapin classStringSwap<XMLGregorianCalendar>- Parameters:
session- The bean session to use to get the class meta. This is always going to be the same bean context that created this swap.s- The transformed object.hint- If possible, the parser will try to tell you the object type being created. For example, on a serialized date, this may tell you that the object being created must be of typeGregorianCalendar.
This may benull if the parser cannot make this determination.- Returns:
- The narrowed object.
- Throws:
Exception- If this method is not implemented.
-