org.jruby.anno.JRubyMethod.required()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(179)

本文整理了Java中org.jruby.anno.JRubyMethod.required()方法的一些代码示例,展示了JRubyMethod.required()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JRubyMethod.required()方法的具体详情如下:
包路径:org.jruby.anno.JRubyMethod
类名称:JRubyMethod
方法名:required

JRubyMethod.required介绍

暂无

代码示例

代码示例来源:origin: org.jruby/jruby-complete

public static Arity fromAnnotation(JRubyMethod anno, Class[] parameterTypes, boolean isStatic) {
  int required;
  if (anno.optional() == 0 && !anno.rest() && anno.required() == 0) {
    // try count specific args to determine required
    int i = parameterTypes.length;
    if (isStatic) i--;
    if (parameterTypes.length > 0) {
      if (parameterTypes[0] == ThreadContext.class) i--;
      if (parameterTypes[parameterTypes.length - 1] == Block.class) i--;
    }
    required = i;
  } else {
    required = anno.required();
  }
  
  return createArity(required, anno.optional(), anno.rest());
}

代码示例来源:origin: org.jruby/jruby-core

public static Arity fromAnnotation(JRubyMethod anno, Class[] parameterTypes, boolean isStatic) {
  int required;
  if (anno.optional() == 0 && !anno.rest() && anno.required() == 0) {
    // try count specific args to determine required
    int i = parameterTypes.length;
    if (isStatic) i--;
    if (parameterTypes.length > 0) {
      if (parameterTypes[0] == ThreadContext.class) i--;
      if (parameterTypes[parameterTypes.length - 1] == Block.class) i--;
    }
    required = i;
  } else {
    required = anno.required();
  }
  
  return createArity(required, anno.optional(), anno.rest());
}

代码示例来源:origin: org.jruby/jruby-complete

