Example usage for com.google.gwt.dev.asm Type getInternalName

List of usage examples for com.google.gwt.dev.asm Type getInternalName

Introduction

In this page you can find the example usage for com.google.gwt.dev.asm Type getInternalName.

Prototype

public String getInternalName() 

Source Link

Document

Returns the internal name of the class corresponding to this object or array type.

Usage

From source file:com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.java

License:Apache License

/**
 * Convert the type used in a client-side EntityProxy or RequestContext
 * declaration to the equivalent domain type. Value types and supported
 * collections are a pass-through. EntityProxy types will be resolved to their
 * domain object type. RequestContext types will be resolved to their service
 * object./*from   w  w  w .  j  a  v a  2 s  .  c  o m*/
 */
private Type getDomainType(ErrorContext logger, Type clientType, boolean requireMapping) {
    Type domainType = clientToDomainType.get(clientType);
    if (domainType != null) {
        return domainType;
    }
    if (isValueType(logger, clientType) || isCollectionType(logger, clientType)) {
        domainType = clientType;
    } else if (entityProxyIntf.equals(clientType) || valueProxyIntf.equals(clientType)) {
        domainType = objectType;
    } else {
        logger = logger.setType(clientType);
        DomainMapper pv = new DomainMapper(logger);
        visit(logger, clientType.getInternalName(), pv);
        if (pv.getDomainInternalName() == null) {
            if (requireMapping) {
                logger.poison("%s has no mapping to a domain type (e.g. @%s or @%s)", print(clientType),
                        ProxyFor.class.getSimpleName(), Service.class.getSimpleName());
            }
            domainType = errorType;
        } else {
            domainType = Type.getObjectType(pv.getDomainInternalName());
        }
        if (pv.getLocatorInternalName() != null) {
            Type locatorType = Type.getObjectType(pv.getLocatorInternalName());
            clientToLocatorMap.put(clientType, locatorType);
        }
    }
    addToDomainMap(logger, domainType, clientType);
    if (domainType != errorType) {
        maybeCheckProxyType(logger, clientType);
    }
    return domainType;
}

From source file:com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.java

License:Apache License

/**
 * Collect all of the methods defined within a type hierarchy.
 *///from  w ww  .  ja v  a2  s .c  om
private Set<RFMethod> getMethodsInHierarchy(ErrorContext logger, Type domainType) {
    Set<RFMethod> toReturn = methodsInHierarchy.get(domainType);
    if (toReturn == null) {
        logger = logger.setType(domainType);
        toReturn = new MethodsInHierarchyCollector(logger).exec(domainType.getInternalName());
        methodsInHierarchy.put(domainType, Collections.unmodifiableSet(toReturn));
    }
    return toReturn;
}

From source file:com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.java

License:Apache License

private boolean isCollectionType(@SuppressWarnings("unused") ErrorContext logger, Type type) {
    // keeping the logger arg just for internal consistency for our small minds
    return "java/util/List".equals(type.getInternalName()) || "java/util/Set".equals(type.getInternalName());
}

From source file:com.google.web.bindery.requestfactory.server.RequestFactoryJarExtractor.java

License:Apache License

/**
 * Given a Type, return a path-prefix based on the type's package.
 */// w  w  w  . j a  v  a 2  s  . c  o  m
private static String getPackagePath(Type t) {
    String name = t.getInternalName();
    return name.substring(0, name.lastIndexOf('/') + 1);
}

From source file:com.google.web.bindery.requestfactory.server.RequestFactoryJarExtractor.java

License:Apache License

/**
 * Process a type, possibly returning a rebased type.
 * //from   www  .  j  a  va  2  s .c o m
 * @param sourceType TODO
 */
private Type processType(String sourceType, Type type) {
    Type toReturn;
    synchronized (seen) {
        toReturn = seen.get(type);
        if (toReturn != null) {
            return toReturn;
        }
        toReturn = Type.getType(type.getDescriptor());
        seen.put(type, toReturn);
    }
    int sort = type.getSort();
    if (sort != Type.OBJECT && sort != Type.ARRAY) {
        return toReturn;
    }
    if (sort == Type.ARRAY) {
        processType(sourceType, type.getElementType());
        return toReturn;
    }
    assert type.getInternalName().charAt(0) != 'L';
    if (type.getInternalName().startsWith("java/") || type.getInternalName().startsWith("javax/")) {
        return toReturn;
    }
    if (VERBOSE) {
        System.out.println(sourceType + " -> " + type.getClassName());
    }
    Future<State> future = ex.submit(new ProcessOneType(type));
    inProcess.add(future);
    return toReturn;
}