Example usage for com.google.gwt.dev.util Pair create

List of usage examples for com.google.gwt.dev.util Pair create

Introduction

In this page you can find the example usage for com.google.gwt.dev.util Pair create.

Prototype

public static <L, R> Pair<L, R> create(L l, R r) 

Source Link

Usage

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

License:Apache License

/**
 * Scans the class to find all methods annotated with @UiChild.
 * /*from w w  w .j av  a2  s  .c  o  m*/
 * @param ownerType
 *          the type of the owner class
 * @throws UnableToCompleteException
 */
private void findUiChildren(JClassType ownerType) throws UnableToCompleteException {
    while (ownerType != null) {
        JMethod[] methods = ownerType.getMethods();
        for (JMethod method : methods) {
            UiChild annotation = method.getAnnotation(UiChild.class);
            if (annotation != null) {
                String tag = annotation.tagname();
                int limit = annotation.limit();
                if (tag.equals("")) {
                    String name = method.getName();
                    if (name.startsWith("add")) {
                        tag = StringCase.toLower(name.substring(3));
                    } else {
                        logger.die(method.getName() + " must either specify a UiChild tagname or begin "
                                + "with \"add\".");
                    }
                }
                JParameter[] parameters = method.getParameters();
                if (parameters.length == 0) {
                    logger.die("%s must take at least one Object argument", method.getName());
                }
                JType type = parameters[0].getType();
                if (type.isClassOrInterface() == null) {
                    logger.die("%s first parameter must be an object type, found %s", method.getName(),
                            type.getQualifiedSourceName());
                }
                uiChildren.put(tag, Pair.create(method, limit));
            }
        }
        ownerType = ownerType.getSuperclass();
    }
}