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

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

Introduction

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

Prototype

Object[] EMPTY_OBJECT_ARRAY

To view the source code for org.apache.commons.lang ArrayUtils EMPTY_OBJECT_ARRAY.

Click Source Link

Document

An empty immutable Object array.

Usage

From source file:com.tera.common.event.DefaultEventContainer.java

@Override
public void fireEvent(String eventType, Event event) {
    fireEvent(eventType, event, ArrayUtils.EMPTY_OBJECT_ARRAY);
}

From source file:com.cyclopsgroup.waterview.servlet.MultipartServletRequestParameters.java

/**
 * Override method doGetAttributeNames in class MultipartServletRequestValueParser
 *
 * @see com.cyclopsgroup.waterview.Attributes#doGetAttributeNames()
 *//*from  w w  w . jav  a  2s. c  o m*/
protected String[] doGetAttributeNames() {
    return (String[]) content.keySet().toArray(ArrayUtils.EMPTY_OBJECT_ARRAY);
}

From source file:at.ac.tuwien.infosys.jcloudscale.api.CloudObjects.java

/**
 * Creates a remote CloudObjects of the desired type using the given parameters for the remote constructor
 * invocation.//from www .j a  v a 2  s.c o m
 * <p/>
 * <b>Note that the created proxy does not redirect method invocations to the corresponding CloudObject.</b><br/>
 * Instead {@link #invoke(Object, java.lang.reflect.Method, Object...)} must be used in order to access the remote
 * object.
 * 
 * @param type the type of the object to create
 * @param args the constructor arguments
 * @return a proxy for the remote object
 * @throws ReflectiveOperationException if an exception occurred during object creation
 */
public static <T> T create(Class<T> type, Object... args) throws ReflectiveOperationException {
    args = firstNonNull(args, ArrayUtils.EMPTY_OBJECT_ARRAY);
    Constructor<?> constructor = ReflectionUtil.findConstructor(type,
            ReflectionUtil.getClassesFromObjects(args));
    return create(constructor, type, args);
}

From source file:net.firejack.platform.core.config.meta.context.UpgradeFromFileConfigContext.java

@Override
public Object[] getParameters() {
    return ArrayUtils.EMPTY_OBJECT_ARRAY;
}

From source file:com.qcadoo.customTranslation.internal.CustomTranslationResolverImpl.java

@Override
public String getCustomTranslation(final String key, final Locale locale, final String[] args) {
    String translation = customTranslationCacheService.getCustomTranslation(key, locale.getLanguage());

    if (translation == null) {
        return null;
    } else {/*  ww w. ja va 2  s. com*/
        translation = translation.replace("'", "''");

        Object[] argsToUse = args;

        if (!ObjectUtils.isEmpty(argsToUse)) {
            argsToUse = ArrayUtils.EMPTY_OBJECT_ARRAY;
        }

        MessageFormat messageFormat = new MessageFormat(translation);

        return messageFormat.format(argsToUse);
    }
}

From source file:com.google.gdt.eclipse.designer.smart.model.support.SmartGwtHierarchyProvider.java

@Override
public Object[] getChildrenObjects(Object object) throws Exception {
    // com.smartgwt.client.widgets.layout.Layout
    if (isUserClass(object, "com.smartgwt.client.widgets.layout.Layout")) {
        return (Object[]) ReflectionUtils.invokeMethod(object, "getMembers()");
    }//  w ww.  ja  v a  2  s . c  o m
    // com.smartgwt.client.widgets.Canvas
    /* failed for TabSet & probably some others
    if (isUserClass(object, "com.smartgwt.client.widgets.Canvas")) {
       return (Object[]) ReflectionUtils.invokeMethod(object, "getChildren()");
    }*/
    // unknown
    return ArrayUtils.EMPTY_OBJECT_ARRAY;
}

From source file:net.navasoft.madcoin.backend.services.SpecificDateWorkRequestFilter.java

/**
 * Filter./*from w w w .  jav a  2  s.c  o  m*/
 * 
 * @return the i filtered fields
 * @since 27/07/2014, 06:48:18 PM
 */
@Override
public IFilteredFields<?, ?, ?> filter() {
    if (filteredValueObject.getSpecificCost() != null) {
        try {
            properties.updateMandatory(getDescriptors()[0], properties
                    .formatField(filteredValueObject.getSpecificDate(), ArrayUtils.EMPTY_OBJECT_ARRAY));
        } catch (FilterFieldsException e) {
            System.out.println("FUCK!!!");
            e.printStackTrace();
        }
    }
    if (filteredValueObject.getCurrency() != null) {
        properties.updateOptional(getDescriptors()[1], filteredValueObject.getTimeZone());
    }
    return properties;

}

From source file:net.navasoft.madcoin.backend.services.vo.request.SuccessRequestVOWrapper.java

/**
 * Gets the attribute./*from w  ww .ja  v  a2s .c o m*/
 * 
 * @param field
 *            the field
 * @return the attribute
 * @throws WrapperException
 *             the wrapper exception
 * @since 27/07/2014, 06:49:08 PM
 */
public Object getAttribute(final String field) throws WrapperException {
    try {
        return helper.cast(hidden).getClass().getDeclaredMethod("get" + field, ArrayUtils.EMPTY_CLASS_ARRAY)
                .invoke(helper, ArrayUtils.EMPTY_OBJECT_ARRAY);
    } catch (IllegalAccessException e) {
        throw new WrapperException("Not accessible", e);
    } catch (IllegalArgumentException e) {
        throw new WrapperException("Incorrect parameters", e);
    } catch (InvocationTargetException e) {
        throw new WrapperException("Unexpected VO", e);
    } catch (NoSuchMethodException e) {
        throw new WrapperException("Bad typing of bean", e);
    } catch (SecurityException e) {
        throw new WrapperException("Bad runtime access", e);
    }
}

