Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package de.zalando.sprocwrapper.proxy;
  
  
  
  import java.util.List;
 
 
 
 
 
     @SuppressWarnings("rawtypes")
 
     @SuppressWarnings("rawtypes")
     private ObjectMapper globalObjectMapper;
 
     public GlobalValueTransformedParameter(final ValueTransformer<?, ?> valueTransformerForClassfinal Class<?> clazz,
             final Type genericTypefinal Method mfinal String typeNamefinal int sqlTypefinal int javaPosition,
             final boolean sensitivefinal ObjectMapper<?> globalObjectMapperthrows InstantiationException,
         IllegalAccessException {
         super(getValueTransformedClazz(clazzvalueTransformerForClass), mtypeNamegetValueTransformedTypeId(clazz),
             javaPositionsensitive);
 
         this. = valueTransformerForClass;
         this. = globalObjectMapper;
          = StoredProcedureParameter.createParameter(getValueTransformedClazz(clazz,
                     valueTransformerForClass), getValueTransformedGenericClass(clazz), m,
                 getValueTransformedTypeName(clazzvalueTransformerForClass), getValueTransformedTypeId(clazz),
                 javaPositionsensitive);
     }
 
     @Override
     public Object mapParam(final Object valuefinal Connection connection) {
         if (value == null) {
             return .mapParam(valueconnection);
         }
 
             final List<ObjecttransformedValues = Lists.newArrayList();
             if (value.getClass().isArray()) {
                 for (final Object o : ((Object[]) value)) {
                     transformedValues.add(getMarshaledObject(o));
                 }
             } else {
                 for (final Object o : ((Collection<?>) value)) {
                     transformedValues.add(String.valueOf(getMarshaledObject(o)));
                 }
             }
 
             return .mapParam(transformedValuesconnection);
         } else {
             return .mapParam(getMarshaledObject(value), connection);
         }
     }
 
     private Object getMarshaledObject(final Object o) {
         if ( != null) {
             return .marshalToDb(o);
         } else {
             return .marshalToDb(o);
         }
     }
 
     @Override
     public int getJavaPos() {
     }
 
     @Override
     public boolean isSensitive() {
     }
 
     @Override
     public int getType() {
         return .getType();
     }
 
     @Override
     public String getTypeName() {
     }
 
     private static int getValueTransformedTypeId(final Class<?> clazz) {
 
         // start type detection for transformed class
         return -1;
     }
    private String getValueTransformedTypeName(final Class<?> clazz,
            final ValueTransformer<?, ?> valueTransformerForClass) {
        final Class<?> valueTransformedGenericClass = getValueTransformedGenericClass(
                valueTransformerForClass.getClass());
        String sqlNameForClass = PgTypeHelper.getSQLNameForClass(valueTransformedGenericClass);
        if (sqlNameForClass != null && clazz.isArray() || Collection.class.isAssignableFrom(clazz)) {
            sqlNameForClass += "[]";
        }
        return sqlNameForClass;
    }
    private static Class<?> getValueTransformedClazz(final Class<?> clazz,
            final ValueTransformer<?, ?> valueTransformerForClass) {
        if (clazz.isArray() || Collection.class.isAssignableFrom(clazz)) {
            return List.class;
        }
        return ValueTransformerUtils.getMarshalToDbClass(valueTransformerForClass);
    }
    private Class<?> getValueTransformedGenericClass(final Class<?> clazz) {
        return ValueTransformerUtils.getMarshalToDbClass();
    }
New to GrepCode? Check out our FAQ X