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

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

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

origin: org.projectodd.rephract/rephract

  @Override
  public MethodHandle guardMethodHandle(MethodType inputType) throws Exception {
    Binder binder = Binder.from(inputType);
    return binder.drop(0, inputType.parameterCount())
        .constant(false);
  }
}
origin: org.projectodd.rephract/rephract

  @Override
  public MethodHandle guardMethodHandle(MethodType inputType) throws Exception {
    Binder binder = Binder.from(inputType);
    return binder.drop(0, inputType.parameterCount())
        .constant(true);
  }
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

public static Ruby loadRuntime(MutableCallSite site, ThreadContext context) throws Throwable {
  site.setTarget(Binder.from(Ruby.class, ThreadContext.class).drop(0).constant(context.runtime));
  
  return context.runtime;
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public static IRubyObject loadNil(MutableCallSite site, ThreadContext context) throws Throwable {
  site.setTarget(Binder.from(IRubyObject.class, ThreadContext.class).drop(0).constant(context.nil));
  
  return context.nil;
}

origin: com.ning.billing/killbill-osgi-bundles-jruby

public static IRubyObject loadNil(MutableCallSite site, ThreadContext context) throws Throwable {
  site.setTarget(Binder.from(IRubyObject.class, ThreadContext.class).drop(0).constant(context.nil));
  
  return context.nil;
}

origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public static Ruby loadRuntime(MutableCallSite site, ThreadContext context) throws Throwable {
  site.setTarget(Binder.from(Ruby.class, ThreadContext.class).drop(0).constant(context.runtime));
  
  return context.runtime;
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public static IRubyObject fixnum(MutableCallSite site, long value, ThreadContext context) {
  RubyFixnum fixnum = RubyFixnum.newFixnum(context.runtime, value);
  site.setTarget(Binder
      .from(IRubyObject.class, ThreadContext.class)
      .drop(0)
      .constant(fixnum)
  );
  return fixnum;
}
origin: org.jruby/jruby-complete

public static RubyString frozenString(MutableCallSite site, ByteList value, int cr, String file, int line, ThreadContext context) throws Throwable {
  RubyString frozen = IRRuntimeHelpers.newFrozenString(context, value, cr, file, line);
  MethodHandle handle = Binder.from(RubyString.class, ThreadContext.class)
      .dropAll()
      .constant(frozen);
  site.setTarget(handle);
  return frozen;
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

public static IRubyObject fixnum(MutableCallSite site, long value, ThreadContext context) {
  RubyFixnum fixnum = RubyFixnum.newFixnum(context.runtime, value);
  site.setTarget(Binder
      .from(IRubyObject.class, ThreadContext.class)
      .drop(0)
      .constant(fixnum)
  );
  return fixnum;
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

  public static IRubyObject flote(MutableCallSite site, double value, ThreadContext context) {
    RubyFloat flote = RubyFloat.newFloat(context.runtime, value);
    site.setTarget(Binder
        .from(IRubyObject.class, ThreadContext.class)
        .drop(0)
        .constant(flote)
    );
    return flote;
  }
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

public static IRubyObject symbol(MutableCallSite site, String name, ThreadContext context) {
  RubySymbol symbol = RubySymbol.newSymbol(context.runtime, name);
  site.setTarget(Binder
      .from(IRubyObject.class, ThreadContext.class)
      .drop(0)
      .constant(symbol)
  );
  return symbol;
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

  public static IRubyObject flote(MutableCallSite site, double value, ThreadContext context) {
    RubyFloat flote = RubyFloat.newFloat(context.runtime, value);
    site.setTarget(Binder
        .from(IRubyObject.class, ThreadContext.class)
        .drop(0)
        .constant(flote)
    );
    return flote;
  }
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public static IRubyObject symbol(MutableCallSite site, String name, ThreadContext context) {
  RubySymbol symbol = RubySymbol.newSymbol(context.runtime, name);
  site.setTarget(Binder
      .from(IRubyObject.class, ThreadContext.class)
      .drop(0)
      .constant(symbol)
  );
  return symbol;
}
origin: org.jruby/jruby-core

public static RubyString frozenString(MutableCallSite site, ByteList value, int cr, String file, int line, ThreadContext context) throws Throwable {
  RubyString frozen = IRRuntimeHelpers.newFrozenString(context, value, cr, file, line);
  MethodHandle handle = Binder.from(RubyString.class, ThreadContext.class)
      .dropAll()
      .constant(frozen);
  site.setTarget(handle);
  return frozen;
}
origin: org.jruby/jruby-complete

public IRubyObject cache(IRubyObject t) {
  MethodHandle constant = null;
  if (t instanceof Constantizable) {
    constant = (MethodHandle) ((Constantizable) t).constant();
  }
  if (constant == null) {
    constant = Binder.from(type())
        .dropAll()
        .constant(t);
  }
  setTarget(constant);
  return t;
}
origin: org.jruby/jruby-core

public IRubyObject cache(IRubyObject t) {
  MethodHandle constant = null;
  if (t instanceof Constantizable) {
    constant = (MethodHandle) ((Constantizable) t).constant();
  }
  if (constant == null) {
    constant = Binder.from(type())
        .dropAll()
        .constant(t);
  }
  setTarget(constant);
  return t;
}
origin: org.jruby/jruby-complete

  public RubyRegexp construct(ThreadContext context, RubyString[] pieces) throws Throwable {
    RubyString pattern = RubyRegexp.preprocessDRegexp(context.runtime, pieces, options);
    RubyRegexp re = RubyRegexp.newDRegexp(context.runtime, pattern, options);
    re.setLiteral();

    if (options.isOnce()) {
      if (cache != null) {
        // we cached a value, so re-call this site's target handle to get it
        return cache;
      }

      // we don't care if this succeeds, just that it only gets set once
      UPDATER.compareAndSet(this, null, cache);

      setTarget(Binder.from(type()).dropAll().constant(cache));
    }

    return re;
  }
}
origin: org.jruby/jruby-complete

private void bind(Ruby runtime, RubyModule module, IRubyObject constant, MethodHandle cachingFallback) {
  MethodHandle target = Binder.from(type())
      .drop(0, 2)
      .constant(constant);
  // Get appropriate fallback given state of site
  MethodHandle fallback = getFallback(module, cachingFallback);
  // Test that module is same as before
  target = guardWithTest(module.getIdTest(), target, fallback);
  // Global invalidation
  SwitchPoint switchPoint = (SwitchPoint) runtime.getConstantInvalidator(name).getData();
  target = switchPoint.guardWithTest(target, fallback);
  setTarget(target);
}
origin: org.jruby/jruby-core

private void bind(Ruby runtime, RubyModule module, IRubyObject constant, MethodHandle cachingFallback) {
  MethodHandle target = Binder.from(type())
      .drop(0, 2)
      .constant(constant);
  // Get appropriate fallback given state of site
  MethodHandle fallback = getFallback(module, cachingFallback);
  // Test that module is same as before
  target = guardWithTest(module.getIdTest(), target, fallback);
  // Global invalidation
  SwitchPoint switchPoint = (SwitchPoint) runtime.getConstantInvalidator(name).getData();
  target = switchPoint.guardWithTest(target, fallback);
  setTarget(target);
}
origin: com.headius/invokebinder

/**
 * Apply all transforms to an endpoint that does absolutely nothing. Useful for
 * creating exception handlers in void methods that simply ignore the exception.
 *
 * @return a handle that has all transforms applied and does nothing at its endpoint
 */
public MethodHandle nop() {
  if (type().returnType() != void.class) {
    throw new InvalidTransformException("must have void return type to nop: " + type());
  }
  return invoke(Binder
      .from(type())
      .drop(0, type().parameterCount())
      .cast(Object.class)
      .constant(null));
}
com.headius.invokebinderBinderconstant

Javadoc

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.

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).
  • invoke
    Apply the chain of transforms and bind them to a static method specified using the end signature plu
  • collect
    Box all incoming arguments from the given position onward into the given array type.
  • 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

  • Updating database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • findViewById (Activity)
  • setContentView (Activity)
  • Menu (java.awt)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Join (org.hibernate.mapping)
  • Top 12 Jupyter Notebook extensions
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