Example usage for com.google.gwt.core.ext CachedGeneratorResult isTypeCached

List of usage examples for com.google.gwt.core.ext CachedGeneratorResult isTypeCached

Introduction

In this page you can find the example usage for com.google.gwt.core.ext CachedGeneratorResult isTypeCached.

Prototype

boolean isTypeCached(String typeName);

Source Link

Document

Check whether a given type is present in the cached result.

Usage

From source file:org.cruxframework.crux.core.rebind.AbstractProxyCreator.java

License:Apache License

protected boolean findCacheableImplementationAndMarkForReuseIfAvailable(JClassType baseIntf) {
    CachedGeneratorResult lastResult = context.getCachedGeneratorResult();
    if (lastResult == null || !context.isGeneratorResultCachingEnabled()) {
        return false;
    }/*w w  w. j av a  2s.  co m*/

    String proxyName = getProxyQualifiedName();

    // check that it is available for reuse
    if (!lastResult.isTypeCached(proxyName)) {
        return false;
    }

    try {
        long lastModified = 0L;
        if (baseIntf instanceof JRealClassType) {
            lastModified = ((JRealClassType) baseIntf).getLastModifiedTime();
        }

        if (lastModified != 0L && lastModified < lastResult.getTimeGenerated()) {
            return context.tryReuseTypeFromCache(proxyName);
        }
    } catch (RuntimeException ex) {
        // could get an exception checking modified time
        return false;
    }

    return false;
}