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

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

Introduction

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

Prototype

public static double[] addAll(double[] array1, double[] array2) 

Source Link

Document

Adds all the elements of the given arrays into a new array.

Usage

From source file:com.github.talberto.easybeans.atg.test.repository.AutoInitializingGSA.java

@Override
public File[] getImportFiles() {
    File[] configuredImportFiles = super.getImportFiles();
    File[] importFiles = getAutoImportFiles();
    if (importFiles != null && configuredImportFiles != null) {
        importFiles = (File[]) ArrayUtils.addAll(importFiles, configuredImportFiles);
    }/*  w w w. j a  v a 2  s  .  co m*/
    if (importFiles == null) {
        importFiles = configuredImportFiles;
    }
    return importFiles;
}

From source file:br.gov.frameworkdemoiselle.util.contrib.Reflections.java

/**
 * Build a array of super classes fields
 * /*from   w w w  .  j a  v  a 2  s .  co m*/
 * @return Array of Super Classes Fields
 */
public static Field[] getSuperClassesFields(Class<?> entryClass) {
    Field[] fieldArray = null;
    fieldArray = (Field[]) ArrayUtils.addAll(fieldArray, entryClass.getDeclaredFields());
    Class<?> superClazz = entryClass.getSuperclass();
    while (superClazz != null && !"java.lang.Object".equals(superClazz.getName())) {
        fieldArray = (Field[]) ArrayUtils.addAll(fieldArray, superClazz.getDeclaredFields());
        superClazz = superClazz.getSuperclass();
    }
    return fieldArray;
}

From source file:com.playonlinux.app.PlayOnLinuxRuntimeError.java

@Override
public StackTraceElement[] getStackTrace() {
    return (StackTraceElement[]) ArrayUtils.addAll(super.getStackTrace(), this.parent.getStackTrace());
}

From source file:com.baasbox.service.user.FriendShipService.java

private static Object[] addFriendShipRoleToCriteria(QueryParams criteria, String friendShipRole) {
    Object[] params = criteria.getParams();
    Object[] newParams = new Object[] { friendShipRole };
    Object[] veryNewParams = ArrayUtils.addAll(newParams, params);
    return veryNewParams;
}

From source file:com.abiquo.model.util.ModelTransformer.java

public static <T> void transform(final Class sourceClass, final Class<T> targetClass, final Object source,
        final T target) throws Exception {
    Field[] transportFields = sourceClass.getDeclaredFields();
    Class superClass = sourceClass.getSuperclass();
    while (!superClass.getSimpleName().equalsIgnoreCase("SingleResourceTransportDto")) {
        transportFields = (Field[]) ArrayUtils.addAll(transportFields, superClass.getDeclaredFields());
        superClass = superClass.getSuperclass();
    }//from w  w  w .j  a v a2s.co m

    for (Field field : transportFields) {

        int modifiers = field.getModifiers();
        if (!Modifier.isTransient(modifiers) && !Modifier.isStatic(modifiers)) {
            String name = field.getName();
            try {
                if (fieldExist(name, targetClass) && fieldExist(name, source.getClass())
                        || getterExist(name, source.getClass())
                                && setterExist(name, targetClass, field.getType())) {
                    Object value = getter(name, source.getClass()).invoke(source, new Object[0]);

                    if (setterExist(name, targetClass, field.getType())) {
                        setter(name, targetClass, field.getType()).invoke(target, new Object[] { value });
                    }
                }
            } catch (InvocationTargetException e) {
                // Ignore invalid field
            }
        }

    }

}

From source file:io.servicecomb.serviceregistry.version.Version.java

public Version(String version) {
    Objects.requireNonNull(version);

    String[] versions = version.split("\\.", -1);
    if (versions.length > 3) {
        throw new IllegalStateException(String.format("Invalid version \"%s\".", version));
    }//from w ww . ja v  a  2s  .c o m

    if (versions.length < 3) {
        versions = (String[]) ArrayUtils.addAll(versions, ZERO);
    }
    this.major = parseNumber("major", version, versions[0]);
    this.minor = parseNumber("minor", version, versions[1]);
    this.patch = parseNumber("patch", version, versions[2]);

    this.version = combineStringVersion();
    this.numberVersion = combineVersion();
}

From source file:io.hops.transaction.lock.BatchedBlockLock.java

@Override
protected void acquire(TransactionLocks locks) throws IOException {
    //INodes are not locked in this case
    if (unresolvedBlockIds != null && unresolvedBlockIds.length != 0) {
        long[] inodeIdsForURBlks = INodeUtil.resolveINodesFromBlockIds(unresolvedBlockIds);
        blockIds = ArrayUtils.addAll(blockIds, unresolvedBlockIds);
        inodeIds = ArrayUtils.addAll(inodeIds, inodeIdsForURBlks);
    }/*from ww w  .  j  a  v  a2s . c o m*/

    blocks.addAll(acquireLockList(DEFAULT_LOCK_TYPE, BlockInfoContiguous.Finder.ByBlockIdsAndINodeIds, blockIds,
            inodeIds));
}

From source file:gda.data.scan.datawriter.scannablewriter.SingleScannableWriter.java

protected static int indexForComponentName(final Scannable s, final String component) {
    // FIXME : ArrayUtils.addAll(s.getInputNames(), s.getExtraNames()) should yield same result
    final String[] all = (String[]) ArrayUtils.addAll(
            (s.getInputNames() != null) ? s.getInputNames() : new String[] {},
            (s.getExtraNames() != null) ? s.getExtraNames() : new String[] {});

    if (all != null) {
        for (int i = 0; i < all.length; i++) {
            if (component.equals(all[i])) {
                return i;
            }//  w  ww .  jav  a2  s  . c o  m
        }
    }

    throw new ArrayIndexOutOfBoundsException();
}

From source file:com.dianping.lion.util.BeanUtils.java

public static Field[] getDeclaredFields(Class<?> clazz) {
    Assert.notNull(clazz);/* w ww . j  a  v  a2  s.  c o  m*/
    Field[] fields = clazz.getDeclaredFields();
    for (Class<?> superClass = clazz; superClass != Object.class; superClass = superClass.getSuperclass()) {
        fields = (Field[]) ArrayUtils.addAll(fields, superClass.getDeclaredFields());
    }
    return fields;
}

From source file:com.ejwa.dinja.utility.ArrayHelper.java

/**
 * Returns the index, within a wrapped array, of the first occurrence of the specified subarray. This method works in
 * a similar fashion to {@link #indexOfSubArray(Object[], Object[]) indexOfSubArray(T[], T[])}, but loops through the
 * array twice when searchnig for the subarray.
 *
 * @param array An array to search in.//from w  ww. j av  a  2s  .co  m
 * @param subArray The subarray for which to search.
 * @return The index within this array of the first occurrence of the specified subarray.
 * @see #indexOfSubArray(Object[], Object[]) indexOfSubArray(T[], T[])
 */
public static <T> int indexOfSubArrayWrapped(T[] array, T[] subArray) {
    return indexOfSubArray(ArrayUtils.addAll(array, array), subArray);
}