コード例 #1
0
 @Override
 public String getSerializedConfiguration() throws InternalException {
   ObjectNode main = Constants.MAPPER.createObjectNode();
   ArrayNode allow = main.putArray("allowed");
   for (String a : allowed) allow.add(a);
   try {
     return Constants.MAPPER.writeValueAsString(main);
   } catch (JsonProcessingException e) {
     throw new InternalException("Can't serialize EnumAttributeSyntax to JSON", e);
   }
 }
コード例 #2
0
 @Override
 public void setSerializedConfiguration(String json) throws InternalException {
   JsonNode jsonN;
   try {
     jsonN = Constants.MAPPER.readTree(json);
   } catch (Exception e) {
     throw new InternalException("Can't deserialize StringAttributeSyntax from JSON", e);
   }
   ArrayNode allow = (ArrayNode) jsonN.get("allowed");
   this.allowed = new HashSet<String>(allow.size());
   for (int i = 0; i < allow.size(); i++) this.allowed.add(allow.get(i).asText());
   this.allowed = Collections.unmodifiableSet(this.allowed);
 }