private List<String> getColumnNames(List<String> columnPaths, String tablePath){ return CollectionUtils.map(columnPaths, new Func<String, String>() { @Override public String eval(String columnPath) { if (!tablePath.isEmpty()) { return columnPath.substring(tablePath.length() + 1); } return columnPath; } }); }
public List<RowProcessingConsumer> getConfigurableConsumers() { final List<RowProcessingConsumer> configurableConsumers = CollectionUtils.filter(_consumers, new Predicate<RowProcessingConsumer>() { @Override public Boolean eval(RowProcessingConsumer input) { return input.getComponentJob() instanceof ConfigurableBeanJob<?>; } }); return configurableConsumers; }
/** * Searches a map for a given key. The key can be a regular map key, or a * simple expression of the form: * * <ul> * <li>foo.bar (will lookup 'foo', and then 'bar' in a potential nested map) * </li> * <li>foo.bar[0].baz (will lookup 'foo', then 'bar' in a potential nested * map, then pick the first element in case it is a list/array and then pick * 'baz' from the potential map at that position). * </ul> * * @param map * the map to search in * @param key * the key to resolve * @return the object in the map with the given key/expression. Or null if * it does not exist. */ public static Object find(final Map<String, ?> map, final String key) { return CollectionUtils.find(map, key); }
/** * Lazy initializes a set (for fast searching) of IN values. * * @return a hash set appropriate for IN clause evaluation */ private Set<?> getInValues() { if (_inValues == null) { if (_operand instanceof Set) { _inValues = (Set<?>) _operand; } else { List<?> list = CollectionUtils.toList(_operand); _inValues = new HashSet<Object>(list); } } return _inValues; }
public ScalarFunctionDataSet(List<SelectItem> scalarFunctionSelectItemsToEvaluate, DataSet dataSet) { super(CollectionUtils.concat(false, scalarFunctionSelectItemsToEvaluate, dataSet.getSelectItems())); _scalarFunctionSelectItemsToEvaluate = scalarFunctionSelectItemsToEvaluate; _dataSet = dataSet; }
@Override public B removeInputColumn(InputColumn<?> inputColumn, ConfiguredPropertyDescriptor propertyDescriptor) { Object inputColumns = getConfiguredProperty(propertyDescriptor); if (inputColumns != null) { if (inputColumns == inputColumn) { inputColumns = null; } else { if (inputColumns.getClass().isArray()) { inputColumns = CollectionUtils.arrayRemove(inputColumns, inputColumn); } } setConfiguredProperty(propertyDescriptor, inputColumns); propertyDescriptor.setValue(getComponentInstance(), inputColumns); } return (B) this; }
if (CollectionUtils.isNullOrEmpty(dimensions)) { return callback.getResult(); if (CollectionUtils.isNullOrEmpty(horizontalDimensions) && CollectionUtils.isNullOrEmpty(verticalDimensions)) { return callback.getResult();
/** * Lazy initializes a set (for fast searching) of IN values. * * @return a hash set appropriate for IN clause evaluation */ private Set<?> getInValues() { if (_inValues == null) { if (_operand instanceof Set) { _inValues = (Set<?>) _operand; } else { List<?> list = CollectionUtils.toList(_operand); _inValues = new HashSet<Object>(list); } } return _inValues; }
public ScalarFunctionDataSet(List<SelectItem> scalarFunctionSelectItemsToEvaluate, DataSet dataSet) { super(CollectionUtils.concat(false, scalarFunctionSelectItemsToEvaluate, dataSet.getSelectItems())); _scalarFunctionSelectItemsToEvaluate = scalarFunctionSelectItemsToEvaluate; _dataSet = dataSet; }
@Override public B removeInputColumn(final InputColumn<?> inputColumn, final ConfiguredPropertyDescriptor propertyDescriptor) { Object inputColumns = getConfiguredProperty(propertyDescriptor); if (inputColumns != null) { if (inputColumns == inputColumn) { inputColumns = null; } else { if (inputColumns.getClass().isArray()) { inputColumns = CollectionUtils.arrayRemove(inputColumns, inputColumn); if (!propertyDescriptor.isArray() && Array.getLength(inputColumns) == 0) { inputColumns = null; } } } setConfiguredProperty(propertyDescriptor, inputColumns); propertyDescriptor.setValue(getComponentInstance(), inputColumns); } return (B) this; }
if (CollectionUtils.isNullOrEmpty(dimensions)) { return callback.getResult(); if (CollectionUtils.isNullOrEmpty(horizontalDimensions) && CollectionUtils.isNullOrEmpty(verticalDimensions)) { return callback.getResult();
private static File[] convert(final FileObject[] files) { return CollectionUtils.map(files, VFSUtils::toFile).toArray(new File[0]); }
public static <E> List<E> filter(E[] items, java.util.function.Predicate<? super E> predicate) { return filter(Arrays.asList(items), predicate); }
/** * Searches a map for a given key. The key can be a regular map key, or a * simple expression of the form: * * <ul> * <li>foo.bar (will lookup 'foo', and then 'bar' in a potential nested map) * </li> * <li>foo.bar[0].baz (will lookup 'foo', then 'bar' in a potential nested * map, then pick the first element in case it is a list/array and then pick * 'baz' from the potential map at that position). * </ul> * * @param map * the map to search in * @param key * the key to resolve * @return the object in the map with the given key/expression. Or null if * it does not exist. */ public static Object find(Map<?, ?> map, String key) { if (map == null || key == null) { return null; } final Object result = map.get(key); if (result == null) { return find(map, key, 0); } return result; }
public static Object appendOperator(StringBuilder sb, Object operand, OperatorType operator) { sb.append(' '); sb.append(operator.toSql()); sb.append(' '); if (operator == OperatorType.IN || operator == OperatorType.NOT_IN) { operand = CollectionUtils.toList(operand); } return operand; }
public static Collection<ComponentJob> getAllComponents(final AnalysisJob job) { return CollectionUtils.concat(false, job.getFilterJobs(), job.getTransformerJobs(), job.getAnalyzerJobs()); }
public static <I, O> List<O> map(I[] items, Function<? super I, O> func) { return map(Arrays.asList(items), func); }
public static <E> List<E> filter(E[] items, java.util.function.Predicate<? super E> predicate) { return filter(Arrays.asList(items), predicate); }
/** * Searches a map for a given key. The key can be a regular map key, or a * simple expression of the form: * * <ul> * <li>foo.bar (will lookup 'foo', and then 'bar' in a potential nested map) * </li> * <li>foo.bar[0].baz (will lookup 'foo', then 'bar' in a potential nested * map, then pick the first element in case it is a list/array and then pick * 'baz' from the potential map at that position). * </ul> * * @param map * the map to search in * @param key * the key to resolve * @return the object in the map with the given key/expression. Or null if * it does not exist. */ public static Object find(Map<?, ?> map, String key) { if (map == null || key == null) { return null; } final Object result = map.get(key); if (result == null) { return find(map, key, 0); } return result; }