@Test public void testConvertToParameterValuesArray() { Object[] a = new Object[3]; a[0] = "Hello"; a[1] = 1234; a[2] = true; Object aRet = convertToParameterValues(a); assertTrue(aRet instanceof Object[]); Object[] aRetArr = (Object[]) aRet; assertEquals("Hello", aRetArr[0]); assertEquals(1234, aRetArr[1]); assertEquals(true, aRetArr[2]); }
public static Object convertToParameterValues(Object object) { Collection<Object> collection; if (object instanceof Object[]) { collection = Arrays.asList((Object[]) object); } else if (object instanceof Collection) { collection = (Collection<Object>) object; } else { LOGGER.warn("Unable to convert value, ignoring"); return new Object[] {}; } List<Object> s = new LinkedList<>(); for (Object o : collection) { Object converted = convertToParameterValue(o); if (converted instanceof Object[]) { s.addAll(Arrays.asList((Object[]) converted)); } else { s.add(converted); } } return s.toArray(new Object[s.size()]); }
BuilderUtils { public static Object convertToParameterValues(Object object) { Collection<Object> collection; if (object instanceof Object[]) { collection = Arrays.asList((Object[]) object); } else if (object instanceof Collection) { collection = (Collection<Object>) object; } else { LOGGER.warn("Unable to convert value, ignoring"); return new Object[] {}; } List<Object> s = new LinkedList<>(); for (Object o : collection) { Object converted = convertToParameterValue(o); if (converted instanceof Object[]) { s.addAll(Arrays.asList((Object[]) converted)); } else { s.add(converted); } } return s.toArray(new Object[s.size()]); } }
BuilderUtils { public static Object convertToParameterValues(Object object) { Collection<Object> collection; if (object instanceof Object[]) { collection = Arrays.asList((Object[]) object); } else if (object instanceof Collection) { collection = (Collection<Object>) object; } else { LOGGER.warn("Unable to convert value, ignoring"); return new Object[] {}; } List<Object> s = new LinkedList<>(); for (Object o : collection) { Object converted = convertToParameterValue(o); if (converted instanceof Object[]) { s.addAll(Arrays.asList((Object[]) converted)); } else { s.add(converted); } } return s.toArray(new Object[s.size()]); } private  BuilderUtils(); }
BuilderUtils { public static Object convertToParameterValues(Object object) { Collection<Object> collection; if (object instanceof Object[]) { collection = Arrays.asList((Object[]) object); } else if (object instanceof Collection) { collection = (Collection<Object>) object; } else { LOGGER.warn("Unable to convert value, ignoring"); return new Object[] {}; } List<Object> s = new LinkedList<>(); for (Object o : collection) { Object converted = convertToParameterValue(o); if (converted instanceof Object[]) { s.addAll(Arrays.asList((Object[]) converted)); } else { s.add(converted); } } return s.toArray(new Object[s.size()]); } private  BuilderUtils(); static String getComponentName(Collection<String> existingNames, String name); static Class<S> getClassFromString(
      String className, String... defaultPackage); static Object convertToParameterValue(Object object); static Object convertToParameterValues(Object object); static Object[] mergeAndExtractParams(
      Map<String, ? extends Object> globalConfig,
      Map<String, ? extends Object> localParams,
      Collection<String> ignoreParams,
      Map<String, ExternalResourceDescription> resources); static Object[] extractParams(
      Map<String, ? extends Object> config,
      Collection<String> ignoreParams,
      Map<String, ExternalResourceDescription> resources); static String getClassNameFromConfig(Object config); static Map<String, Object> getParamsFromConfig(Object config); static Object[] convertToStringArray(Object[] params); static Map<String, Object> flattenConfig(String key, Map<String, Object> config); }
BuilderUtils { public static Object convertToParameterValues(Object object) { Collection<Object> collection; if (object instanceof Object[]) { collection = Arrays.asList((Object[]) object); } else if (object instanceof Collection) { collection = (Collection<Object>) object; } else { LOGGER.warn("Unable to convert value, ignoring"); return new Object[] {}; } List<Object> s = new LinkedList<>(); for (Object o : collection) { Object converted = convertToParameterValue(o); if (converted instanceof Object[]) { s.addAll(Arrays.asList((Object[]) converted)); } else { s.add(converted); } } return s.toArray(new Object[s.size()]); } private  BuilderUtils(); static String getComponentName(Collection<String> existingNames, String name); static Class<S> getClassFromString(
      String className, String... defaultPackage); static Object convertToParameterValue(Object object); static Object convertToParameterValues(Object object); static Object[] mergeAndExtractParams(
      Map<String, ? extends Object> globalConfig,
      Map<String, ? extends Object> localParams,
      Collection<String> ignoreParams,
      Map<String, ExternalResourceDescription> resources); static Object[] extractParams(
      Map<String, ? extends Object> config,
      Collection<String> ignoreParams,
      Map<String, ExternalResourceDescription> resources); static String getClassNameFromConfig(Object config); static Map<String, Object> getParamsFromConfig(Object config); static Object[] convertToStringArray(Object[] params); static Map<String, Object> flattenConfig(String key, Map<String, Object> config);  }