@Test void testNullPrefer() { assertNull(valueOf(null), "Check null value"); }
public static Prefer valueOf(final String value) { if (value != null) { final Map<String, String> data = new HashMap<>(); final Set<String> params = new HashSet<>(); stream(value.split(";")).map(String::trim).map(pref -> pref.split("=", 2)).forEach(x -> { if (x.length == 2) { data.put(x[0].trim(), x[1].trim()); } else { params.add(x[0].trim()); } }); return new Prefer(data.get(PREFER_RETURN), parseParameter(data.get(PREFER_INCLUDE)), parseParameter(data.get(PREFER_OMIT)), params, data.get(PREFER_HANDLING)); } return null; }
Prefer { public static Prefer valueOf(final String value) { if (value != null) { final Map<String, String> data = new HashMap<>(); final Set<String> params = new HashSet<>(); stream(value.split(";")).map(String::trim).map(pref -> pref.split("=", 2)).forEach(x -> { if (x.length == 2) { data.put(x[0].trim(), x[1].trim()); } else { params.add(x[0].trim()); } }); return new Prefer(data.get(PREFER_RETURN), parseParameter(data.get(PREFER_INCLUDE)), parseParameter(data.get(PREFER_OMIT)), params, data.get(PREFER_HANDLING)); } return null; } }
Prefer { public static Prefer valueOf(final String value) { if (value != null) { final Map<String, String> data = new HashMap<>(); final Set<String> params = new HashSet<>(); stream(value.split(";")).map(String::trim).map(pref -> pref.split("=", 2)).forEach(x -> { if (x.length == 2) { data.put(x[0].trim(), x[1].trim()); } else { params.add(x[0].trim()); } }); return new Prefer(data.get(PREFER_RETURN), parseParameter(data.get(PREFER_INCLUDE)), parseParameter(data.get(PREFER_OMIT)), params, data.get(PREFER_HANDLING)); } return null; } Prefer(final String preference, final List<String> include, final List<String> omit,
            final Set<String> params, final String handling); }
Prefer { public static Prefer valueOf(final String value) { if (value != null) { final Map<String, String> data = new HashMap<>(); final Set<String> params = new HashSet<>(); stream(value.split(";")).map(String::trim).map(pref -> pref.split("=", 2)).forEach(x -> { if (x.length == 2) { data.put(x[0].trim(), x[1].trim()); } else { params.add(x[0].trim()); } }); return new Prefer(data.get(PREFER_RETURN), parseParameter(data.get(PREFER_INCLUDE)), parseParameter(data.get(PREFER_OMIT)), params, data.get(PREFER_HANDLING)); } return null; } Prefer(final String preference, final List<String> include, final List<String> omit,
            final Set<String> params, final String handling); static Prefer valueOf(final String value); Optional<String> getPreference(); Optional<String> getHandling(); boolean getRespondAsync(); List<String> getInclude(); List<String> getOmit(); @Override String toString(); static Prefer ofInclude(final String... includes); static Prefer ofOmit(final String... omits); }
Prefer { public static Prefer valueOf(final String value) { if (value != null) { final Map<String, String> data = new HashMap<>(); final Set<String> params = new HashSet<>(); stream(value.split(";")).map(String::trim).map(pref -> pref.split("=", 2)).forEach(x -> { if (x.length == 2) { data.put(x[0].trim(), x[1].trim()); } else { params.add(x[0].trim()); } }); return new Prefer(data.get(PREFER_RETURN), parseParameter(data.get(PREFER_INCLUDE)), parseParameter(data.get(PREFER_OMIT)), params, data.get(PREFER_HANDLING)); } return null; } Prefer(final String preference, final List<String> include, final List<String> omit,
            final Set<String> params, final String handling); static Prefer valueOf(final String value); Optional<String> getPreference(); Optional<String> getHandling(); boolean getRespondAsync(); List<String> getInclude(); List<String> getOmit(); @Override String toString(); static Prefer ofInclude(final String... includes); static Prefer ofOmit(final String... omits); static final String PREFER_REPRESENTATION; static final String PREFER_MINIMAL; static final String PREFER_STRICT; static final String PREFER_LENIENT; static final String PREFER_RETURN; static final String PREFER_INCLUDE; static final String PREFER_OMIT; static final String PREFER_HANDLING; }