Example usage for org.springframework.util ClassUtils hasConstructor

List of usage examples for org.springframework.util ClassUtils hasConstructor

Introduction

In this page you can find the example usage for org.springframework.util ClassUtils hasConstructor.

Prototype

public static boolean hasConstructor(Class<?> clazz, Class<?>... paramTypes) 

Source Link

Document

Determine whether the given class has a public constructor with the given signature.

Usage

From source file:org.xaloon.wicket.component.application.VirtualPageFactory.java

private Panel newInstance(MountPanel mp, PageParameters parameters)
        throws InstantiationException, IllegalAccessException {
    Class<? extends Panel> clz = mp.panel();
    try {// ww w .  ja  va2s  . com
        if ((parameters != null)
                && ClassUtils.hasConstructor(clz, new Class[] { String.class, PageParameters.class })) {
            return clz.getConstructor(String.class, PageParameters.class).newInstance("content", parameters);
        } else if (ClassUtils.hasConstructor(clz, new Class[] { String.class })) {
            return clz.getConstructor(String.class).newInstance("content");
        }
    } catch (Exception e) {
        log.error("Panel was not created!", e);
    }
    return clz.newInstance();
}