// Path: core/src/main/java/com/caseystella/analytics/converters/primitive/PrimitiveConverter.java
// public class PrimitiveConverter {
//     public static final String TYPE_CONF = "type";
//     public static final String NAME_CONF = "name";
//     public enum Type implements Function<byte[], Object> {
//         DOUBLE(new Function<byte[], Object>() {
//             @Override
//             public Object apply(byte[] bytes) {
//                 return Bytes.toDouble(bytes);
//             }
//         })
//         ,LONG(new Function<byte[], Object>() {
//             @Override
//             public Object apply(byte[] bytes) {
//                 return Bytes.toLong(bytes);
//             }
//         })
//         ,INTEGER(new Function<byte[], Object>() {
//             @Override
//             public Object apply(byte[] bytes) {
//                 return Bytes.toInt(bytes);
//             }
//         })
//         ,STRING(new Function<byte[], Object>() {
//             @Override
//             public Object apply(byte[] bytes) {
//                 return Bytes.toString(bytes);
//             }
//         })
//         ;
//         private Function<byte[], Object> _func;
//         Type(Function<byte[], Object> func) {
//             _func = func;
//         }
//         @Override
//         public Object apply(byte[] bytes) {
//             return _func.apply(bytes);
//         }
//     }
// 
//     public static class PrimitiveMeasurementConverter implements MeasurementConverter {
// 
//         @Override
//         public Double convert(Object in, Map<String, Object> config) {
//             if(in instanceof Double) {
//                 return (Double)in;
//             }
//             else if(in instanceof Number) {
//                 return ((Number)in).doubleValue();
//             }
//             else if(in instanceof String) {
//                 return Double.parseDouble(in.toString());
//             }
//             else
//             {
//                 throw new RuntimeException("Unable to convert " + in + " to a double");
//             }
//         }
//     }
// 
//     public static class PrimitiveTimestampConverter implements TimestampConverter{
//         @Override
//         public Long convert(Object in, Map<String, Object> config) {
//             if(in instanceof Long) {
//                 return (Long)in;
//             }
//             else if(in instanceof Number) {
//                 return ((Number)in).longValue();
//             }
//             else if(in instanceof String) {
//                 return Long.parseLong(in.toString());
//             }
//             else
//             {
//                 throw new RuntimeException("Unable to convert " + in + " to a long");
//             }
//         }
//     }
// 
//     public static class PrimitiveMappingConverter implements MappingConverter {
// 
//         @Override
//         public Map<String, Object> convert(final byte[] in, final Map<String, Object> config) {
//             final Type t = Type.valueOf((String) config.get(TYPE_CONF));
//             return new HashMap<String, Object>() {{
//                 put((String) config.get(NAME_CONF), t.apply(in));
//             }};
//         }
//     }
// }
// 
// Path: core/src/main/java/com/caseystella/analytics/util/JSONUtil.java
// public enum JSONUtil {
//     INSTANCE;
//     static ThreadLocal<ObjectMapper> MAPPER = new ThreadLocal<ObjectMapper>() {
//         /**
//          * Returns the current thread's "initial value" for this
//          * thread-local variable.  This method will be invoked the first
//          * time a thread accesses the variable with the {@link #get}
//          * method, unless the thread previously invoked the {@link #set}
//          * method, in which case the <tt>initialValue</tt> method will not
//          * be invoked for the thread.  Normally, this method is invoked at
//          * most once per thread, but it may be invoked again in case of
//          * subsequent invocations of {@link #remove} followed by {@link #get}.
//          * <p/>
//          * <p>This implementation simply returns <tt>null</tt>; if the
//          * programmer desires thread-local variables to have an initial
//          * value other than <tt>null</tt>, <tt>ThreadLocal</tt> must be
//          * subclassed, and this method overridden.  Typically, an
//          * anonymous inner class will be used.
//          *
//          * @return the initial value for this thread-local
//          */
//         @Override
//         protected ObjectMapper initialValue() {
//             return new ObjectMapper();
//         }
//     };
// 
//     public <T> T load(File f, Class<T> clazz) throws IOException {
//         return load(new FileInputStream(f), clazz);
//     }
// 
//     public <T> T load(InputStream is, Class<T> clazz) throws IOException {
//         T ret = MAPPER.get().readValue(is, clazz);
//         return ret;
//     }
//     public <T> T load(String s, Charset c, Class<T> clazz) throws IOException {
//         return load( new ByteArrayInputStream(s.getBytes(c)), clazz);
//     }
//     public <T> T load(String s, Class<T> clazz) throws IOException {
//         return load( s, Charset.defaultCharset(), clazz);
//     }
//     public <T> T load(InputStream is, TypeReference<T> reference) throws IOException {
//         T ret = MAPPER.get().readValue(is, reference);
//         return ret;
//     }
//     public <T> T load(String s, Charset c, TypeReference<T> reference) throws IOException {
//         return load( new ByteArrayInputStream(s.getBytes(c)), reference);
//     }
//     public <T> T load(String s, TypeReference<T> reference) throws IOException {
//         return load( s, Charset.defaultCharset(), reference);
//     }
// 
//     public  String toJSON(Object bean ) throws JsonProcessingException {
//         return MAPPER.get().writerWithDefaultPrettyPrinter().writeValueAsString(bean);
//     }
// 
// }


