本文整理匯總了Java中com.google.gwt.core.ext.GeneratorContext.isGeneratorResultCachingEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java GeneratorContext.isGeneratorResultCachingEnabled方法的具體用法?Java GeneratorContext.isGeneratorResultCachingEnabled怎麽用?Java GeneratorContext.isGeneratorResultCachingEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.core.ext.GeneratorContext
的用法示例。
在下文中一共展示了GeneratorContext.isGeneratorResultCachingEnabled方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkAlreadyGenerated
import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
private boolean checkAlreadyGenerated(TreeLogger logger,
GeneratorContext ctx,
String generatedClassQualifiedName) {
CachedGeneratorResult lastRebindResult = ctx.getCachedGeneratorResult();
if (lastRebindResult == null || !ctx.isGeneratorResultCachingEnabled()) {
return false;
}
/* it looks like we could use the existing one */
return true;
}
示例2: checkAlreadyGenerated
import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
private boolean checkAlreadyGenerated(TreeLogger logger,
GeneratorContext ctx,
Mvp4gConfiguration configuration) {
CachedGeneratorResult lastRebindResult = ctx.getCachedGeneratorResult();
if (lastRebindResult == null || !ctx.isGeneratorResultCachingEnabled()) {
return false;
}
// Check whether all files are up to date
// EventBus
if (!this.checkEventBus(logger,
ctx)) {
return false;
}
// Module
if (!this.checkModule(logger,
ctx,
configuration.getModule())) {
return false;
}
// ChildModuleElement
if (!this.checkSet(logger,
ctx,
configuration.getChildModules())) {
return false;
}
// everything ok! -> use the old one ...
return true;
}
示例3: generateIncrementally
import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
@Override
public RebindResult generateIncrementally(TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException {
TypeOracle typeOracle = context.getTypeOracle();
serializerType = typeOracle.findType(typeName);
if (serializerType == null || serializerType.isInterface() == null)
throw new UnableToCompleteException();
String typeSerializerClassName = serializerType.getQualifiedSourceName() + TYPE_SERIALIZER_SUFFIX;
String typeSerializerSimpleName = serializerType.getSimpleSourceName() + TYPE_SERIALIZER_SUFFIX;
final StorageTypeFinder storageTypeFinder = StorageTypeFinder.getInstance(context, logger);
SerializableTypeOracle serializationOracle = buildSerializableTypeOracle(logger, context, storageTypeFinder);
JClassType typeSerializer = typeOracle.findType(typeSerializerClassName);
if (typeSerializer != null && typeSerializer.isClass() != null
&& isNothingChanged(logger, context, serializationOracle)) {
return new RebindResult(RebindMode.USE_EXISTING, typeSerializerClassName);
}
TypeSerializerCreator tsc =
new TypeSerializerCreator(logger, serializationOracle, serializationOracle, context,
typeSerializerClassName, typeSerializerSimpleName);
tsc.realize(logger);
writeSerializationPolicyFile(logger, context, serializationOracle, Collections.unmodifiableMap(tsc.getTypeStrings()));
if (context.isGeneratorResultCachingEnabled()) {
RebindResult result = new RebindResult(RebindMode.USE_PARTIAL_CACHED, typeSerializerClassName);
Set<JType> storageTypes = storageTypeFinder.findStorageTypes();
CachedRpcTypeInformation cti = new CachedRpcTypeInformation(serializationOracle, serializationOracle, storageTypes, new HashSet<JType>());
result.putClientData(ProxyCreator.CACHED_TYPE_INFO_KEY, cti);
return result;
} else {
return new RebindResult(RebindMode.USE_ALL_NEW_WITH_NO_CACHING, typeSerializerClassName);
}
}
示例4: isNothingChanged
import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
private boolean isNothingChanged(TreeLogger logger, GeneratorContext context, SerializableTypeOracle serializationOracle) {// caching use
CachedGeneratorResult cachedResult = context.getCachedGeneratorResult();
if (cachedResult == null || !context.isGeneratorResultCachingEnabled()){
return false;
}
Object obj = context.getCachedGeneratorResult().getClientData(ProxyCreator.CACHED_TYPE_INFO_KEY);
return obj != null && ((CachedRpcTypeInformation) obj).checkTypeInformation(logger, context.getTypeOracle(),
serializationOracle, serializationOracle);
}
示例5: execImpl
import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
public static RebindResult execImpl(final TreeLogger logger, final GeneratorContext ctx,
final String typeName) throws UnableToCompleteException {
final JClassType type = ctx.getTypeOracle().findType(typeName.replace('$', '.'));
if (type == null) {
logger.log(Type.ERROR, "Unable to find source for model interface type "+typeName);
throw new UnableToCompleteException();
}
// Step one; see if this model already exists...
final ModelMagic magic = ModelMagic.active.get();
final String mangledName = magic.mangleName(type.getQualifiedSourceName(), MINIFY);
final String fqcn = MODEL_PACKAGE+"."+mangledName;
if (ctx.isGeneratorResultCachingEnabled() && ctx.tryReuseTypeFromCache(typeName)) {
return new RebindResult(RebindMode.USE_PARTIAL_CACHED, fqcn);
}
if (!type.isAbstract()) {
// TODO Only generate a provider class if the type itself is not concrete
return new RebindResult(RebindMode.USE_EXISTING, typeName);
}
final PrintWriter pw = ctx.tryCreate(logger, MODEL_PACKAGE, mangledName);
if (pw == null) {
// TODO for injectors this type may exist but be stale.
// Use an @Generated annotation to do a freshness check.
return new RebindResult(RebindMode.USE_EXISTING, fqcn);
}
final ModelArtifact model = magic.getOrMakeModel(logger, ctx, type);
final boolean isFinal = type.getSubtypes().length == 0;
final SourceBuilder<ModelMagic> builder = new SourceBuilder<ModelMagic>(
"public "+(isFinal?"final ":"")+"class "+mangledName
);
builder.setPayload(magic);
builder.setPackage(MODEL_PACKAGE);
// Step two; transverse type model.
visitModelStructure(logger, ctx, typeName, type, magic, model, builder);
// Step three, generate serialization protocols for this model type.
generateSerializers(logger, ctx, typeName, type, magic, model, builder);
// Step four, determine the fields we'll need to generate
model.generateModelClass(logger, builder, ctx, type);
final String src = builder.toString();
final Type logLevel = logLevel();
if (logger.isLoggable(logLevel)) {
logger.log(logLevel, "Generated model class:\n"+src);
}
pw.println(src);
ctx.commit(logger, pw);
if (!model.isReused()) {
ctx.commitArtifact(logger, model);
}
return new RebindResult(RebindMode.USE_ALL_NEW, MODEL_PACKAGE + "." + mangledName);
}