org.selophane.elements.factory.internal.ImplementedByProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of webtest Show documentation
Show all versions of webtest Show documentation
Some additional helper for webtesting with selenium
package org.selophane.elements.factory.internal;
import org.selophane.elements.base.Element;
import org.selophane.elements.base.ImplementedBy;
/**
* Processes the iface type into a useful class reference for wrapping
* WebElements.
*/
public final class ImplementedByProcessor {
private ImplementedByProcessor() {
}
/**
* Gets the wrapper class (descended from ElementImpl) for the annotation
* ImplementedBy.
*
* @param iface iface to process for annotations
* @param type of the wrapped class.
* @return The class name of the class in question
*/
public static Class> getWrapperClass(Class iface) {
if (iface.isAnnotationPresent(ImplementedBy.class)) {
ImplementedBy annotation = iface.getAnnotation(ImplementedBy.class);
Class> clazz = annotation.value();
if (Element.class.isAssignableFrom(clazz)) {
return annotation.value();
}
}
throw new UnsupportedOperationException(
"Apply @ImplementedBy interface to your Interface "
+ iface.getCanonicalName() + " if you want to extend ");
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy