Example usage for java.lang ReflectiveOperationException ReflectiveOperationException

List of usage examples for java.lang ReflectiveOperationException ReflectiveOperationException

Introduction

In this page you can find the example usage for java.lang ReflectiveOperationException ReflectiveOperationException.

Prototype

public ReflectiveOperationException() 

Source Link

Document

Constructs a new exception with null as its detail message.

Usage

From source file:fr.juanwolf.mysqlbinlogreplicator.component.DomainClassAnalyzer.java

public Object generateInstanceFromName(String name) throws ReflectiveOperationException {
    DomainClass domainClass = domainClassMap.get(name);
    if (domainClass == null) {
        log.error("Class with name {} not found.", name);
        throw new ReflectiveOperationException();
    }/*from w  w  w.  jav  a2 s .c om*/
    Class classAsked = domainClassMap.get(name).getDomainClass();
    try {
        Constructor classConstructor = classAsked.getConstructor();
        return classConstructor.newInstance();
    } catch (Exception e) {
        log.error("Impossible to instantiate an instance of {}: "
                + "no empty constructor found or the constructor is private for class {}", name, name);
    }
    // Should never happen.
    return null;
}