Creates a {@link Closure} from a {@link ClosureTarget}.
181777
public Closure createClosure(final Object owner, final ClosureTarget target) {
    checkNotNull(owner);
    checkNotNull(target);

    return new Closure(owner)
    {
      @Override
      public Object call(final Object[] args) {
        try {
          return target.call(args);
        }
        catch (Exception e) {
          throw Throwables.propagate(e);
        }
      }

      @Override
      public String toString() {
        return Closure.class.getSimpleName() + "{owner=" + owner + ", target=" + target + "}";
      }
    };
  }
707759
public Object createTargetObject(TargetServiceFactory targetServiceFactory) {
		Debug.logVerbose("[JdonFramework] now getTargetObject by visitor ", module);
		Object targetObjRef = null;
		try {
			TargetMetaRequest targetMetaRequest = targetMetaRequestsHolder.getTargetMetaRequest();
			TargetMetaDef targetMetaDef = targetMetaRequest.getTargetMetaDef();
			if (targetMetaDef.isEJB()) { // cache the ejb object
				ComponentVisitor cm = targetMetaRequest.getComponentVisitor();
				targetMetaRequest.setVisitableName(ComponentKeys.TARGETSERVICE_FACTORY);
				Debug.logVerbose(ComponentKeys.TARGETSERVICE_FACTORY + " in action (cache)", module);
				targetObjRef = cm.visit();
			} else {
				Debug.logVerbose("[JdonFramework] not active targer service instance cache !!!!", module);
				targetObjRef = targetServiceFactory.create();
			}
		} catch (Exception e) {
			Debug.logError("[JdonFramework]createTargetObject error: " + e, module);
		}
		return targetObjRef;
	}
46216
public static <T extends Closure<?>> T instantiateClosure(Class<T> closureType, Object owner, Object thisObject) {
    try {
      Constructor<T> constructor = closureType.getConstructor(Object.class, Object.class);
      return constructor.newInstance(owner, thisObject);
    } catch (Exception e) {
      ExceptionUtil.sneakyThrow(e.getCause());
      return null; // never reached
    }
  }
357170
public void initialization(Closure<?> closure) {
        if (initialization != null) {
            throw new GradleException("Initialization is already set");
        }
        initialization = (Initialization) project.configure(new Initialization(), closure);
    }
537211
public static AsyncCallback<String> wrapCallback(final JavaScriptObject func) {

        return new AsyncCallback<String>() {

            public void onFailure(Throwable caught) {

                // TODO Auto-generated method stub

            }

            public void onSuccess(String result) {

                callWithString(func, result);
            }

        };
    }
840191
CloseableIterator<T> createIterator(int resultFlags) {
		try {
			SelectIterator<T, ID> iterator =
					statementExecutor.buildIterator(this, connectionSource, resultFlags, objectCache);
			return iterator;
		} catch (Exception e) {
			throw new IllegalStateException("Could not build iterator for " + dataClass, e);
		}
	}
100030
@NotNull
    public IntStream onClose(@NotNull final Runnable closeHandler) {
        Objects.requireNonNull(closeHandler);
        final Params newParams = Params.wrapWithCloseHandler(params, closeHandler);
        return new IntStream(newParams, iterator);
    }
872119
public static Closure getMethodPointer(Object object, String methodName) {
        if (object == null) {
            throw new NullPointerException("Cannot access method pointer for '" + methodName + "' on null object");
        }
        return new MethodClosure(object, methodName);
    }
1197843
public static <T> T[] reverseEach(T[] self, @ClosureParams(FirstParam.Component.class) Closure closure) {
        each(new ReverseListIterator<T>(Arrays.asList(self)), closure);
        return self;
    }
955386
@NotNull
    public Stream<T> onClose(@NotNull final Runnable closeHandler) {
        Objects.requireNonNull(closeHandler);
        final Params newParams = Params.wrapWithCloseHandler(params, closeHandler);
        return new Stream<T>(newParams, iterator);
    }
407478
function isolateScope(code, closure) {
  if (typeof code === 'string') {
    code = code.split('\n');
  }
  var keys = Object.keys(closure).map(function (key) {
    return stringify(key) + ": " + key;
  });
  var chunks = [];

  chunks.push(
    "function (" + Object.keys(closure).join(', ') + ") {",
    "  'use strict';",
    "  return (function (userFunc, getClosure, action) {",
    "    try {",
    "      return action(userFunc, getClosure);",
    "    } catch (err) {",
    // this should never happen ...
    "      return { error: err.message, closure: getClosure() };",
    "    }",
    "  })("
  );

  // the code provided by the user goes here
  align(code).forEach(function (line) {
    chunks.push("    " + line);
  });
  chunks[chunks.length-1] += ',';

  chunks.push(
    // the function returning current state of the closure
    "    function () {",
    "      return { " + keys.join(', ') + " };",
    "    },",

    // the custom action
    "    arguments[arguments.length-1]",
    "  );",
    "}"
  );

  return chunks;
}
510686
public static <R> Retryer<R> of(Callable<R> target) {
        return new Retryer<R>(target);
    }
1151635
public static MultipartContent multipart(@DelegatesTo(MultipartContent.class) Closure closure) {
        MultipartContent content = new MultipartContent();
        closure.setDelegate(content);
        closure.call();
        return content;
    }
282840
@Deprecated
    public static <T> T withCloseable(Closeable self, @ClosureParams(value = SimpleType.class, options = "java.io.Closeable") Closure<T> action) throws IOException {
        return IOGroovyMethods.withCloseable(self, action);
    }
1276816
public static <T> Iterable<T> eachWithIndex(Iterable<T> self, @ClosureParams(value=FromString.class, options="T,Integer") Closure closure) {
        eachWithIndex(self.iterator(), closure);
        return self;
    }
1313099
public function addClosure(string $key, Closure $closure): ClosureResolver
    {
        $this->closures[$key] = $closure;

        return $this;
    }
220375
public Collector<Type, ClosureHolder, List<Type>> closureCollector(boolean minClosure, BiPredicate<Type, Type> shouldSkip) {
        return Collector.of(() -> new ClosureHolder(minClosure, shouldSkip),
                ClosureHolder::add,
                ClosureHolder::merge,
                ClosureHolder::closure);
    }