@Test public void testValidAttributes() { for(Object o : validAttributes) { assertTrue("Should be a valid attribute", LQModel.validValue(o, false)); try { assertTrue("Should be a valid attribute", LQModel.validValue(o, true)); } catch (IllegalArgumentException e) { fail("Should not throw exception because is a valid attribute"); } } }
public static boolean validValue(Object attribute, boolean raiseException) { boolean isValid = ((attribute == null) || (attribute instanceof String) || (attribute instanceof Number) || (attribute instanceof Boolean) || (attribute instanceof Date)); if(!isValid) { LiquidTools.exceptionOrLog(raiseException, "Value (" + attribute + ") with unsupported type. Supported: (String, Number, Boolean, Date)"); } return isValid; }
LQModel implements Serializable { public static boolean validValue(Object attribute, boolean raiseException) { boolean isValid = ((attribute == null) || (attribute instanceof String) || (attribute instanceof Number) || (attribute instanceof Boolean) || (attribute instanceof Date)); if(!isValid) { LiquidTools.exceptionOrLog(raiseException, "Value (" + attribute + ") with unsupported type. Supported: (String, Number, Boolean, Date)"); } return isValid; } }
LQModel implements Serializable { public static boolean validValue(Object attribute, boolean raiseException) { boolean isValid = ((attribute == null) || (attribute instanceof String) || (attribute instanceof Number) || (attribute instanceof Boolean) || (attribute instanceof Date)); if(!isValid) { LiquidTools.exceptionOrLog(raiseException, "Value (" + attribute + ") with unsupported type. Supported: (String, Number, Boolean, Date)"); } return isValid; }  }
LQModel implements Serializable { public static boolean validValue(Object attribute, boolean raiseException) { boolean isValid = ((attribute == null) || (attribute instanceof String) || (attribute instanceof Number) || (attribute instanceof Boolean) || (attribute instanceof Date)); if(!isValid) { LiquidTools.exceptionOrLog(raiseException, "Value (" + attribute + ") with unsupported type. Supported: (String, Number, Boolean, Date)"); } return isValid; }  static String newIdentifier(); static boolean validKey(String key, boolean raiseException); static boolean validValue(Object attribute, boolean raiseException); static HashMap<String, Object> sanitizeAttributes(Map<String, Object> attributes, boolean raiseException); void save(Context context, String path); static JSONObject retriveFromFile(Context context, String path); static List<Object> toList(JSONArray array, String[] excludedKeys); abstract JSONObject toJSON(); }
LQModel implements Serializable { public static boolean validValue(Object attribute, boolean raiseException) { boolean isValid = ((attribute == null) || (attribute instanceof String) || (attribute instanceof Number) || (attribute instanceof Boolean) || (attribute instanceof Date)); if(!isValid) { LiquidTools.exceptionOrLog(raiseException, "Value (" + attribute + ") with unsupported type. Supported: (String, Number, Boolean, Date)"); } return isValid; }  static String newIdentifier(); static boolean validKey(String key, boolean raiseException); static boolean validValue(Object attribute, boolean raiseException); static HashMap<String, Object> sanitizeAttributes(Map<String, Object> attributes, boolean raiseException); void save(Context context, String path); static JSONObject retriveFromFile(Context context, String path); static List<Object> toList(JSONArray array, String[] excludedKeys); abstract JSONObject toJSON();  }