code: @Override
      public Object format(Object value) {
          if (value == null) {
              return nullStringValue;
          }
          if(value.getClass().isArray()) {
              return asList(value);
          } else if (value instanceof Date) {
             Date date = (Date) value;
             if (date.getTime() % ONE_DAY_IN_MILLIS == 0) {
                 return new SimpleDateFormat(datePattern).format(date);
             } else {
                 return new SimpleDateFormat(dateTimePattern).format(date);
             }
          } else if(value instanceof CompositeData) {
              return toMap((CompositeData)value);
          } else if(value instanceof Element) {
              return parseXmlElement((Element) value);
          }
          
          return value;
      }
docs: Returns a formatted representation for the value.
  
  @param value Value to format.
  
  @return a formatted representation for the value.