Example usage for org.apache.commons.lang ArrayUtils add

List of usage examples for org.apache.commons.lang ArrayUtils add

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils add.

Prototype

public static short[] add(short[] array, short element) 

Source Link

Document

Copies the given array and adds the given element at the end of the new array.

Usage

From source file:v201302.creativesetservice.UpdateCreativeSetExample.java

public static void main(String[] args) {
    try {// w ww  .  j  av a 2s.co m
        // Log SOAP XML request and response.
        DfpServiceLogger.log();

        // Get DfpUser from "~/dfp.properties".
        DfpUser user = new DfpUser();

        // Get the CreativeSetService.
        CreativeSetServiceInterface creativeSetService = user
                .getService(DfpService.V201302.CREATIVE_SET_SERVICE);

        // Set the ID of the creative set to get and the companion creative to
        // add.
        Long creativeSetId = Long.parseLong("INSERT_CREATIVE_SET_ID_HERE");
        Long companionCreativeId = Long.parseLong("INSERT_COMPANION_CREATIVE_ID_HERE");

        // Get the creative set.
        CreativeSet creativeSet = creativeSetService.getCreativeSet(creativeSetId);

        // Add the companion creative to the creative set.
        creativeSet.setCompanionCreativeIds(
                ArrayUtils.add(creativeSet.getCompanionCreativeIds(), companionCreativeId));

        // Update the creative set on the server.
        creativeSet = creativeSetService.updateCreativeSet(creativeSet);

        // Display results.
        System.out.println("A creative set with ID \"" + creativeSet.getId() + "\", master creative ID \""
                + creativeSet.getMasterCreativeId() + "\", and companion creative IDs {"
                + StringUtils.join(ArrayUtils.toObject(creativeSet.getCompanionCreativeIds()), ',')
                + "} was updated.");
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:v201306.creativesetservice.UpdateCreativeSetExample.java

public static void main(String[] args) {
    try {/*from  ww w .  ja  va 2 s  .c  om*/
        // Log SOAP XML request and response.
        DfpServiceLogger.log();

        // Get DfpUser from "~/dfp.properties".
        DfpUser user = new DfpUser();

        // Get the CreativeSetService.
        CreativeSetServiceInterface creativeSetService = user
                .getService(DfpService.V201306.CREATIVE_SET_SERVICE);

        // Set the ID of the creative set to get and the companion creative to
        // add.
        Long creativeSetId = Long.parseLong("INSERT_CREATIVE_SET_ID_HERE");
        Long companionCreativeId = Long.parseLong("INSERT_COMPANION_CREATIVE_ID_HERE");

        // Get the creative set.
        CreativeSet creativeSet = creativeSetService.getCreativeSet(creativeSetId);

        // Add the companion creative to the creative set.
        creativeSet.setCompanionCreativeIds(
                ArrayUtils.add(creativeSet.getCompanionCreativeIds(), companionCreativeId));

        // Update the creative set on the server.
        creativeSet = creativeSetService.updateCreativeSet(creativeSet);

        // Display results.
        System.out.println("A creative set with ID \"" + creativeSet.getId() + "\", master creative ID \""
                + creativeSet.getMasterCreativeId() + "\", and companion creative IDs {"
                + StringUtils.join(ArrayUtils.toObject(creativeSet.getCompanionCreativeIds()), ',')
                + "} was updated.");
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:v201308.creativesetservice.UpdateCreativeSetExample.java

public static void main(String[] args) {
    try {/*from   w  w  w  .  j  a v a  2 s .  co  m*/
        // Log SOAP XML request and response.
        DfpServiceLogger.log();

        // Get DfpUser from "~/dfp.properties".
        DfpUser user = new DfpUser();

        // Get the CreativeSetService.
        CreativeSetServiceInterface creativeSetService = user
                .getService(DfpService.V201308.CREATIVE_SET_SERVICE);

        // Set the ID of the creative set to get and the companion creative to
        // add.
        Long creativeSetId = Long.parseLong("INSERT_CREATIVE_SET_ID_HERE");
        Long companionCreativeId = Long.parseLong("INSERT_COMPANION_CREATIVE_ID_HERE");

        // Get the creative set.
        CreativeSet creativeSet = creativeSetService.getCreativeSet(creativeSetId);

        // Add the companion creative to the creative set.
        creativeSet.setCompanionCreativeIds(
                ArrayUtils.add(creativeSet.getCompanionCreativeIds(), companionCreativeId));

        // Update the creative set on the server.
        creativeSet = creativeSetService.updateCreativeSet(creativeSet);

        // Display results.
        System.out.println("A creative set with ID \"" + creativeSet.getId() + "\", master creative ID \""
                + creativeSet.getMasterCreativeId() + "\", and companion creative IDs {"
                + StringUtils.join(ArrayUtils.toObject(creativeSet.getCompanionCreativeIds()), ',')
                + "} was updated.");
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:v201311.creativesetservice.UpdateCreativeSetExample.java

public static void main(String[] args) {
    try {//from   www.  ja  v  a 2 s  .  c  o m
        // Log SOAP XML request and response.
        DfpServiceLogger.log();

        // Get DfpUser from "~/dfp.properties".
        DfpUser user = new DfpUser();

        // Get the CreativeSetService.
        CreativeSetServiceInterface creativeSetService = user
                .getService(DfpService.V201311.CREATIVE_SET_SERVICE);

        // Set the ID of the creative set to get and the companion creative to
        // add.
        Long creativeSetId = Long.parseLong("INSERT_CREATIVE_SET_ID_HERE");
        Long companionCreativeId = Long.parseLong("INSERT_COMPANION_CREATIVE_ID_HERE");

        // Get the creative set.
        CreativeSet creativeSet = creativeSetService.getCreativeSet(creativeSetId);

        // Add the companion creative to the creative set.
        creativeSet.setCompanionCreativeIds(
                ArrayUtils.add(creativeSet.getCompanionCreativeIds(), companionCreativeId));

        // Update the creative set on the server.
        creativeSet = creativeSetService.updateCreativeSet(creativeSet);

        // Display results.
        System.out.println("A creative set with ID \"" + creativeSet.getId() + "\", master creative ID \""
                + creativeSet.getMasterCreativeId() + "\", and companion creative IDs {"
                + StringUtils.join(ArrayUtils.toObject(creativeSet.getCompanionCreativeIds()), ',')
                + "} was updated.");
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:wzw.lang.ArraySupport.java

public static Object[] add(Object[] array, Object element) {
    return ArrayUtils.add(array, element);
}