/** * Convenience alias for the getArguments(idx) method thought just to * make gQuery code look closed to jQuery. */ public <T> T arguments(int idx) { return getArgument(idx); }
/** * Safety return the argument in the position idx. * * If the element class is not of the requested type it returns null and * you don't get casting exeption. */ public <T> T getArgument(int argIdx, int pos) { return getArgument(argIdx, pos, null); }
/** * Utility method for safety getting a JavaScriptObject present at a certain * position in the list of arguments composed by arrays. * */ @SuppressWarnings("unchecked") public <T extends JavaScriptObject> T getArgumentJSO(int argIdx, int pos) { return (T) getArgument(argIdx, pos, JavaScriptObject.class); }
/** * Safety return the argument in the position idx. * * If the element class is not of the requested type it returns null and * you don't get casting exeption. */ public <T> T getArgument(int idx, Class<? extends T> type) { return getArgument(-1, idx, type); }
/** * Return the argument in the position idx or null if it doesn't exist. * * Note: if the return type doesn't match the object, you * will get a casting exception. */ public <T> T getArgument(int idx) { return getArgument(-1, idx, null); }
/** * Convenience alias for the getArguments(argIdx, pos) method. */ public <T> T arguments(int argIdx, int pos) { return getArgument(argIdx, pos); }
/** * @deprecated use getArgument instead. */ @Deprecated public Object getDataObject(int idx) { return getArgument(idx); }
/** * Return the first element of the arguments list. * * @deprecated use getArgument(idx) instead. */ @Deprecated public Object getDataObject() { return getArgument(0); }
/** * Utility method for safety getting an array present at a certain * position in the list of arguments. * * Useful for Deferred chains where result of each resolved * promise is set as an array in the arguments list. * * Always returns an array. */ public Object[] getArgumentArray(int idx) { Object o = idx < 0 ? arguments : getArgument(idx); if (o != null) { return o.getClass().isArray() ? (Object[]) o : new Object[] {o}; } else if (idx == 0) { return arguments; } return new Object[0]; }