public class XMLGregorianCalendarSwap extends StringSwap<XMLGregorianCalendar>
XMLGregorianCalendars
to ISO8601 date-time Strings
.
Objects are converted to strings using XMLGregorianCalendar.toXMLFormat()
.
Strings are converted to objects using DatatypeFactory.newXMLGregorianCalendar(String)
.
Constructor and Description |
---|
XMLGregorianCalendarSwap()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
swap(BeanSession session,
XMLGregorianCalendar b)
Converts the specified
String . |
XMLGregorianCalendar |
unswap(BeanSession session,
String s,
ClassMeta<?> hint)
Converts the specified
String to an |
forMediaTypes, forMediaTypes, getNormalClass, getSwapClass, getSwapClassMeta, isNormalObject, isSwappedObject, match, swap, toString, unswap, withTemplate, withTemplate
public XMLGregorianCalendarSwap()
public String swap(BeanSession session, XMLGregorianCalendar b) throws Exception
String
.swap
in class StringSwap<XMLGregorianCalendar>
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.Exception
- If a problem occurred trying to convert the output.public XMLGregorianCalendar unswap(BeanSession session, String s, ClassMeta<?> hint) throws Exception
String
to an unswap
in class StringSwap<XMLGregorianCalendar>
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 type
GregorianCalendar
.
Exception
- If this method is not implemented.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.