org.jruby.runtime
Class Arity

java.lang.Object
  extended by org.jruby.runtime.Arity
All Implemented Interfaces:
java.io.Serializable

public final class Arity
extends java.lang.Object
implements java.io.Serializable

The arity of a method is the number of arguments it takes.

See Also:
Serialized Form

Field Summary
static Arity NO_ARGUMENTS
           
static Arity ONE_ARGUMENT
           
static Arity ONE_REQUIRED
           
static Arity OPTIONAL
           
static Arity THREE_ARGUMENTS
           
static Arity THREE_REQUIRED
           
static Arity TWO_ARGUMENTS
           
static Arity TWO_REQUIRED
           
 
Method Summary
static int checkArgumentCount(Ruby runtime, int length, int min, int max)
           
static int checkArgumentCount(Ruby runtime, IRubyObject[] args, int min, int max)
           
 void checkArity(Ruby runtime, int length)
           
 void checkArity(Ruby runtime, IRubyObject[] args)
           
static Arity createArity(int value)
           
 boolean equals(java.lang.Object other)
           
static Arity fixed(int arity)
           
static Arity fromAnnotation(JRubyMethod anno)
           
static Arity fromAnnotation(JRubyMethod anno, java.lang.Class[] parameterTypes, boolean isStatic)
           
static Arity fromAnnotation(JRubyMethod anno, int actualRequired)
           
 int getValue()
           
 int hashCode()
           
 boolean isFixed()
           
static Arity noArguments()
           
static Arity optional()
           
static Arity procArityOf(Node node)
           
static void raiseArgumentError(Ruby runtime, int length, int min, int max)
           
static void raiseArgumentError(Ruby runtime, IRubyObject[] args, int min, int max)
           
 int required()
           
static Arity required(int minimum)
           
static IRubyObject[] scanArgs(Ruby runtime, IRubyObject[] args, int required, int optional)
           
static Arity singleArgument()
           
 java.lang.String toString()
           
static Arity twoArguments()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_ARGUMENTS

public static final Arity NO_ARGUMENTS

ONE_ARGUMENT

public static final Arity ONE_ARGUMENT

TWO_ARGUMENTS

public static final Arity TWO_ARGUMENTS

THREE_ARGUMENTS

public static final Arity THREE_ARGUMENTS

OPTIONAL

public static final Arity OPTIONAL

ONE_REQUIRED

public static final Arity ONE_REQUIRED

TWO_REQUIRED

public static final Arity TWO_REQUIRED

THREE_REQUIRED

public static final Arity THREE_REQUIRED
Method Detail

createArity

public static Arity createArity(int value)

fromAnnotation

public static Arity fromAnnotation(JRubyMethod anno)

fromAnnotation

public static Arity fromAnnotation(JRubyMethod anno,
                                   int actualRequired)

fromAnnotation

public static Arity fromAnnotation(JRubyMethod anno,
                                   java.lang.Class[] parameterTypes,
                                   boolean isStatic)

fixed

public static Arity fixed(int arity)

optional

public static Arity optional()

required

public static Arity required(int minimum)

noArguments

public static Arity noArguments()

singleArgument

public static Arity singleArgument()

twoArguments

public static Arity twoArguments()

procArityOf

public static Arity procArityOf(Node node)

getValue

public int getValue()

checkArity

public void checkArity(Ruby runtime,
                       IRubyObject[] args)

checkArity

public void checkArity(Ruby runtime,
                       int length)

isFixed

public boolean isFixed()

required

public int required()

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

checkArgumentCount

public static int checkArgumentCount(Ruby runtime,
                                     IRubyObject[] args,
                                     int min,
                                     int max)

raiseArgumentError

public static void raiseArgumentError(Ruby runtime,
                                      IRubyObject[] args,
                                      int min,
                                      int max)

checkArgumentCount

public static int checkArgumentCount(Ruby runtime,
                                     int length,
                                     int min,
                                     int max)

raiseArgumentError

public static void raiseArgumentError(Ruby runtime,
                                      int length,
                                      int min,
                                      int max)

scanArgs

public static IRubyObject[] scanArgs(Ruby runtime,
                                     IRubyObject[] args,
                                     int required,
                                     int optional)
See Also:
org.jruby.runtime.builtin.IRubyObject#scanArgs()


Copyright © 2002-2009 JRuby Team. All Rights Reserved.