List of usage examples for org.apache.commons.lang ArrayUtils EMPTY_OBJECT_ARRAY
Object[] EMPTY_OBJECT_ARRAY
To view the source code for org.apache.commons.lang ArrayUtils EMPTY_OBJECT_ARRAY.
Click Source Link
Object
array. From source file:com.google.gdt.eclipse.designer.model.widgets.support.GwtState.java
/** * Disposes top level GWT <code>Window</code> class. *///from ww w . ja v a 2s. c o m private void disposeWindowClass() throws Exception { if (!m_initialized) { return; } // outstanding dispatch events spawned just after the browser shell is disposed. // the workaround is to call onClosed event handler before disposing and... Class<?> classOfWindow = m_uiObjectUtils.getClassOfWindow(); ReflectionUtils.invokeMethod(classOfWindow, "onClosed()"); // prevent fire again // < 1.6 way { // used Vector class prior to 1.4 and ArrayList class for 1.4, // so use reflection to invoke 'clear()' Field closingListenersField = ReflectionUtils.getFieldByName(classOfWindow, "closingListeners"); if (closingListenersField != null) { Object closingListeners = ReflectionUtils.getFieldObject(classOfWindow, "closingListeners"); // ...clear listeners ReflectionUtils.invokeMethod(closingListeners, "clear()"); } } // 1.6 way: disable listeners fire { Field handlersInitedField = ReflectionUtils.getFieldByName(classOfWindow, "closeHandlersInitialized"); if (handlersInitedField != null) { ReflectionUtils.setField(classOfWindow, "closeHandlersInitialized", false); } } // remove window listeners to prevent events firing when the editor closed m_hostModeSupport.invokeNativeVoid("__wbp_cleanupEvents", ArrayUtils.EMPTY_CLASS_ARRAY, ArrayUtils.EMPTY_OBJECT_ARRAY); }
From source file:org.apache.niolex.commons.reflect.MethodUtil.java
/** * Java// www. j a v a 2s .c o m * Invoke the method with this specified method name and arguments on the host. We support * auto boxing and primitive relax. * * @param host ? * @param methodName ? * @param args ????? * @return ? * ??? null * ?void?null * @throws ItemNotFoundException ??????? * @throws IllegalArgumentException ?? * @throws IllegalAccessException ?? * @throws InvocationTargetException ? */ public static final Object invokeMethod(Object host, String methodName, Object... args) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { if (args == null) { args = ArrayUtils.EMPTY_OBJECT_ARRAY; } int arguments = args.length; Class<?>[] parameterTypes = new Class<?>[arguments]; for (int i = 0; i < arguments; i++) { parameterTypes[i] = args[i].getClass(); } return invokeMethod(host, methodName, parameterTypes, args); }
From source file:org.brushingbits.jnap.persistence.hibernate.Dao.java
/** * * @param hql * @return */ protected List<E> find(String hql) { return find(hql, ArrayUtils.EMPTY_OBJECT_ARRAY); }
From source file:org.brushingbits.jnap.persistence.hibernate.Dao.java
/** * // w ww. j a v a 2 s . c om * @param hql * @param paging * @return */ protected List<E> find(String hql, boolean paging) { return find(hql, paging, ArrayUtils.EMPTY_OBJECT_ARRAY); }
From source file:org.brushingbits.jnap.persistence.hibernate.DynaQueryBuilder.java
/** * //w ww. jav a 2s . com * @param session * @param entityName * @param dynaQuery * @param queryParams */ DynaQueryBuilder(Session session, String entityName, String dynaQuery, Object... queryParams) { Assert.notNull(session); Assert.hasText(entityName); Assert.hasText(dynaQuery); this.session = session; this.entityName = entityName; this.dynaQuery = dynaQuery; this.queryParams = queryParams == null ? ArrayUtils.EMPTY_OBJECT_ARRAY : queryParams; this.entityMetadata = this.session.getSessionFactory().getClassMetadata(this.entityName); buildCriterionBuilderStrategy(); }
From source file:org.brushingbits.jnap.struts2.RestActionInvocation.java
@Override protected String invokeAction(Object action, ActionConfig actionConfig) throws Exception { String methodName = actionConfig.getMethodName(); Object methodResult = null;//from ww w .j a v a 2 s . c om try { // try { methodResult = MethodUtils.invokeMethod(action, methodName, ArrayUtils.EMPTY_OBJECT_ARRAY); // } catch (NoSuchMethodException ex) { // if (unknownHandlerManager.hasUnknownHandlers()) { // try { // methodResult = unknownHandlerManager.handleUnknownMethod(action, methodName); // } catch (NoSuchMethodException nestedEx) { // throw ex; // } // } else { // throw ex; // } // } String resultCode = null; if (methodResult != null) { if (methodResult instanceof Result) { container.inject((Result) methodResult); } else { Response response = null; if (methodResult.getClass().equals(String.class)) { response = Response.ok((String) methodResult); } else if (methodResult instanceof Response) { response = (Response) methodResult; } else { // TODO should never happen, once the mapper is doing its job } Object target = action; if (response.getEntity() != null) { target = response.getEntity(); } else if (action instanceof ModelDriven) { target = ((ModelDriven) action).getModel(); } response.setEntity(target); resultCode = mediaTypeManager.handle(response); } } return resultCode; } catch (NoSuchMethodException e) { throw new IllegalArgumentException( "The " + methodName + "() is not defined in action " + getAction().getClass() + ""); } catch (InvocationTargetException e) { Throwable sourceException = e.getTargetException(); if (actionEventListener != null) { String result = actionEventListener.handleException(sourceException, getStack()); if (result != null) { return result; } } if (sourceException instanceof Exception) { throw (Exception) sourceException; } else { throw e; } } }
From source file:org.brushingbits.jnap.validation.constraints.AbstractConstraintValidator.java
/** * This method copies all the annotation properties to fields with the same name. * // ww w . ja v a 2 s.c om * @param constraintAnnotation This constraint annotation. * @see PropertyAccessorFactory */ protected void bindParameters(A constraintAnnotation) { Class<?> annotationClass = constraintAnnotation.getClass(); Method[] methods = annotationClass.getDeclaredMethods(); ConfigurablePropertyAccessor accessor = PropertyAccessorFactory.forDirectFieldAccess(this); try { for (Method method : methods) { String methodName = method.getName(); if (accessor.isWritableProperty(methodName)) { accessor.setPropertyValue(methodName, method.invoke(constraintAnnotation, ArrayUtils.EMPTY_OBJECT_ARRAY)); } } } catch (Exception e) { ReflectionUtils.handleReflectionException(e); } }
From source file:org.eclipse.jubula.client.ui.rcp.provider.contentprovider.CentralTestDataContentProvider.java
/** * {@inheritDoc}/*from www . j a v a 2 s . c o m*/ */ public Object[] getChildren(Object parentElement) { if (parentElement instanceof ITestDataCategoryPO) { ITestDataCategoryPO category = (ITestDataCategoryPO) parentElement; List<Object> childList = new ArrayList<Object>(); childList.addAll(category.getCategoryChildren()); childList.addAll(category.getTestDataChildren()); return childList.toArray(); } return ArrayUtils.EMPTY_OBJECT_ARRAY; }
From source file:org.eclipse.jubula.client.ui.rcp.provider.contentprovider.EventHandlerContentProvider.java
/** * * {@inheritDoc} */ public Object[] getChildren(Object parentElement) { return ArrayUtils.EMPTY_OBJECT_ARRAY; }
From source file:org.eclipse.jubula.client.ui.rcp.provider.contentprovider.objectmapping.OMEditorTreeContentProvider.java
/** * // w w w . j av a 2s. c o m * {@inheritDoc} */ public Object[] getChildren(Object parentElement) { if (parentElement instanceof IObjectMappingPO) { IObjectMappingPO mapping = (IObjectMappingPO) parentElement; List<IObjectMappingCategoryPO> categoryList = new ArrayList<IObjectMappingCategoryPO>(); categoryList.add(mapping.getMappedCategory()); categoryList.add(mapping.getUnmappedLogicalCategory()); categoryList.add(mapping.getUnmappedTechnicalCategory()); Validate.noNullElements(categoryList); return categoryList.toArray(); } if (parentElement instanceof IObjectMappingAssoziationPO) { IObjectMappingAssoziationPO assoc = (IObjectMappingAssoziationPO) parentElement; List<String> componentNameGuidList = assoc.getLogicalNames(); List<Object> componentNamePoList = new ArrayList<Object>(); for (String compNameGuid : componentNameGuidList) { IComponentNamePO compNamePo = m_compNameMapper.getCompNameCache().getCompNamePo(compNameGuid); if (compNamePo != null) { componentNamePoList.add(compNamePo); m_childToParentMap.put(compNamePo, parentElement); } else { componentNamePoList.add(compNameGuid); m_childToParentMap.put(compNamePo, parentElement); } } Validate.noNullElements(componentNamePoList); return componentNamePoList.toArray(); } if (parentElement instanceof IComponentNamePO) { return ArrayUtils.EMPTY_OBJECT_ARRAY; } if (parentElement instanceof IObjectMappingCategoryPO) { List<Object> childList = new ArrayList<Object>(); IObjectMappingCategoryPO category = (IObjectMappingCategoryPO) parentElement; childList.addAll(category.getUnmodifiableCategoryList()); for (IObjectMappingAssoziationPO assoc : category.getUnmodifiableAssociationList()) { if (assoc.getTechnicalName() != null) { childList.add(assoc); } else { for (String compNameGuid : assoc.getLogicalNames()) { IComponentNamePO compName = m_compNameMapper.getCompNameCache().getCompNamePo(compNameGuid); if (compName != null) { // Only add the Component Name if it hasn't been // deleted. childList.add(compName); } } } } for (Object child : childList) { m_childToParentMap.put(child, parentElement); } Validate.noNullElements(childList); return childList.toArray(); } else if (parentElement instanceof String) { return ArrayUtils.EMPTY_OBJECT_ARRAY; } Assert.notReached(Messages.WrongTypeOfElement + StringConstants.EXCLAMATION_MARK); return ArrayUtils.EMPTY_OBJECT_ARRAY; }