Tabnine Logo
Binder.invoke
Code IndexAdd Tabnine to your IDE (free)

How to use
invoke
method
in
com.headius.invokebinder.Binder

Best Java code snippets using com.headius.invokebinder.Binder.invoke (Showing top 20 results out of 315)

origin: com.headius/invokebinder

/**
 * Terminate this binder by invoking the given target handle.
 *
 * @param target the handle to invoke
 * @return a new SmartHandle with this binder's starting signature, bound
 * through to the given handle
 */
public SmartHandle invoke(MethodHandle target) {
  return new SmartHandle(start, binder.invoke(target));
}
origin: com.headius/invokebinder

/**
 * Produce a MethodHandle that invokes its leading MethodHandle argument
 * with the remaining arguments, returning the result.
 *
 * @return a new handle that invokes its leading MethodHandle argument
 */
public MethodHandle invoker() {
  return invoke(MethodHandles.invoker(start));
}
origin: org.dynjs/dynjs

public static MethodHandle nullReplacingFilter(Class<?> target) throws NoSuchMethodException, IllegalAccessException {
  Lookup lookup = MethodHandles.lookup();
  MethodHandle returnNull = lookup.findStatic(DynJSCoercionMatrix.class, "returnNull", methodType(Object.class, Object.class));
  return Binder.from(methodType(target, Object.class))
      //.drop(0)
      //.insert(0, new Class[]{Object.class}, new Object[]{null})
      .invoke(returnNull);
}
origin: org.jruby/jruby-complete

protected final MethodHandle newIdTest() {
  return Binder.from(boolean.class, ThreadContext.class, IRubyObject.class)
      .insert(2, id)
      .invoke(testModuleMatch);
}
origin: com.headius/invokebinder

/**
 * Terminate this binder by invoking the given target handle. The signature
 * of this binder is not compared to the signature of the given
 * SmartHandle.
 *
 * @param target the handle to invoke
 * @return a new SmartHandle with this binder's starting signature, bound
 * through to the given handle
 */
public SmartHandle invoke(SmartHandle target) {
  return new SmartHandle(start, binder.invoke(target.handle()));
}
origin: org.jruby/jruby-complete

public MethodHandle getNormalYieldSpecificHandle() {
  MethodHandle normalYieldSpecificHandle = this.normalYieldSpecificHandle;
  if (normalYieldSpecificHandle != null) return normalYieldSpecificHandle;
  return this.normalYieldSpecificHandle = Binder.from(IRubyObject.class, ThreadContext.class, Block.class)
      .append(new Class[] {StaticScope.class, IRubyObject.class, IRubyObject[].class, Block.class},
          getStaticScope(), null, null, Block.NULL_BLOCK)
      .invoke(handle);
}
origin: org.jruby/jruby-complete

public MethodHandle getTestBlockBody() {
  final MethodHandle testBlockBody = this.testBlockBody;
  if (testBlockBody != null) return testBlockBody;
  return this.testBlockBody = Binder.from(boolean.class, ThreadContext.class, Block.class).drop(0).append(this).invoke(TEST_BLOCK_BODY);
}
origin: org.jruby/jruby-core

public MethodHandle getNormalYieldSpecificHandle() {
  MethodHandle normalYieldSpecificHandle = this.normalYieldSpecificHandle;
  if (normalYieldSpecificHandle != null) return normalYieldSpecificHandle;
  return this.normalYieldSpecificHandle = Binder.from(IRubyObject.class, ThreadContext.class, Block.class)
      .append(new Class[] {StaticScope.class, IRubyObject.class, IRubyObject[].class, Block.class},
          getStaticScope(), null, null, Block.NULL_BLOCK)
      .invoke(handle);
}
origin: com.headius/invokebinder

/**
 * Apply the tranforms, binding them to a constant value that will
 * propagate back through the chain. The chain's expected return type
 * at that point must be compatible with the given value's type.
 *
 * @param value the constant value to put at the end of the chain
 * @return a handle that has all transforms applied in sequence up to the constant
 */
public MethodHandle constant(Object value) {
  return invoke(MethodHandles.constant(type().returnType(), value));
}
origin: com.headius/invokebinder

/**
 * Apply the chain of transforms and bind them to an array element get. The signature
 * at the endpoint must return the array element type and receive the array type and
 * int index.
 *
 * @return the full handle chain, bound to an array element get.
 */
public MethodHandle arrayGet() {
  return invoke(MethodHandles.arrayElementGetter(type().parameterType(0)));
}
origin: org.jruby/jruby-core

public MethodHandle getTestBlockBody() {
  final MethodHandle testBlockBody = this.testBlockBody;
  if (testBlockBody != null) return testBlockBody;
  return this.testBlockBody = Binder.from(boolean.class, ThreadContext.class, Block.class).drop(0).append(this).invoke(TEST_BLOCK_BODY);
}
origin: com.headius/invokebinder

/**
 * Apply the tranforms, binding them to a handle that will simply return its sole
 * argument as its return value. The endpoint signature must have a single argument
 * of the same type as its return type.
 *
 * @return a handle that has all transforms applied in sequence
 */
public MethodHandle identity() {
  return invoke(MethodHandles.identity(type().parameterType(0)));
}
origin: org.projectodd.rephract/rephract

@Override
public MethodHandle guardMethodHandle(MethodType inputType) throws NoSuchMethodException, IllegalAccessException {
  Binder binder = Binder.from(inputType);
  MethodHandle target = super.guardMethodHandle(methodType(boolean.class, this.argType));
  return binder.permute(this.argPos)
      .convert(target.type())
      .invoke(target);
}
origin: org.jruby/jruby-complete

