Example usage for org.apache.commons.collections Transformer Transformer

List of usage examples for org.apache.commons.collections Transformer Transformer

Introduction

In this page you can find the example usage for org.apache.commons.collections Transformer Transformer.

Prototype

Transformer

Source Link

Usage

From source file:org.paxml.bean.AbstractLazyTag.java

@Override
protected Object doInvoke(Context context) throws Exception {
    Iterator it = getIterator(context);
    if (lazy) {/*ww w .j a  va2  s  . co m*/
        return it;
    } else {
        return CollectionUtils.collect(it, new Transformer() {

            @Override
            public Object transform(Object obj) {
                return obj;
            }

        });
    }
}

From source file:org.projectforge.core.DisplayHistoryEntry.java

private Object toShortNameOfList(final Object value) {
    if (value instanceof Collection<?>) {
        return CollectionUtils.collect((Collection<?>) value, new Transformer() {
            public Object transform(final Object input) {
                return toShortName(input);
            }//  ww  w. jav  a  2s  .c o m
        });
    }
    return value;
}

From source file:org.projectforge.framework.persistence.history.DisplayHistoryEntry.java

private Object toShortNameOfList(final Object value) {
    if (value instanceof Collection<?>) {
        return CollectionUtils.collect((Collection<?>) value, new Transformer() {
            @Override/*w  w  w  . j a v a 2s .  c  o  m*/
            public Object transform(final Object input) {
                return toShortName(input);
            }
        });
    }

    return toShortName(value);
}

From source file:org.robotframework.swing.keyword.concurrent.ThreadKeywords.java

@SuppressWarnings("unchecked")
private Collection<String> normalizeKeywordNames(String[] keywordNames) {
    List<String> keywordsList = Arrays.asList(keywordNames);
    return CollectionUtils.collect(keywordsList, new Transformer() {
        public Object transform(Object input) {
            return normalizer.normalize(input.toString());
        }// w  w  w. ja  v  a2  s .co  m
    });
}

From source file:org.robotframework.swing.tree.TreeOperator.java

@SuppressWarnings("unchecked")
public Collection<String> getTreeNodeChildNames(String nodeIdentifier) {
    final TreePath treePath = createTreePath(nodeIdentifier);
    return CollectionUtils.collect(getChildPaths(treePath), new Transformer() {
        public Object transform(Object input) {
            Object node = ((TreePath) input).getLastPathComponent();
            return new NodeTextExtractor((JTree) getSource()).getText(node, treePath);
        }/* ww  w.  j av  a 2s.c o  m*/
    });
}

From source file:org.sipfoundry.sipxconfig.admin.commserver.Location.java

/**
 * Retrieves the list of services installed at this location.
 *
 * For each LocationSpecificService it retrieves the underlying SipxService.
 *///from ww  w  . ja  v a2  s  .  c om
public Collection<SipxService> getSipxServices() {
    Collection<LocationSpecificService> services = getServices();
    Transformer retrieveService = new Transformer() {
        public Object transform(Object item) {
            LocationSpecificService lss = (LocationSpecificService) item;
            return lss.getSipxService();
        }
    };
    return collect(services, retrieveService, new ArrayList());
}

From source file:org.sipfoundry.sipxconfig.service.SipxServiceManagerImpl.java

public List<SipxServiceBundle> getBundlesForLocation(Location location) {
    Transformer transformer = new Transformer() {
        public Object transform(Object modelId) {
            return m_bundleModelSource.getModel((String) modelId);
        }/*from  w  w w. j a  v a 2  s. com*/
    };
    List<String> installedBundles = location.getInstalledBundles();
    return (List<SipxServiceBundle>) collect(installedBundles, transformer, new ArrayList());
}

From source file:org.sipfoundry.sipxconfig.service.SipxServiceManagerImpl.java

/**
 * Transforms the given list of bundles into a corresponding list of bundles Ids
 *
 * @param bundles affected bundles/*from  www  . j a va 2 s .  co  m*/
 * @return corresponding bundles ids
 */
private List<String> transformBundlesToIds(List<SipxServiceBundle> bundles) {
    Transformer extractModelId = new Transformer() {
        public Object transform(Object item) {
            SipxServiceBundle bundle = (SipxServiceBundle) item;
            return bundle.getModelId();
        }

    };
    return (List<String>) collect(bundles, extractModelId, new ArrayList());
}

From source file:org.sonar.api.profiles.RulesProfile.java

@Override
public Object clone() {
    RulesProfile clone = RulesProfile.create(getName(), getLanguage());
    clone.setDefaultProfile(getDefaultProfile());
    clone.setParentName(getParentName());
    if (activeRules != null && !activeRules.isEmpty()) {
        clone.setActiveRules(new ArrayList<ActiveRule>(CollectionUtils.collect(activeRules, new Transformer() {
            public Object transform(Object input) {
                return ((ActiveRule) input).clone();
            }/*from ww  w . j a va  2  s  .  c o m*/
        })));
    }
    if (CollectionUtils.isNotEmpty(getAlerts())) {
        clone.setAlerts(new ArrayList<Alert>(CollectionUtils.collect(getAlerts(), new Transformer() {
            public Object transform(Object input) {
                return ((Alert) input).clone();
            }
        })));
    }
    return clone;
}

From source file:org.sonar.api.rules.ActiveRule.java

@Override
public Object clone() {
    final ActiveRule clone = new ActiveRule(getRulesProfile(), getRule(), getSeverity());
    clone.setInheritance(getInheritance());
    if (CollectionUtils.isNotEmpty(getActiveRuleParams())) {
        clone.setActiveRuleParams(new ArrayList<ActiveRuleParam>(
                CollectionUtils.collect(getActiveRuleParams(), new Transformer() {
                    public Object transform(Object input) {
                        ActiveRuleParam activeRuleParamClone = (ActiveRuleParam) ((ActiveRuleParam) input)
                                .clone();
                        activeRuleParamClone.setActiveRule(clone);
                        return activeRuleParamClone;
                    }//from   ww  w  .j av  a 2s  . co  m
                })));
    }
    return clone;
}