From source file:net.navasoft.madcoin.backend.services.WorkRequestQueryFilter.java

/**
 * Choose filter./*  w  w w  . j  a v a2s  .  c  o  m*/
 * 
 * @param entryVO
 *            the entry vo
 * @return the generic filter
 * @since 27/07/2014, 06:48:16 PM
 */
@Override
public GenericFilter<WorkRequestQueryVO> chooseFilter(WorkRequestQueryVO entryVO) {
    GenericFilter<WorkRequestQueryVO> selector = null;
    Method[] accessors = WorkRequestQueryVO.class.getMethods();
    try {
        accessors = (Method[]) ArrayUtils.removeElement(accessors,
                WorkRequestQueryVO.class.getMethod("getClass", ArrayUtils.EMPTY_CLASS_ARRAY));
    } catch (NoSuchMethodException e1) {
        e1.printStackTrace();
    } catch (SecurityException e1) {
        e1.printStackTrace();
    }
    try {
        if (entryVO != null) {
            for (Method beanGetters : accessors) {
                if (beanGetters.getName().startsWith("get")) {
                    Object fieldValue;
                    fieldValue = beanGetters.invoke(entryVO, ArrayUtils.EMPTY_OBJECT_ARRAY);
                    if (fieldValue != null) {
                        String fieldToFilter = beanGetters.getName().replace("get", "");
                        EFilters guessedFilters = null;
                        if (ArrayUtils.contains(mandatory, fieldToFilter)) {
                            guessedFilters = EFilters.valueOf(fieldToFilter.toUpperCase() + "_FILTER");
                        } else {
                            if (guessedFilters == null) {
                                guessedFilters = optionalCorrelation.get(fieldToFilter);
                            }
                        }
                        selector = (GenericFilter<WorkRequestQueryVO>) Class
                                .forName(guessedFilters.getImplementingClass()).getConstructor(EFilters.class)
                                .newInstance(guessedFilters);
                    }
                }
            }
            if (selector == null) {
                selector = WorkRequestNoFilter.class.newInstance();
            } else {
                selector.setScope(entryVO);
            }
            return selector;
        } else {
            selector = WorkRequestNoFilter.class.newInstance();
        }
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    return selector;
}

From source file:com.edmunds.autotest.NoOpInvocationHandler.java

/**
 * Processes a method invocation on a proxy instance and returns
 * the result.  This method will be invoked on an invocation handler
 * when a method is invoked on a proxy instance that it is
 * associated with.//from  w w  w . j a va  2 s  . co m
 *
 * @param proxy  the proxy instance that the method was invoked on
 * @param method the <code>Method</code> instance corresponding to
 *               the interface method invoked on the proxy instance.  The declaring
 *               class of the <code>Method</code> object will be the interface that
 *               the method was declared in, which may be a superinterface of the
 *               proxy interface that the proxy class inherits the method through.
 * @param args   an array of objects containing the values of the
 *               arguments passed in the method invocation on the proxy instance,
 *               or <code>null</code> if interface method takes no arguments.
 *               Arguments of primitive types are wrapped in instances of the
 *               appropriate primitive wrapper class, such as
 *               <code>java.lang.Integer</code> or <code>java.lang.Boolean</code>.
 * @return the value to return from the method invocation on the
 *         proxy instance.  If the declared return type of the interface
 *         method is a primitive type, then the value returned by
 *         this method must be an instance of the corresponding primitive
 *         wrapper class; otherwise, it must be a type assignable to the
 *         declared return type.  If the value returned by this method is
 *         <code>null</code> and the interface method's return type is
 *         primitive, then a <code>NullPointerException</code> will be
 *         thrown by the method invocation on the proxy instance.  If the
 *         value returned by this method is otherwise not compatible with
 *         the interface method's declared return type as described above,
 *         a <code>ClassCastException</code> will be thrown by the method
 *         invocation on the proxy instance.
 * @throws Throwable the exception to throw from the method
 *                   invocation on the proxy instance.  The exception's type must be
 *                   assignable either to any of the exception types declared in the
 *                   <code>throws</code> clause of the interface method or to the
 *                   unchecked exception types <code>java.lang.RuntimeException</code>
 *                   or <code>java.lang.Error</code>.  If a checked exception is
 *                   thrown by this method that is not assignable to any of the
 *                   exception types declared in the <code>throws</code> clause of
 *                   the interface method, then an
 *                   {@link java.lang.reflect.UndeclaredThrowableException} containing the
 *                   exception that was thrown by this method will be thrown by the
 *                   method invocation on the proxy instance.
 * @see java.lang.reflect.UndeclaredThrowableException
 */
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

    final String name = method.getName();
    if ("equals".equals(name)) {
        return args.length == 1 && proxy == args[0];
    }

    if ("hashCode".equals(name)) {
        return 0;
    }

    if ("toString".equals(name)) {
        return "NoOpInvocationHandler";
    }

    if ("getClass".equals(name)) {
        return method.getDeclaringClass();
    }

    // The following methods are to fix NPEs when using a GUI Debugger.
    if ("isEmpty".equals(name)) {
        return Boolean.TRUE;
    }

    if ("toArray".equals(name)) {
        return ArrayUtils.EMPTY_OBJECT_ARRAY;
    }

    if ("size".equals(name)) {
        return 0;
    }
    // End debugger support

    System.out.println("NoOpInvocationHandler: Missing Proxy Method: " + name);

    return null;
}