Example #1
0
 @Override
 public JsonElement serialize(Attribute src, Type typeOfSrc, JsonSerializationContext context) {
   JsonObject o = new JsonObject();
   o.addProperty(ATTRIBUTE_ID_PROPERTY, src.getAttributeId());
   if (src.getIssuer() != null) {
     o.addProperty(ISSUER_PROPERTY, src.getIssuer());
   }
   Collection<AttributeExp> values = src.getValues();
   serializeValue(context, o, values);
   // OMIT property if value is "false"
   if (src.isIncludeInResult()) {
     o.addProperty(INCLUDE_IN_RESULT_PROPERTY, src.isIncludeInResult());
   }
   return o;
 }