Hi Eam,
This is undocumented, and only for advance users. I can't promise when document going to be created for it.
here is the untested XMLGregorianCalendar JSONObjectCustomizer.
public class XMLGregorianCalendarSerializer implements JSONObjectCustomizer{
public Class<? extends Object> getAcceptClass(){
return XMLGregorianCalendar.class; // Make sure correct package of XMLGregorianCalendar used. this class is in difrent package in old version of metro.
}
/**
* To Json
*/
public void encode(OutputStream output,Object object){
XMLGregorianCalendar myCal = (XMLGregorianCalendar)object;
//output.write(myCal.getCalender().toString());// what ever you like to wring in this object value in json
// WARN don't close output stream. json encoder goig to write the rest and close at the end
// also suggested not to flush for better performance.
}
/**
* To Json
*/
public Object decode(Object value){
// value is string if you pass date in json as string. else java.util.Map<String,Object> you can parse and return XMLGregorianCalendar
XMLGregorianCalendar cal = null;/// find way to construct from factory class.
return cal;
}
/**
* Content type json model
*/
public void metaData(StringBuilder buf){
// not intrested in meta out put. leave empty.
//If intrested you can explain iin json way, and add it in this string buffer
}
}
It might be good to add generic in interface. But unfortunatly not avaiable at now.