提交 2bdf9011 编写于 作者: F Fabian Hueske

Merge pull request #167 from mleich/usercodewrapper

Added getUserCodeClass to UserCodeWrapper
...@@ -61,4 +61,9 @@ public class UserCodeClassWrapper<T> implements UserCodeWrapper<T> { ...@@ -61,4 +61,9 @@ public class UserCodeClassWrapper<T> implements UserCodeWrapper<T> {
Class<A> annotationClass) { Class<A> annotationClass) {
return userCodeClass.getAnnotation(annotationClass); return userCodeClass.getAnnotation(annotationClass);
} }
@Override
public Class<? extends T> getUserCodeClass() {
return userCodeClass;
}
} }
...@@ -57,4 +57,10 @@ public class UserCodeObjectWrapper<T> implements UserCodeWrapper<T> { ...@@ -57,4 +57,10 @@ public class UserCodeObjectWrapper<T> implements UserCodeWrapper<T> {
Class<A> annotationClass) { Class<A> annotationClass) {
return userCodeObject.getClass().getAnnotation(annotationClass); return userCodeObject.getClass().getAnnotation(annotationClass);
} }
@SuppressWarnings("unchecked")
@Override
public Class<? extends T> getUserCodeClass() {
return (Class<? extends T>) userCodeObject.getClass();
}
} }
...@@ -55,4 +55,12 @@ public interface UserCodeWrapper<T> extends Serializable { ...@@ -55,4 +55,12 @@ public interface UserCodeWrapper<T> extends Serializable {
* @return the annotation, or null if no annotation of the requested type was found * @return the annotation, or null if no annotation of the requested type was found
*/ */
public <A extends Annotation> A getUserCodeAnnotation(Class<A> annotationClass); public <A extends Annotation> A getUserCodeAnnotation(Class<A> annotationClass);
/**
* Gets the class of the user code. If the user code is provided as a class, this class is just returned.
* If the user code is provided as an object, {@link Object#getClass()} is called on the user code object.
*
* @return The class of the user code object.
*/
public Class<? extends T> getUserCodeClass ();
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册