boolean getTreatUnknownKeyAsError(Element element) { JsonModel model = element.getAnnotation(JsonModel.class); if (model == null) { throw new IllegalArgumentException(); } return model.treatUnknownKeyAsError(); }
String getElementKeyString(Element element) { JsonKey key = element.getAnnotation(JsonKey.class); JsonModel model = element.getEnclosingElement().getAnnotation(JsonModel.class); String keyStr; if (!"".equals(key.value())) { keyStr = key.value(); } else if ("".equals(key.value()) && key.decamelize()) { keyStr = decamelize(element.toString()); } else if ("".equals(key.value()) && model.decamelize()) { keyStr = decamelize(element.toString()); } else { keyStr = element.toString(); } return keyStr; }