@Test public void checkValueSimpleAndValid() { assertTrue(PebbleTemplating.checkValueSimpleAndValid("param", "a", "string")); assertTrue(PebbleTemplating.checkValueSimpleAndValid("param", 1, "integer")); assertTrue(PebbleTemplating.checkValueSimpleAndValid("param", 2l, "long")); assertTrue(PebbleTemplating.checkValueSimpleAndValid("param", 3f, "float")); assertTrue(PebbleTemplating.checkValueSimpleAndValid("param", 4d, "double")); assertTrue(PebbleTemplating.checkValueSimpleAndValid("param", true, "boolean")); assertTrue(PebbleTemplating.checkValueSimpleAndValid("param", Lists.newArrayList(), "array")); assertTrue(PebbleTemplating.checkValueSimpleAndValid("param", Maps.newHashMap(), "object")); try { assertFalse(PebbleTemplating.checkValueSimpleAndValid("param", 1, "string")); fail(); } catch (Exception e) { } try { assertFalse(PebbleTemplating.checkValueSimpleAndValid("param", 1d, "integer")); fail(); } catch (Exception e) { } try { assertFalse(PebbleTemplating.checkValueSimpleAndValid("param", 1, "long")); fail(); } catch (Exception e) { } try { assertFalse(PebbleTemplating.checkValueSimpleAndValid("param", 1, "float")); fail(); } catch (Exception e) { } try { assertFalse(PebbleTemplating.checkValueSimpleAndValid("param", 1, "double")); fail(); } catch (Exception e) { } try { assertFalse(PebbleTemplating.checkValueSimpleAndValid("param", 1, "boolean")); fail(); } catch (Exception e) { } try { assertFalse(PebbleTemplating.checkValueSimpleAndValid("param", Maps.newHashMap(), "array")); fail(); } catch (Exception e) { } try { assertFalse(PebbleTemplating.checkValueSimpleAndValid("param", Lists.newArrayList(), "object")); fail(); } catch (Exception e) { } }
static boolean checkValueSimpleAndValid(String name, Object value, String type) { if (string.equals(type)) return checkValueType(name, value, String.class); if (integer.equals(type)) return checkValueType(name, value, Integer.class); if (longg.equals(type)) return checkValueType(name, value, Long.class); if (floatt.equals(type)) return checkValueType(name, value, Float.class); if (doublee.equals(type)) return checkValueType(name, value, Double.class); if (booleann.equals(type)) return checkValueType(name, value, Boolean.class); if (array.equals(type)) return checkValueType(name, value, List.class); if (object.equals(type)) return checkValueType(name, value, Map.class); return false; }
PebbleTemplating implements TemplateParameterTypes { static boolean checkValueSimpleAndValid(String name, Object value, String type) { if (string.equals(type)) return checkValueType(name, value, String.class); if (integer.equals(type)) return checkValueType(name, value, Integer.class); if (longg.equals(type)) return checkValueType(name, value, Long.class); if (floatt.equals(type)) return checkValueType(name, value, Float.class); if (doublee.equals(type)) return checkValueType(name, value, Double.class); if (booleann.equals(type)) return checkValueType(name, value, Boolean.class); if (array.equals(type)) return checkValueType(name, value, List.class); if (object.equals(type)) return checkValueType(name, value, Map.class); return false; } }
PebbleTemplating implements TemplateParameterTypes { static boolean checkValueSimpleAndValid(String name, Object value, String type) { if (string.equals(type)) return checkValueType(name, value, String.class); if (integer.equals(type)) return checkValueType(name, value, Integer.class); if (longg.equals(type)) return checkValueType(name, value, Long.class); if (floatt.equals(type)) return checkValueType(name, value, Float.class); if (doublee.equals(type)) return checkValueType(name, value, Double.class); if (booleann.equals(type)) return checkValueType(name, value, Boolean.class); if (array.equals(type)) return checkValueType(name, value, List.class); if (object.equals(type)) return checkValueType(name, value, Map.class); return false; } private  PebbleTemplating(); }
PebbleTemplating implements TemplateParameterTypes { static boolean checkValueSimpleAndValid(String name, Object value, String type) { if (string.equals(type)) return checkValueType(name, value, String.class); if (integer.equals(type)) return checkValueType(name, value, Integer.class); if (longg.equals(type)) return checkValueType(name, value, Long.class); if (floatt.equals(type)) return checkValueType(name, value, Float.class); if (doublee.equals(type)) return checkValueType(name, value, Double.class); if (booleann.equals(type)) return checkValueType(name, value, Boolean.class); if (array.equals(type)) return checkValueType(name, value, List.class); if (object.equals(type)) return checkValueType(name, value, Map.class); return false; } private  PebbleTemplating(); Map<String, Object> createContext(Map<String, String> model, Map<String, Object> parameters); String render(String propertyName, String propertyValue, Map<String, Object> context); List<String> render(String propertyName, List<String> propertyValue, Map<String, Object> context); static PebbleTemplating get(); }
PebbleTemplating implements TemplateParameterTypes { static boolean checkValueSimpleAndValid(String name, Object value, String type) { if (string.equals(type)) return checkValueType(name, value, String.class); if (integer.equals(type)) return checkValueType(name, value, Integer.class); if (longg.equals(type)) return checkValueType(name, value, Long.class); if (floatt.equals(type)) return checkValueType(name, value, Float.class); if (doublee.equals(type)) return checkValueType(name, value, Double.class); if (booleann.equals(type)) return checkValueType(name, value, Boolean.class); if (array.equals(type)) return checkValueType(name, value, List.class); if (object.equals(type)) return checkValueType(name, value, Map.class); return false; } private  PebbleTemplating(); Map<String, Object> createContext(Map<String, String> model, Map<String, Object> parameters); String render(String propertyName, String propertyValue, Map<String, Object> context); List<String> render(String propertyName, List<String> propertyValue, Map<String, Object> context); static PebbleTemplating get();  }