Permalink
Browse files

[#78] Rename methods Reflect#on(Class) and Reflect#on(String) to onCl…

…ass() to avoid ambiguities
  • Loading branch information...
lukaseder committed Feb 11, 2019
1 parent c7432f8 commit 9a600ca7f8af6969608da026748a78850a14dc10
@@ -111,10 +111,12 @@
* @param name A fully qualified class name
* @return A wrapped class object, to be used for further reflection.
* @throws ReflectException If any reflection exception occurred.
* @see #on(Class)
* @see #onClass(Class)
* @deprecated [#78] 0.9.11, use {@link #onClass(String)} instead.
*/
@Deprecated
public static Reflect on(String name) throws ReflectException {
return on(forName(name));
return onClass(name);
}

/**
@@ -128,10 +130,12 @@ public static Reflect on(String name) throws ReflectException {
* loaded.
* @return A wrapped class object, to be used for further reflection.
* @throws ReflectException If any reflection exception occurred.
* @see #on(Class)
* @see #onClass(Class)
* @deprecated [#78] 0.9.11, use {@link #onClass(String, ClassLoader)} instead.
*/
@Deprecated
public static Reflect on(String name, ClassLoader classLoader) throws ReflectException {
return on(forName(name, classLoader));
return onClass(name, classLoader);
}

/**
@@ -143,8 +147,55 @@ public static Reflect on(String name, ClassLoader classLoader) throws ReflectExc
*
* @param clazz The class to be wrapped
* @return A wrapped class object, to be used for further reflection.
* @deprecated [#78] 0.9.11, use {@link #onClass(Class)} instead.
*/
@Deprecated
public static Reflect on(Class<?> clazz) {
return onClass(clazz);
}

/**
* Wrap a class name.
* <p>
* This is the same as calling <code>onClass(Class.forName(name))</code>
*
* @param name A fully qualified class name
* @return A wrapped class object, to be used for further reflection.
* @throws ReflectException If any reflection exception occurred.
* @see #onClass(Class)
*/
public static Reflect onClass(String name) throws ReflectException {
return onClass(forName(name));
}

/**
* Wrap a class name, loading it via a given class loader.
* <p>
* This is the same as calling
* <code>onClass(Class.forName(name, classLoader))</code>
*
* @param name A fully qualified class name.
* @param classLoader The class loader in whose context the class should be
* loaded.
* @return A wrapped class object, to be used for further reflection.
* @throws ReflectException If any reflection exception occurred.
* @see #onClass(Class)
*/
public static Reflect onClass(String name, ClassLoader classLoader) throws ReflectException {
return onClass(forName(name, classLoader));
}

/**
* Wrap a class.
* <p>
* Use this when you want to access static fields and methods on a
* {@link Class} object, or as a basis for constructing objects of that
* class using {@link #create(Object...)}
*
* @param clazz The class to be wrapped
* @return A wrapped class object, to be used for further reflection.
*/
public static Reflect onClass(Class<?> clazz) {
return new Reflect(clazz);
}

Oops, something went wrong.

0 comments on commit 9a600ca

Please sign in to comment.