Java Code Examples for groovy.lang.Closure#rehydrate()

The following examples show how to use groovy.lang.Closure#rehydrate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransformedModelDslBacking.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void configure(String modelPathString, Closure<?> configuration) {
    List<ModelReference<?>> references = inputPathsExtractor.transform(configuration);
    SourceLocation sourceLocation = ruleLocationExtractor.transform(configuration);
    ModelPath modelPath = ModelPath.path(modelPathString);
    Closure<?> reownered = configuration.rehydrate(null, owner, thisObject);
    modelRegistry.mutate(new ClosureBackedModelMutator(reownered, references, modelPath, sourceLocation));
}
 
Example 2
Source File: TransformedModelDslBacking.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void configure(String modelPathString, Closure<?> configuration) {
    List<ModelReference<?>> references = inputPathsExtractor.transform(configuration);
    SourceLocation sourceLocation = ruleLocationExtractor.transform(configuration);
    ModelPath modelPath = ModelPath.path(modelPathString);
    Closure<?> reownered = configuration.rehydrate(null, owner, thisObject);
    modelRegistry.mutate(new ClosureBackedModelMutator(reownered, references, modelPath, sourceLocation));
}
 
Example 3
Source File: AbstractTypeCheckingExtension.java    From groovy with Apache License 2.0 4 votes vote down vote up
public TypeCheckingScope newScope(Closure code) {
    TypeCheckingScope scope = newScope();
    Closure callback = code.rehydrate(scope, this, this);
    callback.call();
    return scope;
}
 
Example 4
Source File: AbstractTypeCheckingExtension.java    From groovy with Apache License 2.0 4 votes vote down vote up
public TypeCheckingScope scopeExit(Closure code) {
    TypeCheckingScope scope = scopeData.peek();
    Closure copy = code.rehydrate(scope, this, this);
    copy.call();
    return scopeExit();
}