import com.caseystella.analytics.converters.*;
import com.caseystella.analytics.converters.primitive.PrimitiveConverter;
import com.caseystella.analytics.util.JSONUtil;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
package com.caseystella.analytics.extractor;



public class DataPointExtractorConfig implements Serializable {

    public static class Measurement implements Serializable {
        private String source;
        private List<String> sourceFields;
        private String timestampField;
// Path: core/src/main/java/com/caseystella/analytics/converters/primitive/PrimitiveConverter.java
// public class PrimitiveConverter {
//     public static final String TYPE_CONF = "type";
//     public static final String NAME_CONF = "name";
//     public enum Type implements Function<byte[], Object> {
//         DOUBLE(new Function<byte[], Object>() {
//             @Override
//             public Object apply(byte[] bytes) {
//                 return Bytes.toDouble(bytes);
//             }
//         })
//         ,LONG(new Function<byte[], Object>() {
//             @Override
//             public Object apply(byte[] bytes) {
//                 return Bytes.toLong(bytes);
//             }
//         })
//         ,INTEGER(new Function<byte[], Object>() {
//             @Override
//             public Object apply(byte[] bytes) {
//                 return Bytes.toInt(bytes);
//             }
//         })
//         ,STRING(new Function<byte[], Object>() {
//             @Override
//             public Object apply(byte[] bytes) {
//                 return Bytes.toString(bytes);
//             }
//         })
//         ;
//         private Function<byte[], Object> _func;
//         Type(Function<byte[], Object> func) {
//             _func = func;
//         }
//         @Override
//         public Object apply(byte[] bytes) {
//             return _func.apply(bytes);
//         }
//     }
// 
//     public static class PrimitiveMeasurementConverter implements MeasurementConverter {
// 
//         @Override
//         public Double convert(Object in, Map<String, Object> config) {
//             if(in instanceof Double) {
//                 return (Double)in;
//             }
//             else if(in instanceof Number) {
//                 return ((Number)in).doubleValue();
//             }
//             else if(in instanceof String) {
//                 return Double.parseDouble(in.toString());
//             }
//             else
//             {
//                 throw new RuntimeException("Unable to convert " + in + " to a double");
//             }
//         }
//     }
// 
//     public static class PrimitiveTimestampConverter implements TimestampConverter{
//         @Override
//         public Long convert(Object in, Map<String, Object> config) {
//             if(in instanceof Long) {
//                 return (Long)in;
//             }
//             else if(in instanceof Number) {
//                 return ((Number)in).longValue();
//             }
//             else if(in instanceof String) {
//                 return Long.parseLong(in.toString());
//             }
//             else
//             {
//                 throw new RuntimeException("Unable to convert " + in + " to a long");
//             }
//         }
//     }
// 
//     public static class PrimitiveMappingConverter implements MappingConverter {
// 
//         @Override
//         public Map<String, Object> convert(final byte[] in, final Map<String, Object> config) {
//             final Type t = Type.valueOf((String) config.get(TYPE_CONF));
//             return new HashMap<String, Object>() {{
//                 put((String) config.get(NAME_CONF), t.apply(in));
//             }};
//         }
//     }
// }
// 
// Path: core/src/main/java/com/caseystella/analytics/util/JSONUtil.java
// public enum JSONUtil {
//     INSTANCE;
//     static ThreadLocal<ObjectMapper> MAPPER = new ThreadLocal<ObjectMapper>() {
//         /**
//          * Returns the current thread's "initial value" for this
//          * thread-local variable.  This method will be invoked the first
//          * time a thread accesses the variable with the {@link #get}
//          * method, unless the thread previously invoked the {@link #set}
//          * method, in which case the <tt>initialValue</tt> method will not
//          * be invoked for the thread.  Normally, this method is invoked at
//          * most once per thread, but it may be invoked again in case of
//          * subsequent invocations of {@link #remove} followed by {@link #get}.
//          * <p/>
//          * <p>This implementation simply returns <tt>null</tt>; if the
//          * programmer desires thread-local variables to have an initial
//          * value other than <tt>null</tt>, <tt>ThreadLocal</tt> must be
//          * subclassed, and this method overridden.  Typically, an
//          * anonymous inner class will be used.
//          *
//          * @return the initial value for this thread-local
//          */
//         @Override
//         protected ObjectMapper initialValue() {
//             return new ObjectMapper();
//         }
//     };
// 
//     public <T> T load(File f, Class<T> clazz) throws IOException {
//         return load(new FileInputStream(f), clazz);
//     }
// 
//     public <T> T load(InputStream is, Class<T> clazz) throws IOException {
//         T ret = MAPPER.get().readValue(is, clazz);
//         return ret;
//     }
//     public <T> T load(String s, Charset c, Class<T> clazz) throws IOException {
//         return load( new ByteArrayInputStream(s.getBytes(c)), clazz);
//     }
//     public <T> T load(String s, Class<T> clazz) throws IOException {
//         return load( s, Charset.defaultCharset(), clazz);
//     }
//     public <T> T load(InputStream is, TypeReference<T> reference) throws IOException {
//         T ret = MAPPER.get().readValue(is, reference);
//         return ret;
//     }
//     public <T> T load(String s, Charset c, TypeReference<T> reference) throws IOException {
//         return load( new ByteArrayInputStream(s.getBytes(c)), reference);
//     }
//     public <T> T load(String s, TypeReference<T> reference) throws IOException {
//         return load( s, Charset.defaultCharset(), reference);
//     }
// 
//     public  String toJSON(Object bean ) throws JsonProcessingException {
//         return MAPPER.get().writerWithDefaultPrettyPrinter().writeValueAsString(bean);
//     }
// 
// }


// Path: core/src/main/java/com/caseystella/analytics/extractor/DataPointExtractorConfig.java
import com.caseystella.analytics.converters.*;
import com.caseystella.analytics.converters.primitive.PrimitiveConverter;
import com.caseystella.analytics.util.JSONUtil;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

package com.caseystella.analytics.extractor;



public class DataPointExtractorConfig implements Serializable {

    public static class Measurement implements Serializable {
        private String source;
        private List<String> sourceFields;
        private String timestampField;
        private TimestampConverter timestampConverter = new PrimitiveConverter.PrimitiveTimestampConverter();