code: @SuppressWarnings("unchecked")
  	private <T> T getCompatibleProperty(String propertyName, Class<T> expectedClass, String exceptionMessage, JSONObject dictionary) throws JSONException {
  		Object propertyValue = null;
  		try {
  			propertyValue = dictionary.get(propertyName);
  		} catch (Exception e) {
  		}
  		if (propertyValue == null) return null;
  		if (propertyValue.getClass().equals(expectedClass)) return (T) propertyValue;
  		try {
  			exceptionMessage = String.format(exceptionMessage, propertyValue);
  		} catch (Exception e) {
  		}
  		throw new PayloadAlertAlreadyExistsException(exceptionMessage);
  
  	}
docs: Get the value of a given property, but only if it is of the expected class.
  If the value exists but is of a different class than expected, an
  exception is thrown.
  
  This method is useful for properly supporting properties that can have a simple
  or complex value (such as "alert")
  
  @param <T> the property value's class
  @param propertyName the name of the property to get
  @param expectedClass the property value's expected (required) class
  @param exceptionMessage the exception message to throw if the value is not of the expected class
  @param dictionary the dictionary where to get the property from
  @return the property's value
  @throws JSONException