Example usage for java.lang Cloneable getClass

List of usage examples for java.lang Cloneable getClass

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.qrmedia.commons.persistence.hibernate.clone.property.CloneablePropertyCloner.java

private static Cloneable clone(Cloneable cloneable) throws IllegalArgumentException {
    /*/*from   w w  w  . j  av  a2s .  c  om*/
     * Assumes - in spite of the detailed warnings in the documentation
     * for Clonable - that the cloneable *will* have a public clone() method,
     * as per convention.
     */
    try {
        return (Cloneable) cloneable.getClass().getMethod("clone", (Class[]) null).invoke(cloneable,
                (Object[]) null);
    } catch (Exception exception) {
        throw new IllegalArgumentException("Unable to clone " + cloneable + " due to "
                + exception.getClass().getSimpleName() + ": " + exception.getMessage());
    }

}