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:gda.device.scannable.DummyMultiElementScannable.java

@Override
public Object rawGetPosition() {
    double[] returnPos = currentPosition;
    // add the 'extra' element to the array of positions
    for (@SuppressWarnings("unused")
    String foo : extraNames) {/*from   w w  w  .j  ava2 s . com*/
        returnPos = ArrayUtils.add(returnPos, Math.random() * 10 - 5);
    }
    return returnPos;
}

From source file:com.manydesigns.elements.servlet.MutableHttpServletRequest.java

public void addParameter(String name, String value) {
    String[] oldValues = parameterMap.get(name);
    String[] newValues = (String[]) ArrayUtils.add(oldValues, value);
    parameterMap.put(name, newValues);//w  w  w .ja  va  2s . c om
}

From source file:net.navasoft.madcoin.backend.services.controller.exception.impl.ControllerExceptionFactory.java

/**
 * Creates a new ControllerException object.
 * /*  w  w  w  .  java2  s  .c  o  m*/
 * @param expectedException
 *            the expected exception
 * @param allowedTips
 *            forwarded service tips
 * @param variables
 *            the variables
 * @return the session net.navasoft.madcoin.backend.model.controller.impl
 *         exception
 */
public static ControllerException createException(String expectedException, int allowedTips,
        ControllerExceptionArgument... variables) {
    ControllerException childMade = null;
    try {
        variables = (ControllerExceptionArgument[]) ArrayUtils.add(variables,
                new ControllerExceptionArgument(allowedTips));
        Object builtException = locator.get(expectedException)
                .getConstructor(MessageSource.class, Locale.class, ControllerExceptionArgument[].class)
                .newInstance(exceptionMessages, language, (Object) variables);
        childMade = ControllerException.class.cast(builtException);
        childMade.prepareTips(allowedTips, tips);
        childMade.formulateTips();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }
    return childMade;
}

From source file:com.thoughtworks.go.i18n.LocalizedKeyValueMessage.java

public CurryableLocalizable addParam(Object param) {
    return new LocalizedKeyValueMessage(key, ArrayUtils.add(args, param));
}

From source file:com.contrastsecurity.ide.eclipse.core.ContrastCoreActivator.java

public static boolean saveNewOrganization(final String organizationName, final String contrastUrl,
        final String username, final String serviceKey, final String apiKey, final String organizationUuid) {
    initPrefs();//  w  w  w  .  j  a  v  a  2s  . c om

    String[] list = getOrganizationList();
    list = (String[]) ArrayUtils.add(list, organizationName);
    saveOrganizationList(list, false);

    prefs.put(organizationName,
            contrastUrl + ";" + username + ";" + serviceKey + ";" + apiKey + ";" + organizationUuid);

    return flushPrefs();
}

From source file:info.magnolia.cms.filters.MultipartRequestWrapperTest.java

private void addParameter(MultipartForm form, String name, String value) {
    form.addParameter(name, value);//from w  ww.  j  av  a2  s  .c o m

    String[] values = form.getParameterValues(name);
    if (values == null) {
        form.addparameterValues(name, new String[] { value });
    } else {
        form.addparameterValues(name, (String[]) ArrayUtils.add(values, value));
    }
}

From source file:com.manydesigns.elements.servlet.MutableHttpServletRequest.java

public void addFileItem(String name, FileItem item) {
    FileItem[] oldValues = fileItemMap.get(name);
    FileItem[] newValues = (FileItem[]) ArrayUtils.add(oldValues, item);
    fileItemMap.put(name, newValues);//from w ww  .jav  a  2 s  .  c om
}

From source file:net.navasoft.madcoin.backend.services.vo.response.impl.AuthenticationFailedResponseVO.java

/**
 * Gets the causes.//from   w ww  .ja  va 2  s .  com
 * 
 * @return the causes
 * @since 28/07/2014, 10:51:01 PM
 */
@Override
@JsonIgnore
public Object[] getCauses() {
    Object[] causes = (Object[]) Array.newInstance(Object.class, 0);
    causes = ArrayUtils.add(causes, failedUser);
    causes = ArrayUtils.add(causes, failedUserType);
    causes = ArrayUtils.add(causes, additionalMessage);
    return causes;
}

From source file:com.aionengine.gameserver.restrictions.RestrictionsManager.java

public synchronized static void activate(Restrictions restriction) {
    for (Method method : restriction.getClass().getMethods()) {
        RestrictionMode mode = RestrictionMode.parse(method);

        if (mode == null)
            continue;

        if (method.getAnnotation(DisabledRestriction.class) != null)
            continue;

        Restrictions[] restrictions = RESTRICTIONS[mode.ordinal()];

        if (!ArrayUtils.contains(restrictions, restriction))
            restrictions = (Restrictions[]) ArrayUtils.add(restrictions, restriction);

        Arrays.sort(restrictions, mode);

        RESTRICTIONS[mode.ordinal()] = restrictions;
    }//from   ww  w .  java2 s  .  c  o  m
}

From source file:com.jaeksoft.searchlib.result.collector.collapsing.CollapseDistanceCollector.java

@Override
final public void collectCollapsedDoc(final int sourcePos, final int collapsePos) {
    parent.collectCollapsedDoc(sourcePos, collapsePos);
    if (collapsedDistances == null)
        return;/*www.j ava2 s . c  om*/
    if (collapsedDistances[collapsePos] == null)
        collapsedDistances[collapsePos] = new float[] { sourceDistances[sourcePos] };
    else
        collapsedDistances[collapsePos] = ArrayUtils.add(collapsedDistances[collapsePos],
                sourceDistances[sourcePos]);

}