@Test public void testGetParameter() throws Exception { Parameter[] parameters = new Parameter[] { new Parameter_impl("bob", "foo"), new Parameter_impl("joe", "bar"), new Parameter_impl("sue", "baz") }; Parameter p = LeoUtils.getParameter("bob", parameters); assertNotNull(p); assertEquals("foo", p.getValue()); p = LeoUtils.getParameter("mary", parameters); assertNull(p); p = LeoUtils.getParameter("", parameters); assertNull(p); p = LeoUtils.getParameter("bob", new Parameter[0]); assertNull(p); }
public static Parameter getParameter(String name, Parameter[] parameters) { if(ArrayUtils.isEmpty(parameters) || StringUtils.isBlank(name)) return null; Optional<Parameter> param = Arrays.asList(parameters).parallelStream() .filter(parameter -> parameter.getName().equals(name)) .findFirst(); if(param.isPresent()) return param.get(); return null; }
LeoUtils { public static Parameter getParameter(String name, Parameter[] parameters) { if(ArrayUtils.isEmpty(parameters) || StringUtils.isBlank(name)) return null; Optional<Parameter> param = Arrays.asList(parameters).parallelStream() .filter(parameter -> parameter.getName().equals(name)) .findFirst(); if(param.isPresent()) return param.get(); return null; } }
LeoUtils { public static Parameter getParameter(String name, Parameter[] parameters) { if(ArrayUtils.isEmpty(parameters) || StringUtils.isBlank(name)) return null; Optional<Parameter> param = Arrays.asList(parameters).parallelStream() .filter(parameter -> parameter.getName().equals(name)) .findFirst(); if(param.isPresent()) return param.get(); return null; }  }
LeoUtils { public static Parameter getParameter(String name, Parameter[] parameters) { if(ArrayUtils.isEmpty(parameters) || StringUtils.isBlank(name)) return null; Optional<Parameter> param = Arrays.asList(parameters).parallelStream() .filter(parameter -> parameter.getName().equals(name)) .findFirst(); if(param.isPresent()) return param.get(); return null; }  static String getTimestampDateDotTime(); static String getTimestampDateUnderscoreTime(); static String getUUID(); static URL createURL(String name); static String getFileURI(File f); static List<File> listFiles(File src, FileFilter filter, boolean recurse); static String extractPearFile(File installDir, File pearFile, boolean doVerification, boolean cleanInstallDir); static Class<?> getRuntimeClass(); static ConfigObject loadConfigFile(String environment, String... configFilePaths); static String filterText(String input, List<TextFilter> filters); static Set<ConfigurationParameter> getStaticConfigurationParameters(Class c); static Parameter getParameter(String name, Parameter[] parameters); static Parameter[] addParameter(Parameter p, Parameter[] parameters); static Map<String, String> parseMappingString(String jsonString); static String getHeaderManipulationSafeString(Object object); }
LeoUtils { public static Parameter getParameter(String name, Parameter[] parameters) { if(ArrayUtils.isEmpty(parameters) || StringUtils.isBlank(name)) return null; Optional<Parameter> param = Arrays.asList(parameters).parallelStream() .filter(parameter -> parameter.getName().equals(name)) .findFirst(); if(param.isPresent()) return param.get(); return null; }  static String getTimestampDateDotTime(); static String getTimestampDateUnderscoreTime(); static String getUUID(); static URL createURL(String name); static String getFileURI(File f); static List<File> listFiles(File src, FileFilter filter, boolean recurse); static String extractPearFile(File installDir, File pearFile, boolean doVerification, boolean cleanInstallDir); static Class<?> getRuntimeClass(); static ConfigObject loadConfigFile(String environment, String... configFilePaths); static String filterText(String input, List<TextFilter> filters); static Set<ConfigurationParameter> getStaticConfigurationParameters(Class c); static Parameter getParameter(String name, Parameter[] parameters); static Parameter[] addParameter(Parameter p, Parameter[] parameters); static Map<String, String> parseMappingString(String jsonString); static String getHeaderManipulationSafeString(Object object);  }