@Test public void testStringBodyParameterBlankParameter() throws Exception { Parameter.newParameter(1, "body", "string", ""); }
public static final Parameter newParameter(final int id, final String item, final String type, final String config) { Parameter p = null; if (BODY_ITEM.equals(item)) { if (STRING_TYPE.equals(type)) { p = new StringBodyParameter(id); } else if (BYTEARRAY_TYPE.equals(type)) { p = new ByteArrayBodyParameter(id); } } else if ((item != null) && item.startsWith(HEADER_ITEM_PREFIX)) { final String header = item.substring(HEADER_ITEM_PREFIX.length()); if (STRING_TYPE.equals(type)) { p = new StringHeaderParameter(id, header); } else if (LONG_TYPE.equals(type)) { p = new LongHeaderParameter(id, header); } else if (INT_TYPE.equals(type)) { p = new IntHeaderParameter(id, header); } else if (DATE_TYPE.equals(type)) { p = new DateHeaderParameter(id, header); } else if (DOUBLE_TYPE.equals(type)) { p = new DoubleHeaderParameter(id, header); } else if (FLOAT_TYPE.equals(type)) { p = new FloatHeaderParameter(id, header); } } else if (CUSTOM_ITEM.equals(item)) { try { p = (CustomParameter) Class.forName(type).getConstructor(Integer.TYPE) .newInstance(new Object[] { id }); } catch (Exception e) { throw new IllegalArgumentException( "Could not initialize custom parameter type: " + type + " with config: " + config + "."); } } if (p != null) { p.configure(config); return p; } throw new IllegalArgumentException("Invalid SQL parameter item: " + item + " and type: " + type + " with config: " + config + "."); }
Parameter { public static final Parameter newParameter(final int id, final String item, final String type, final String config) { Parameter p = null; if (BODY_ITEM.equals(item)) { if (STRING_TYPE.equals(type)) { p = new StringBodyParameter(id); } else if (BYTEARRAY_TYPE.equals(type)) { p = new ByteArrayBodyParameter(id); } } else if ((item != null) && item.startsWith(HEADER_ITEM_PREFIX)) { final String header = item.substring(HEADER_ITEM_PREFIX.length()); if (STRING_TYPE.equals(type)) { p = new StringHeaderParameter(id, header); } else if (LONG_TYPE.equals(type)) { p = new LongHeaderParameter(id, header); } else if (INT_TYPE.equals(type)) { p = new IntHeaderParameter(id, header); } else if (DATE_TYPE.equals(type)) { p = new DateHeaderParameter(id, header); } else if (DOUBLE_TYPE.equals(type)) { p = new DoubleHeaderParameter(id, header); } else if (FLOAT_TYPE.equals(type)) { p = new FloatHeaderParameter(id, header); } } else if (CUSTOM_ITEM.equals(item)) { try { p = (CustomParameter) Class.forName(type).getConstructor(Integer.TYPE) .newInstance(new Object[] { id }); } catch (Exception e) { throw new IllegalArgumentException( "Could not initialize custom parameter type: " + type + " with config: " + config + "."); } } if (p != null) { p.configure(config); return p; } throw new IllegalArgumentException("Invalid SQL parameter item: " + item + " and type: " + type + " with config: " + config + "."); } }
Parameter { public static final Parameter newParameter(final int id, final String item, final String type, final String config) { Parameter p = null; if (BODY_ITEM.equals(item)) { if (STRING_TYPE.equals(type)) { p = new StringBodyParameter(id); } else if (BYTEARRAY_TYPE.equals(type)) { p = new ByteArrayBodyParameter(id); } } else if ((item != null) && item.startsWith(HEADER_ITEM_PREFIX)) { final String header = item.substring(HEADER_ITEM_PREFIX.length()); if (STRING_TYPE.equals(type)) { p = new StringHeaderParameter(id, header); } else if (LONG_TYPE.equals(type)) { p = new LongHeaderParameter(id, header); } else if (INT_TYPE.equals(type)) { p = new IntHeaderParameter(id, header); } else if (DATE_TYPE.equals(type)) { p = new DateHeaderParameter(id, header); } else if (DOUBLE_TYPE.equals(type)) { p = new DoubleHeaderParameter(id, header); } else if (FLOAT_TYPE.equals(type)) { p = new FloatHeaderParameter(id, header); } } else if (CUSTOM_ITEM.equals(item)) { try { p = (CustomParameter) Class.forName(type).getConstructor(Integer.TYPE) .newInstance(new Object[] { id }); } catch (Exception e) { throw new IllegalArgumentException( "Could not initialize custom parameter type: " + type + " with config: " + config + "."); } } if (p != null) { p.configure(config); return p; } throw new IllegalArgumentException("Invalid SQL parameter item: " + item + " and type: " + type + " with config: " + config + "."); } protected  Parameter(final int id); }
Parameter { public static final Parameter newParameter(final int id, final String item, final String type, final String config) { Parameter p = null; if (BODY_ITEM.equals(item)) { if (STRING_TYPE.equals(type)) { p = new StringBodyParameter(id); } else if (BYTEARRAY_TYPE.equals(type)) { p = new ByteArrayBodyParameter(id); } } else if ((item != null) && item.startsWith(HEADER_ITEM_PREFIX)) { final String header = item.substring(HEADER_ITEM_PREFIX.length()); if (STRING_TYPE.equals(type)) { p = new StringHeaderParameter(id, header); } else if (LONG_TYPE.equals(type)) { p = new LongHeaderParameter(id, header); } else if (INT_TYPE.equals(type)) { p = new IntHeaderParameter(id, header); } else if (DATE_TYPE.equals(type)) { p = new DateHeaderParameter(id, header); } else if (DOUBLE_TYPE.equals(type)) { p = new DoubleHeaderParameter(id, header); } else if (FLOAT_TYPE.equals(type)) { p = new FloatHeaderParameter(id, header); } } else if (CUSTOM_ITEM.equals(item)) { try { p = (CustomParameter) Class.forName(type).getConstructor(Integer.TYPE) .newInstance(new Object[] { id }); } catch (Exception e) { throw new IllegalArgumentException( "Could not initialize custom parameter type: " + type + " with config: " + config + "."); } } if (p != null) { p.configure(config); return p; } throw new IllegalArgumentException("Invalid SQL parameter item: " + item + " and type: " + type + " with config: " + config + "."); } protected  Parameter(final int id); static final Parameter newParameter(final int id, final String item,
      final String type, final String config); abstract void setValue(final PreparedStatement ps, final Event e); void configure(final String config); }
