@Test public void verifyValueOfWithEmptyString() { HateoasVerbosity verbosity = HateoasVerbosity.valueOf(""); assertEquals(HateoasVerbosity.MAXIMUM, verbosity); }
public static HateoasVerbosity valueOf(String optionsString) { if (StringUtils.isNotBlank(optionsString)) { String[] headerSplit; if(optionsString.contains(",")){ headerSplit = StringUtils.split(optionsString, ","); } else { headerSplit = StringUtils.split(optionsString, ";"); } List<HateoasOption> options = new LinkedList<HateoasOption>(); for (String oneOption : headerSplit) { options.add(HateoasOption.valueOf(oneOption.trim())); } return new HateoasVerbosity( options.toArray(new HateoasOption[0])); } else { return defaultVerbosity; } }
HateoasVerbosity { public static HateoasVerbosity valueOf(String optionsString) { if (StringUtils.isNotBlank(optionsString)) { String[] headerSplit; if(optionsString.contains(",")){ headerSplit = StringUtils.split(optionsString, ","); } else { headerSplit = StringUtils.split(optionsString, ";"); } List<HateoasOption> options = new LinkedList<HateoasOption>(); for (String oneOption : headerSplit) { options.add(HateoasOption.valueOf(oneOption.trim())); } return new HateoasVerbosity( options.toArray(new HateoasOption[0])); } else { return defaultVerbosity; } } }
HateoasVerbosity { public static HateoasVerbosity valueOf(String optionsString) { if (StringUtils.isNotBlank(optionsString)) { String[] headerSplit; if(optionsString.contains(",")){ headerSplit = StringUtils.split(optionsString, ","); } else { headerSplit = StringUtils.split(optionsString, ";"); } List<HateoasOption> options = new LinkedList<HateoasOption>(); for (String oneOption : headerSplit) { options.add(HateoasOption.valueOf(oneOption.trim())); } return new HateoasVerbosity( options.toArray(new HateoasOption[0])); } else { return defaultVerbosity; } } HateoasVerbosity(HateoasOption... options); }
HateoasVerbosity { public static HateoasVerbosity valueOf(String optionsString) { if (StringUtils.isNotBlank(optionsString)) { String[] headerSplit; if(optionsString.contains(",")){ headerSplit = StringUtils.split(optionsString, ","); } else { headerSplit = StringUtils.split(optionsString, ";"); } List<HateoasOption> options = new LinkedList<HateoasOption>(); for (String oneOption : headerSplit) { options.add(HateoasOption.valueOf(oneOption.trim())); } return new HateoasVerbosity( options.toArray(new HateoasOption[0])); } else { return defaultVerbosity; } } HateoasVerbosity(HateoasOption... options); static void setDefaultVerbosity(HateoasVerbosity verbosity); static HateoasVerbosity findByName(String name); static HateoasVerbosity valueOf(String optionsString); HateoasOption[] getOptions(); }
HateoasVerbosity { public static HateoasVerbosity valueOf(String optionsString) { if (StringUtils.isNotBlank(optionsString)) { String[] headerSplit; if(optionsString.contains(",")){ headerSplit = StringUtils.split(optionsString, ","); } else { headerSplit = StringUtils.split(optionsString, ";"); } List<HateoasOption> options = new LinkedList<HateoasOption>(); for (String oneOption : headerSplit) { options.add(HateoasOption.valueOf(oneOption.trim())); } return new HateoasVerbosity( options.toArray(new HateoasOption[0])); } else { return defaultVerbosity; } } HateoasVerbosity(HateoasOption... options); static void setDefaultVerbosity(HateoasVerbosity verbosity); static HateoasVerbosity findByName(String name); static HateoasVerbosity valueOf(String optionsString); HateoasOption[] getOptions(); static HateoasVerbosity ATOM; static HateoasVerbosity MAXIMUM; static HateoasVerbosity MINIMUM; static HateoasVerbosity NORMAL; static HateoasVerbosity GENERIC_CLIENT; }