public static long getEncodedSignature(JRubyMethod anno) {
  return encodeSignature(anno.required(), anno.optional(), 0, 0, 0, anno.rest(), false);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public static Arity fromAnnotation(JRubyMethod anno, Class[] parameterTypes, boolean isStatic) {
  int required;
  if (anno.optional() == 0 && !anno.rest() && anno.required() == 0) {
    // try count specific args to determine required
    int i = parameterTypes.length;
    if (isStatic) i--;
    if (parameterTypes.length > 0) {
      if (parameterTypes[0] == ThreadContext.class) i--;
      if (parameterTypes[parameterTypes.length - 1] == Block.class) i--;
    }
    required = i;
  } else {
    required = anno.required();
  }
  
  return createArity(required, anno.optional(), anno.rest());
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public static Arity fromAnnotation(JRubyMethod anno, Class[] parameterTypes, boolean isStatic) {
  int required;
  if (anno.optional() == 0 && !anno.rest() && anno.required() == 0) {
    // try count specific args to determine required
    int i = parameterTypes.length;
    if (isStatic) i--;
    if (parameterTypes.length > 0) {
      if (parameterTypes[0] == ThreadContext.class) i--;
      if (parameterTypes[parameterTypes.length - 1] == Block.class) i--;
    }
    required = i;
  } else {
    required = anno.required();
  }
  
  return createArity(required, anno.optional(), anno.rest());
}

代码示例来源:origin: org.jruby/jruby-core

public static Arity fromAnnotation(JRubyMethod anno) {
  return createArity(anno.required(), anno.optional(), anno.rest());
}

代码示例来源:origin: org.jruby/jruby-complete

public static Arity fromAnnotation(JRubyMethod anno) {
  return createArity(anno.required(), anno.optional(), anno.rest());
}

代码示例来源:origin: org.jruby/jruby-core

public static long getEncodedSignature(JRubyMethod anno) {
  return encodeSignature(anno.required(), anno.optional(), 0, 0, 0, anno.rest(), false);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public static Arity fromAnnotation(JRubyMethod anno) {
  return createArity(anno.required(), anno.optional(), anno.rest());
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public static Arity fromAnnotation(JRubyMethod anno) {
  return createArity(anno.required(), anno.optional(), anno.rest());
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

required = anno.required();

代码示例来源:origin: org.jruby/jruby-core

required = anno.required();

代码示例来源:origin: org.jruby/jruby-complete

required = anno.required();

代码示例来源:origin: org.jruby/jruby-complete

false);
int handleOffset = calculateHandleOffset(method.getParameters().size(), anno.required(), anno.optional(), anno.rest(), isStatic, hasContext, hasBlock);

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

boolean checkArity = false;
if (jrubyMethod.rest()) {
  if (jrubyMethod.required() > 0) {
    method.ldc(jrubyMethod.required());
    method.if_icmplt(arityError);
    checkArity = true;
  if (jrubyMethod.required() > 0) {
    method.ldc(jrubyMethod.required());
    method.if_icmplt(arityError);
  method.ldc(jrubyMethod.required() + jrubyMethod.optional());
  method.if_icmpgt(arityError);
  checkArity = true;
  method.ldc(jrubyMethod.required());
  method.if_icmpne(arityError);
  checkArity = true;
  method.invokevirtual(p(ThreadContext.class), "getRuntime", sig(Ruby.class));
  method.aload(ARGS_INDEX);
  method.ldc(jrubyMethod.required());
  method.ldc(jrubyMethod.required() + jrubyMethod.optional());
  method.invokestatic(p(Arity.class), "checkArgumentCount", sig(int.class, Ruby.class, IRubyObject[].class, int.class, int.class));
  method.pop();

代码示例来源:origin: org.jruby/jruby-complete

boolean checkArity = false;
if (jrubyMethod.rest()) {
  if (jrubyMethod.required() > 0) {
    method.ldc(jrubyMethod.required());
    method.if_icmplt(arityError);
    checkArity = true;
  if (jrubyMethod.required() > 0) {
    method.ldc(jrubyMethod.required());
    method.if_icmplt(arityError);
  method.ldc(jrubyMethod.required() + jrubyMethod.optional());
  method.if_icmpgt(arityError);
  checkArity = true;
  method.ldc(jrubyMethod.required());
  method.if_icmpne(arityError);
  checkArity = true;
  method.invokevirtual(p(ThreadContext.class), "getRuntime", sig(Ruby.class));
  method.aload(ARGS_INDEX);
  method.ldc(jrubyMethod.required());
  method.ldc(jrubyMethod.required() + jrubyMethod.optional());
  method.invokestatic(p(Arity.class), "checkArgumentCount", sig(int.class, Ruby.class, IRubyObject[].class, int.class, int.class));
  method.pop();

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

boolean checkArity = false;
if (jrubyMethod.rest()) {
  if (jrubyMethod.required() > 0) {
    method.ldc(jrubyMethod.required());
    method.if_icmplt(arityError);
    checkArity = true;
  if (jrubyMethod.required() > 0) {
    method.ldc(jrubyMethod.required());
    method.if_icmplt(arityError);
  method.ldc(jrubyMethod.required() + jrubyMethod.optional());
  method.if_icmpgt(arityError);
  checkArity = true;
  method.ldc(jrubyMethod.required());
  method.if_icmpne(arityError);
  checkArity = true;
  method.invokevirtual(p(ThreadContext.class), "getRuntime", sig(Ruby.class));
  method.aload(ARGS_INDEX);
  method.ldc(jrubyMethod.required());
  method.ldc(jrubyMethod.required() + jrubyMethod.optional());
  method.invokestatic(p(Arity.class), "checkArgumentCount", sig(int.class, Ruby.class, IRubyObject[].class, int.class, int.class));
  method.pop();

代码示例来源:origin: org.jruby/jruby-core

boolean checkArity = false;
if (jrubyMethod.rest()) {
  if (jrubyMethod.required() > 0) {
    method.ldc(jrubyMethod.required());
    method.if_icmplt(arityError);
    checkArity = true;
  if (jrubyMethod.required() > 0) {
    method.ldc(jrubyMethod.required());
    method.if_icmplt(arityError);
  method.ldc(jrubyMethod.required() + jrubyMethod.optional());
  method.if_icmpgt(arityError);
  checkArity = true;
  method.ldc(jrubyMethod.required());
  method.if_icmpne(arityError);
  checkArity = true;
  method.invokevirtual(p(ThreadContext.class), "getRuntime", sig(Ruby.class));
  method.aload(ARGS_INDEX);
  method.ldc(jrubyMethod.required());
  method.ldc(jrubyMethod.required() + jrubyMethod.optional());
  method.invokestatic(p(Arity.class), "checkArgumentCount", sig(int.class, Ruby.class, IRubyObject[].class, int.class, int.class));
  method.pop();

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

JRubyMethod annotation = reflected.getAnnotation(JRubyMethod.class);
int required = annotation.required();
int optional = annotation.optional();
boolean rest = annotation.rest();

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

JRubyMethod annotation = reflected.getAnnotation(JRubyMethod.class);
int required = annotation.required();
int optional = annotation.optional();
boolean rest = annotation.rest();

相关文章