Example usage for com.google.gwt.core.ext.typeinfo JGenericType getRawType

List of usage examples for com.google.gwt.core.ext.typeinfo JGenericType getRawType

Introduction

In this page you can find the example usage for com.google.gwt.core.ext.typeinfo JGenericType getRawType.

Prototype

JRawType getRawType();

Source Link

Usage

From source file:fr.onevu.gwt.uibinder.rebind.model.OwnerClass.java

License:Apache License

/**
 * Returns the method annotated with @UiFactory which returns the given type.
 * /*ww w.j  a v a 2  s.  c  om*/
 * @param forType
 *          the type to look for a factory of
 * @return the factory method, or null if none exists
 */
public JMethod getUiFactoryMethod(JClassType forType) {
    JGenericType genericType = forType.isGenericType();
    if (genericType != null) {
        forType = genericType.getRawType();
    }

    return uiFactories.get(forType);
}

From source file:org.cruxframework.crux.core.rebind.screen.widget.EvtProcessor.java

License:Apache License

/**
 * @param methodName/*from   ww w  .  ja  va  2  s  .  c  om*/
 * @param eventClassType
 * @param controllerClass
 * @return
 */
static JMethod getControllerMethodWithEvent(String methodName, JClassType eventClassType,
        JClassType controllerClass) {
    if (eventClassType == null) {
        return null;
    }
    JGenericType genericType = eventClassType.isGenericType();
    if (genericType == null) {
        return JClassUtils.getMethod(controllerClass, methodName, new JType[] { eventClassType });
    } else {
        eventClassType = genericType.getRawType();
        JClassType superClass = controllerClass;
        while (superClass.getSuperclass() != null) {
            JMethod[] methods = superClass.getMethods();
            if (methods != null) {
                for (JMethod method : methods) {
                    JParameter[] parameters = method.getParameters();
                    if (method.getName().equals(methodName) && parameters != null && parameters.length == 1
                            && parameters[0].getType().isClass() != null
                            && parameters[0].getType().isClass().isAssignableTo(eventClassType)) {
                        return method;
                    }
                }
            }
            superClass = superClass.getSuperclass();
        }
        return null;
    }
}