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:org.jnap.core.persistence.jpa.DaoSupport.java

/**
 * 
 * @param jpql
 * @return
 */
protected List<E> find(String jpql) {
    return find(jpql, ArrayUtils.EMPTY_OBJECT_ARRAY);
}

From source file:org.jnap.core.persistence.jpa.DaoSupport.java

/**
 * //from  www.j  av  a  2  s.c  o m
 * @param jpql
 * @param paging
 * @return
 */
protected List<E> find(String jpql, boolean paging) {
    return find(jpql, paging, ArrayUtils.EMPTY_OBJECT_ARRAY);
}

From source file:org.marketcetera.util.log.I18NMessage0P.java

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

From source file:org.polymap.biotop.model.importer.AnnotatedCompositeImporter.java

public void fillEntity(Composite composite, Map<String, Object> row) {
    for (Map.Entry<String, Object> rowEntry : row.entrySet()) {
        String propName = nameMap.get(rowEntry.getKey());
        if (propName != null && rowEntry.getValue() != null) {
            try {
                Method m = type.getDeclaredMethod(propName, ArrayUtils.EMPTY_CLASS_ARRAY);
                Property p = (Property) m.invoke(composite, ArrayUtils.EMPTY_OBJECT_ARRAY);
                // String
                if (String.class.equals(p.type())) {
                    p.set(rowEntry.getValue().toString());
                }//from w w  w . j  ava  2  s .co  m
                // Integer
                else if (Integer.class.equals(p.type())) {
                    p.set(((Number) rowEntry.getValue()).intValue());
                }
                // Long
                else if (Long.class.equals(p.type())) {
                    p.set(((Number) rowEntry.getValue()).longValue());
                }
                // Float
                else if (Float.class.equals(p.type())) {
                    p.set(((Number) rowEntry.getValue()).floatValue());
                }
                // Double
                else if (Double.class.equals(p.type())) {
                    p.set(((Number) rowEntry.getValue()).doubleValue());
                }
                // Boolean
                else if (Boolean.class.equals(p.type())) {
                    p.set(rowEntry.getValue());
                } else {
                    throw new RuntimeException("Unhandled property type: " + p.type());
                }
                //log.info( "    property: " + p.qualifiedName().name() + " = " + rowEntry.getValue() );
            } catch (Exception e) {
                throw new RuntimeException("Property: " + propName, e);
            }
        } else {
            //log.info( "    skipping column value: " + rowEntry.getKey() );
        }
    }
}

From source file:org.polymap.core.runtime.recordstore.RecordModel.java

/**
 * Allows to access the properties of the model (name, type(?)) in a static way.
 *
 * @param <M> The state model type.
 * @param cl The state model class./*  ww w. j  ava  2 s.  c  om*/
 * @return A new type instance with null state.
 */
public static <M extends RecordModel> M type(Class<M> cl) {
    IRecordState nullState = new IRecordState() {
        public IRecordState add(String key, Object value) {
            throw new RuntimeException("Not allowed for TYPE state.");
        }

        public <T> T get(String key) {
            throw new RuntimeException("Not allowed for TYPE state.");
        }

        public <T> List<T> getList(String key) {
            throw new RuntimeException("Not allowed for TYPE state.");
        }

        public Object id() {
            throw new RuntimeException("Not allowed for TYPE state.");
        }

        public Iterator<Entry<String, Object>> iterator() {
            throw new RuntimeException("Not allowed for TYPE state.");
        }

        public <T> IRecordState put(String key, T value) {
            throw new RuntimeException("Not allowed for TYPE state.");
        }

        public IRecordState remove(String key) {
            throw new RuntimeException("Not allowed for TYPE state.");
        }
    };

    try {
        Constructor<M> ctor = cl.getDeclaredConstructor(new Class[] { IRecordState.class });
        return ctor.newInstance(new Object[] { nullState });
    } catch (Exception e) {
        // try no-arg ctor
        try {
            Constructor<M> ctor = cl.getDeclaredConstructor(ArrayUtils.EMPTY_CLASS_ARRAY);
            return ctor.newInstance(ArrayUtils.EMPTY_OBJECT_ARRAY);
        } catch (Exception e2) {
            throw new RuntimeException(e);
        }
    }
}

From source file:org.polymap.kaps.importer.AnnotatedCompositeImporter.java

