Yes. On Nov 7, 2014 8:01 AM, "robdouglas" <[email protected]> wrote:
> Github user robdouglas commented on a diff in the pull request: > > > https://github.com/apache/incubator-streams/pull/120#discussion_r20018054 > > --- Diff: > streams-pojo/src/main/java/org/apache/streams/jackson/StreamsDateTimeDeserializer.java > --- > @@ -21,23 +21,44 @@ > import com.fasterxml.jackson.core.JsonParser; > import com.fasterxml.jackson.databind.DeserializationContext; > import com.fasterxml.jackson.databind.deser.std.StdDeserializer; > +import com.google.common.collect.Lists; > import org.apache.streams.data.util.RFC3339Utils; > import org.joda.time.DateTime; > +import org.joda.time.format.DateTimeFormat; > +import org.joda.time.format.DateTimeFormatter; > > import java.io.IOException; > import java.io.Serializable; > +import java.util.ArrayList; > +import java.util.Iterator; > +import java.util.List; > > /** > * Created by sblackmon on 3/27/14. > */ > public class StreamsDateTimeDeserializer extends > StdDeserializer<DateTime> implements Serializable { > > + List<DateTimeFormatter> formatters = Lists.newArrayList(); > + > protected StreamsDateTimeDeserializer(Class<DateTime> > dateTimeClass) { > super(dateTimeClass); > } > > + protected StreamsDateTimeDeserializer(Class<DateTime> > dateTimeClass, List<String> formats) { > + super(dateTimeClass); > + for( String format : formats ) > + formatters.add(DateTimeFormat.forPattern(format)); > + } > + > @Override > public DateTime deserialize(JsonParser jpar, > DeserializationContext context) throws IOException { > - return > RFC3339Utils.getInstance().parseToUTC(jpar.getValueAsString()); > + > + DateTime result = > RFC3339Utils.parseToUTC(jpar.getValueAsString()); > --- End diff -- > > Are the formatters here essentially meant as fall backs in case the > RFC3339Utils class isn't able to parse the date? > > > --- > If your project is set up for it, you can reply to this email and have your > reply appear on GitHub as well. If your project does not have this feature > enabled and wishes so, or if the feature is enabled but not working, please > contact infrastructure at [email protected] or file a JIRA ticket > with INFRA. > --- >
