Example usage for org.apache.commons.collections4 TransformerUtils stringValueTransformer

List of usage examples for org.apache.commons.collections4 TransformerUtils stringValueTransformer

Introduction

In this page you can find the example usage for org.apache.commons.collections4 TransformerUtils stringValueTransformer.

Prototype

public static <T> Transformer<T, String> stringValueTransformer() 

Source Link

Document

Gets a transformer that returns a java.lang.String representation of the input object.

Usage

From source file:com.feilong.core.util.CollectionsUtilTest.java

/**
 * Test collect1./*from  w  w  w .j a v a2 s .  c o m*/
 */
@Test
public void testCollect1() {
    List<String> collect1 = CollectionsUtil.collect((List<Long>) null,
            TransformerUtils.stringValueTransformer());
    assertEquals(emptyList(), collect1);
}

From source file:com.feilong.core.util.CollectionsUtilTest.java

/**
 * Test collect5./*  ww  w  . j  a v  a  2  s.c om*/
 */
@Test
public void testCollect5() {
    List<String> collect1 = CollectionsUtil.collect(new ArrayList<Long>(),
            TransformerUtils.stringValueTransformer());
    assertEquals(emptyList(), collect1);
}

From source file:org.apache.syncope.core.migration.MigrationPullActions.java

@Override
public SyncDelta beforeProvision(final ProvisioningProfile<?, ?> profile, final SyncDelta delta,
        final EntityTO entity) throws JobExecutionException {

    // handles resource assignment, for users and groups
    Attribute resourcesAttr = delta.getObject().getAttributeByName(RESOURCES_ATTR);
    if (entity instanceof AnyTO && resourcesAttr != null && resourcesAttr.getValue() != null
            && !resourcesAttr.getValue().isEmpty()) {

        ((AnyTO) entity).getResources().addAll(
                CollectionUtils.collect(resourcesAttr.getValue(), TransformerUtils.stringValueTransformer()));
    }/* w w  w .  j  ava  2  s .c  o m*/

    return delta;
}