@Test public void testConvertPropertyToNullBooleanTarget() throws JMSException { assertFalse(JMSMessagePropertySupport.convertPropertyTo("timeout", null, Boolean.class)); }
@SuppressWarnings("unchecked") public static <T> T convertPropertyTo(String name, Object value, Class<T> target) throws JMSException { if (value == null) { if (Boolean.class.equals(target)) { return (T) Boolean.FALSE; } else if (Float.class.equals(target) || Double.class.equals(target)) { throw new NullPointerException("property " + name + " was null"); } else if (Number.class.isAssignableFrom(target)) { throw new NumberFormatException("property " + name + " was null"); } else { return null; } } T rc = (T) TypeConversionSupport.convert(value, target); if (rc == null) { throw new MessageFormatException("Property " + name + " was a " + value.getClass().getName() + " and cannot be read as a " + target.getName()); } return rc; }
JMSMessagePropertySupport { @SuppressWarnings("unchecked") public static <T> T convertPropertyTo(String name, Object value, Class<T> target) throws JMSException { if (value == null) { if (Boolean.class.equals(target)) { return (T) Boolean.FALSE; } else if (Float.class.equals(target) || Double.class.equals(target)) { throw new NullPointerException("property " + name + " was null"); } else if (Number.class.isAssignableFrom(target)) { throw new NumberFormatException("property " + name + " was null"); } else { return null; } } T rc = (T) TypeConversionSupport.convert(value, target); if (rc == null) { throw new MessageFormatException("Property " + name + " was a " + value.getClass().getName() + " and cannot be read as a " + target.getName()); } return rc; } }
JMSMessagePropertySupport { @SuppressWarnings("unchecked") public static <T> T convertPropertyTo(String name, Object value, Class<T> target) throws JMSException { if (value == null) { if (Boolean.class.equals(target)) { return (T) Boolean.FALSE; } else if (Float.class.equals(target) || Double.class.equals(target)) { throw new NullPointerException("property " + name + " was null"); } else if (Number.class.isAssignableFrom(target)) { throw new NumberFormatException("property " + name + " was null"); } else { return null; } } T rc = (T) TypeConversionSupport.convert(value, target); if (rc == null) { throw new MessageFormatException("Property " + name + " was a " + value.getClass().getName() + " and cannot be read as a " + target.getName()); } return rc; }  }
JMSMessagePropertySupport { @SuppressWarnings("unchecked") public static <T> T convertPropertyTo(String name, Object value, Class<T> target) throws JMSException { if (value == null) { if (Boolean.class.equals(target)) { return (T) Boolean.FALSE; } else if (Float.class.equals(target) || Double.class.equals(target)) { throw new NullPointerException("property " + name + " was null"); } else if (Number.class.isAssignableFrom(target)) { throw new NumberFormatException("property " + name + " was null"); } else { return null; } } T rc = (T) TypeConversionSupport.convert(value, target); if (rc == null) { throw new MessageFormatException("Property " + name + " was a " + value.getClass().getName() + " and cannot be read as a " + target.getName()); } return rc; }  @SuppressWarnings("unchecked") static T convertPropertyTo(String name, Object value, Class<T> target); static void checkPropertyNameIsValid(String propertyName, boolean validateNames); static void checkIdentifierIsntLogicOperator(String identifier); static void checkIdentifierIsntNullTrueFalse(String identifier); static void checkIdentifierLetterAndDigitRequirements(String identifier); static void checkValidObject(Object value); }
JMSMessagePropertySupport { @SuppressWarnings("unchecked") public static <T> T convertPropertyTo(String name, Object value, Class<T> target) throws JMSException { if (value == null) { if (Boolean.class.equals(target)) { return (T) Boolean.FALSE; } else if (Float.class.equals(target) || Double.class.equals(target)) { throw new NullPointerException("property " + name + " was null"); } else if (Number.class.isAssignableFrom(target)) { throw new NumberFormatException("property " + name + " was null"); } else { return null; } } T rc = (T) TypeConversionSupport.convert(value, target); if (rc == null) { throw new MessageFormatException("Property " + name + " was a " + value.getClass().getName() + " and cannot be read as a " + target.getName()); } return rc; }  @SuppressWarnings("unchecked") static T convertPropertyTo(String name, Object value, Class<T> target); static void checkPropertyNameIsValid(String propertyName, boolean validateNames); static void checkIdentifierIsntLogicOperator(String identifier); static void checkIdentifierIsntNullTrueFalse(String identifier); static void checkIdentifierLetterAndDigitRequirements(String identifier); static void checkValidObject(Object value);  }