Parameter { public static final Parameter newParameter(final int id, final String item, final String type, final String config) { Parameter p = null; if (BODY_ITEM.equals(item)) { if (STRING_TYPE.equals(type)) { p = new StringBodyParameter(id); } else if (BYTEARRAY_TYPE.equals(type)) { p = new ByteArrayBodyParameter(id); } } else if ((item != null) && item.startsWith(HEADER_ITEM_PREFIX)) { final String header = item.substring(HEADER_ITEM_PREFIX.length()); if (STRING_TYPE.equals(type)) { p = new StringHeaderParameter(id, header); } else if (LONG_TYPE.equals(type)) { p = new LongHeaderParameter(id, header); } else if (INT_TYPE.equals(type)) { p = new IntHeaderParameter(id, header); } else if (DATE_TYPE.equals(type)) { p = new DateHeaderParameter(id, header); } else if (DOUBLE_TYPE.equals(type)) { p = new DoubleHeaderParameter(id, header); } else if (FLOAT_TYPE.equals(type)) { p = new FloatHeaderParameter(id, header); } } else if (CUSTOM_ITEM.equals(item)) { try { p = (CustomParameter) Class.forName(type).getConstructor(Integer.TYPE) .newInstance(new Object[] { id }); } catch (Exception e) { throw new IllegalArgumentException( "Could not initialize custom parameter type: " + type + " with config: " + config + "."); } } if (p != null) { p.configure(config); return p; } throw new IllegalArgumentException("Invalid SQL parameter item: " + item + " and type: " + type + " with config: " + config + "."); } protected  Parameter(final int id); static final Parameter newParameter(final int id, final String item,
      final String type, final String config); abstract void setValue(final PreparedStatement ps, final Event e); void configure(final String config);  }