public class ArgUtils extends Object
| Constructor and Description |
|---|
ArgUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
booleanArg(Object[] args,
int pos)
Return the argument at "pos" as a boolean, or throw an exception if the argument list is not long enough.
|
static boolean |
booleanArg(Object[] args,
int pos,
boolean def)
Return the argument at "pos" as a boolean, or return "def" if the argument list is not long enough.
|
static double |
doubleArg(Object[] args,
int pos)
Return the argument at "pos" as a double, or throw an exception if the argument list is not long enough.
|
static double |
doubleArg(Object[] args,
int pos,
double def)
Return the argument at "pos" as a double, or return "def" if the argument list is not long enough.
|
static void |
ensureArg(Object[] args,
int pos)
Throw an execption if the argument list isn't long enough for argument "pos".
|
static org.mozilla.javascript.Scriptable |
ensureValid(Object obj)
Return the object, or null if it is "not found" or undefined.
|
static float |
floatArg(Object[] args,
int pos)
Return the argument at "pos" as a float, or throw an exception if the argument list is not long enough.
|
static float |
floatArg(Object[] args,
int pos,
float def)
Return the argument at "pos" as a float, or return "def" if the argument list is not long enough.
|
static org.mozilla.javascript.Function |
functionArg(Object[] args,
int pos,
boolean required)
Deprecated.
|
static int |
intArg(Object[] args,
int pos)
Return the argument at "pos" as an int, or throw an exception if the argument list is not long enough.
|
static int |
intArg(Object[] args,
int pos,
int def)
Return the argument at "pos" as an int, or return "def" if the argument list is not long enough.
|
static int |
intArgOnly(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable scope,
Object[] args,
int pos,
int def)
Return the argument at "pos" as a Number, or throw an exception if the argument list is not long enough.
|
static int |
intArgOnly(Object[] args,
int pos)
Deprecated.
|
static boolean |
isIntArg(Object o)
Return if the specified argument is either a Number, or a String that could be converted to a number.
|
static long |
longArg(Object[] args,
int pos)
Return the argument at "pos" as a long, or throw an exception if the argument list is not long enough.
|
static long |
longArg(Object[] args,
int pos,
long def)
Return the argument at "pos" as a long, or return "def" if the argument list is not long enough.
|
static long |
longArgOnly(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable scope,
Object[] args,
int pos,
long def)
Return the argument at "pos" as a long, or return "def" if the argument list is not long enough.
|
static Number |
numberArg(Object[] args,
int pos)
Return the argument at "pos" as a Number, or throw an exception if the argument list is not long enough.
|
static <T> T |
objArg(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable scope,
Object[] args,
int pos,
Class<T> type,
boolean required)
Return the argument at "pos" as a member of the specified Java class, and throw an exception
if "required" and the list is too short.
|
static <T> T |
objArg(Object[] args,
int pos,
Class<T> type,
boolean required)
Deprecated.
|
static int |
octalOrHexIntArg(Object[] args,
int pos)
Return the argument at "pos" as an int, or throw an exception if the argument list is not long enough.
|
static int |
octalOrHexIntArg(Object[] args,
int pos,
int def)
Return the argument at "pos" as an int, or return "def" if the argument list is not long enough.
|
static int |
parseUnsignedIntForgiveably(Object o)
Some Node code expects us to be very forgiving with integers.
|
static String |
stringArg(Object[] args,
int pos)
Return the argument at "pos" as a String, or throw an exception if the argument list is not long enough.
|
static String |
stringArg(Object[] args,
int pos,
String def)
Return the argument at "pos" as a String, or return "def" if the argument list is not long enough.
|
static int |
toInt(Object o)
Turn an object into an integer if we can.
|
public static int toInt(Object o)
public static void ensureArg(Object[] args, int pos)
public static String stringArg(Object[] args, int pos)
public static String stringArg(Object[] args, int pos, String def)
public static int intArg(Object[] args, int pos)
public static int intArg(Object[] args, int pos, int def)
public static int octalOrHexIntArg(Object[] args, int pos)
public static int octalOrHexIntArg(Object[] args, int pos, int def)
public static Number numberArg(Object[] args, int pos)
@Deprecated public static int intArgOnly(Object[] args, int pos)
public static int intArgOnly(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable scope,
Object[] args,
int pos,
int def)
public static long longArg(Object[] args, int pos)
public static long longArg(Object[] args, int pos, long def)
public static long longArgOnly(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable scope,
Object[] args,
int pos,
long def)
public static boolean booleanArg(Object[] args, int pos)
public static boolean booleanArg(Object[] args, int pos, boolean def)
public static float floatArg(Object[] args, int pos)
public static float floatArg(Object[] args, int pos, float def)
public static double doubleArg(Object[] args, int pos)
public static double doubleArg(Object[] args, int pos, double def)
@Deprecated public static org.mozilla.javascript.Function functionArg(Object[] args, int pos, boolean required)
@Deprecated public static <T> T objArg(Object[] args, int pos, Class<T> type, boolean required)
public static <T> T objArg(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable scope,
Object[] args,
int pos,
Class<T> type,
boolean required)
public static boolean isIntArg(Object o)
public static int parseUnsignedIntForgiveably(Object o)
public static org.mozilla.javascript.Scriptable ensureValid(Object obj)
Copyright © 2016 Apigee Corporation. All Rights Reserved.