public void fillEntity(Composite composite, Map<String, Object> row) {
    for (Map.Entry<String, Object> rowEntry : row.entrySet()) {
        String propName = nameMap.get(rowEntry.getKey());
        if (propName != null && rowEntry.getValue() != null) {
            try {
                Method m = type.getDeclaredMethod(propName, ArrayUtils.EMPTY_CLASS_ARRAY);
                Property p = (Property) m.invoke(composite, ArrayUtils.EMPTY_OBJECT_ARRAY);
                // String
                if (String.class.equals(p.type())) {
                    p.set(rowEntry.getValue().toString());
                }/*from   w ww  .  ja  v  a  2  s. c  o  m*/
                // Integer
                else if (Integer.class.equals(p.type())) {
                    p.set(((Number) rowEntry.getValue()).intValue());
                }
                // Long
                else if (Long.class.equals(p.type())) {
                    p.set(((Number) rowEntry.getValue()).longValue());
                }
                // Float
                else if (Float.class.equals(p.type())) {
                    p.set(((Number) rowEntry.getValue()).floatValue());
                }
                // Double
                else if (Double.class.equals(p.type())) {
                    p.set(((Number) rowEntry.getValue()).doubleValue());
                }
                // Boolean
                else if (Boolean.class.equals(p.type())) {
                    p.set(rowEntry.getValue());
                }
                // Date
                else if (java.util.Date.class.equals(p.type())) {
                    p.set(rowEntry.getValue());
                } else {
                    throw new RuntimeException("Unhandled property type: " + p.type());
                }
                // log.info( "    property: " + p.qualifiedName().name() + " = "
                // + rowEntry.getValue() );
            } catch (Exception e) {
                throw new RuntimeException("Property: " + propName, e);
            }
        } else {
            // log.info( "    skipping column value: " + rowEntry.getKey() );
        }
    }
}

From source file:org.rapidcontext.app.web.AppWebService.java

/**
 * Processes a system status request.//  w  w  w  .  j a  v  a  2  s.  c om
 *
 * @param request        the request to process
 */
protected void processStatus(Request request) {
    try {
        ApplicationContext ctx = ApplicationContext.getInstance();
        Object[] args = ArrayUtils.EMPTY_OBJECT_ARRAY;
        String source = "web [" + request.getRemoteAddr() + "]";
        Object obj = ctx.execute(StatusProcedure.NAME, args, source, null);
        request.sendText(Mime.JSON[0], JsSerializer.serialize(obj, true));
    } catch (ProcedureException e) {
        LOG.warning("error in system status check: " + e.getMessage());
        Dict res = new Dict();
        res.set("error", e.getMessage());
        request.sendText(Mime.JSON[0], JsSerializer.serialize(res, true));
    }
}

From source file:org.sipfoundry.sipxconfig.admin.BackupPlan.java

/**
 * Sends e-mail with a copy of a configuration backup attached. Email is only sent if
 * configuration backup was selected and if e-mail adress is configured.
 *
 * @param backupFiles array of backup files
 *///from www .j  a va2s. c o m
private void sendEmail(File[] backupFiles) {
    if (StringUtils.isBlank(m_emailAddress)) {
        return;
    }
    File confFile = null;
    for (File f : backupFiles) {
        if (f.getName().equals(BackupPlan.CONFIGURATION_ARCHIVE)) {
            confFile = f;
            break;
        }
    }
    if (confFile == null) {
        return;
    }
    Locale locale = Locale.getDefault();
    String subject = m_applicationContext.getMessage("backup.subject", ArrayUtils.EMPTY_OBJECT_ARRAY, locale);
    String body = m_applicationContext.getMessage("backup.body", ArrayUtils.EMPTY_OBJECT_ARRAY, locale);
    m_mailSenderContext.sendMail(m_emailAddress, m_emailFromAddress, subject, body, confFile);
}

From source file:org.sipfoundry.sipxconfig.site.admin.commserver.ServicesTable.java

public Object[] retrieveServiceStatus(Location location) {
    if (location == null) {
        return ArrayUtils.EMPTY_OBJECT_ARRAY;
    }/*from w  w w.j  av a2  s  . c  o m*/
    List<ServiceStatus> statuses = new ArrayList<ServiceStatus>();
    try {
        statuses = getSnmpManager().getServicesStatuses(location);
    } catch (UserException ex) {
        LOG.error(ex.getMessage());
    }
    if (statuses == null || statuses.size() == 0) {
        return ArrayUtils.EMPTY_OBJECT_ARRAY;
    }
    return statuses.toArray();
}

From source file:org.talend.repository.ui.dialog.UseDynamicJobSelectionDialog.java

/**
 * DOC nrousseau Comment method "dispose".
 *//*from  www  .ja  va2  s. c om*/
public void dispose() {
    CheckboxTreeViewer exportItemsTreeViewer = getItemsTreeViewer();
    exportItemsTreeViewer.setCheckedElements(ArrayUtils.EMPTY_OBJECT_ARRAY);
    exportItemsTreeViewer = null;
    repositoryNodes.clear();
    repositoryNodes = null;
    filteredCheckboxTree = null;
}