/** * Creates a new KIND property whose value is set to "individual". * @return the new KIND property */ public static Kind individual() { return new Kind(INDIVIDUAL); }
@Override protected void _validate(List<ValidationWarning> warnings, VCardVersion version, VCard vcard) { super._validate(warnings, version, vcard); if (vcard.getKind() == null || !vcard.getKind().isGroup()) { warnings.add(new ValidationWarning(17)); } }
if (vcard.getKind() != null) isGroup = vcard.getKind().isGroup();
/** * Creates a new KIND property whose value is set to "org". * @return the new KIND property */ public static Kind org() { return new Kind(ORG); }
/** * Creates a new KIND property whose value is set to "group". * @return the new KIND property */ public static Kind group() { return new Kind(GROUP); }
/** * Creates a new KIND property whose value is set to "location". * @return the new KIND property */ public static Kind location() { return new Kind(LOCATION); }
@Override public Kind copy() { return new Kind(this); } }
@Override protected Kind _parseValue(String value) { return new Kind(value); } }
/** * Creates a new KIND property whose value is set to "application". * @return the new KIND property * @see <a href="http://tools.ietf.org/html/rfc6473">RFC 6473</a> */ public static Kind application() { return new Kind(APPLICATION); }
/** * Creates a new KIND property whose value is set to "device". * @return the new KIND property * @see <a href="http://tools.ietf.org/html/rfc6869">RFC 6869</a> */ public static Kind device() { return new Kind(DEVICE); }
public static void main(String... args) throws Exception { Gson gson = new GsonBuilder().setPrettyPrinting().create(); Type type = new TypeToken< Map<String, Map<String, Map<String, String>>>>() {}.getType(); Map<String, Map<String, Map<String, String>>> source = gson.fromJson(json, type); Map<String, Facility> dest = new HashMap<String, Facility>(); for (String facilityName : source.keySet()) { Map<String, Map<String, String>> facility = source.get(facilityName); Facility f = new Facility(); for (String kindName : facility.keySet()) f.children.add(new Kind(kindName, facility.get(kindName))); dest.put(facilityName, f); } System.out.println(gson.toJson(dest)); }