public MethodHandle getNormalYieldHandle() {
  MethodHandle normalYieldHandle = this.normalYieldHandle;
  if (normalYieldHandle != null) return normalYieldHandle;
  return this.normalYieldHandle = Binder.from(IRubyObject.class, ThreadContext.class, Block.class, IRubyObject.class)
      .filter(2, WRAP_VALUE)
      .insert(2, new Class[]{StaticScope.class, IRubyObject.class}, getStaticScope(), null)
      .append(Block.class, Block.NULL_BLOCK)
      .invoke(handle);
}
origin: org.jruby/jruby-core

public MethodHandle getNormalYieldHandle() {
  MethodHandle normalYieldHandle = this.normalYieldHandle;
  if (normalYieldHandle != null) return normalYieldHandle;
  return this.normalYieldHandle = Binder.from(IRubyObject.class, ThreadContext.class, Block.class, IRubyObject.class)
      .filter(2, WRAP_VALUE)
      .insert(2, new Class[]{StaticScope.class, IRubyObject.class}, getStaticScope(), null)
      .append(Block.class, Block.NULL_BLOCK)
      .invoke(handle);
}
origin: com.headius/invokebinder

public MethodHandle up(MethodHandle target) {
  if (onlyTail()) {
    // fast path for tail args
    return target.asCollector(arrayType, count);
  } else {
    Permutes permutes = buildPermutes(source, target.type());
    Binder binder = preparePermuteBinder(permutes);
    return binder.invoke(target);
  }
}
origin: org.jruby/jruby-complete

  public MethodHandle getNormalYieldUnwrapHandle() {
    MethodHandle normalYieldUnwrapHandle = this.normalYieldUnwrapHandle;
    if (normalYieldUnwrapHandle != null) return normalYieldUnwrapHandle;

    return this.normalYieldUnwrapHandle = Binder.from(IRubyObject.class, ThreadContext.class, Block.class, IRubyObject.class)
        .filter(2, VALUE_TO_ARRAY)
        .insert(2, new Class[] {StaticScope.class, IRubyObject.class}, getStaticScope(), null)
        .append(Block.class, Block.NULL_BLOCK)
        .invoke(handle);
  }
//
origin: org.jruby/jruby-core

  public MethodHandle getNormalYieldUnwrapHandle() {
    MethodHandle normalYieldUnwrapHandle = this.normalYieldUnwrapHandle;
    if (normalYieldUnwrapHandle != null) return normalYieldUnwrapHandle;

    return this.normalYieldUnwrapHandle = Binder.from(IRubyObject.class, ThreadContext.class, Block.class, IRubyObject.class)
        .filter(2, VALUE_TO_ARRAY)
        .insert(2, new Class[] {StaticScope.class, IRubyObject.class}, getStaticScope(), null)
        .append(Block.class, Block.NULL_BLOCK)
        .invoke(handle);
  }
//
origin: com.headius/invokebinder

/**
 * Throw the current signature's sole Throwable argument. Return type
 * does not matter, since it will never return.
 *
 * @return a handle that has all transforms applied and which will eventually throw an exception
 */
public MethodHandle throwException() {
  if (type().parameterCount() != 1 || !Throwable.class.isAssignableFrom(type().parameterType(0))) {
    throw new InvalidTransformException("incoming signature must have one Throwable type as its sole argument: " + type());
  }
  return invoke(MethodHandles.throwException(type().returnType(), type().parameterType(0).asSubclass(Throwable.class)));
}
origin: org.projectodd.rephract/rephract

@Override
public LinkBuilder guardWith(Guard guard) throws Exception {
  MethodHandle methodHandle = binder().guardBinder().invoke(guard.guardMethodHandle(binder().guardBinder().type()));
  methodHandle = MethodHandles.guardWithTest(this.guard, methodHandle, Guards.FALSE.guardMethodHandle(binder().guardInputType()));
  return new ChildLinkBuilder(new MultiBinder(binder()), methodHandle);
}
com.headius.invokebinderBinderinvoke

Javadoc

Apply the chain of transforms with the target method handle as the final endpoint. Produces a handle that has the transforms in given sequence. If the final handle's type does not exactly match the initial type for this Binder, an additional cast will be attempted.

Popular methods of Binder

  • from
    Construct a new Binder, starting from a given MethodType.
  • insert
    Insert at the given index the given argument value(s).
  • collect
    Box all incoming arguments from the given position onward into the given array type.
  • constant
    Apply the tranforms, binding them to a constant value that will propagate back through the chain. Th
  • drop
    Drop from the given index a number of arguments.
  • filter
    Filter incoming arguments, from the given index, replacing each with the result of calling the assoc
  • fold
    Process the incoming arguments using the given handle, inserting the result as the first argument.
  • invokeVirtual
    Apply the chain of transforms and bind them to a virtual method specified using the end signature pl
  • permute
    Permute the incoming arguments to a new sequence specified by the given values. Arguments may be dup
  • cast
    Cast the incoming arguments to the given MethodType. The casts applied are equivalent to those in Me
  • filterReturn
    Filter return value, using a function that produces the current return type from another type. The n
  • invokeStaticQuiet
    Apply the chain of transforms and bind them to a static method specified using the end signature plu
  • filterReturn,
  • invokeStaticQuiet,
  • invokeVirtualQuiet,
  • tryFinally,
  • nop,
  • type,
  • append,
  • foldVoid,
  • identity

Popular in Java

  • Making http requests using okhttp
  • putExtra (Intent)
  • notifyDataSetChanged (ArrayAdapter)
  • setScale (BigDecimal)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now