Modifier and Type | Class and Description |
---|---|
static interface |
Function.A0<R>
Java function with no arguments.
|
static interface |
Function.A1<P1,R>
Java function with one argument.
|
static interface |
Function.A2<P1,P2,R>
Java function with two arguments.
|
static interface |
Function.A3<P1,P2,P3,R>
Java function with three arguments.
|
static interface |
Function.A4<P1,P2,P3,P4,R>
Java function with four arguments.
|
static interface |
Function.A5<P1,P2,P3,P4,P5,R>
Java function with five arguments.
|
Objs.Constructor<T extends Objs>, Objs.Property<T>
Modifier and Type | Field and Description |
---|---|
Objs.Property<Number> |
length |
Objs.Property<Objs> |
prototype |
Modifier | Constructor and Description |
---|---|
protected |
Function(Objs.Constructor<?> constructor,
Object js) |
|
Function(String... args)
Creates a new function.
|
Modifier and Type | Method and Description |
---|---|
static Function |
$as(Object obj)
Casts given object to this class.
|
static Object |
$call(Object fn,
Object... params)
Invokes an object that represents a function - e.g.
|
Object |
apply(Object thisArg,
Object... argArray)
Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function.
|
Object |
bind(Object thisArg,
Object... argArray)
For a given function, creates a bound function that has the same body as the original function.
|
static <A> Function |
newFunction(Function.A1<? super A,? extends Object> fn,
Class<A> argTypeA)
Factory method that wraps provided function interface into JavaScript
function object.
|
static <A,B> Function |
newFunction(Function.A2<? super A,? super B,? extends Object> fn,
Class<A> argTypeA,
Class<B> argTypeB)
Factory method that wraps provided function interface into JavaScript
function object.
|
static <A,B,C> Function |
newFunction(Function.A3<? super A,? super B,? super C,? extends Object> fn,
Class<A> argTypeA,
Class<B> argTypeB,
Class<C> argTypeC)
Factory method that wraps provided function interface into JavaScript
function object.
|
static <A,B,C,D> Function |
newFunction(Function.A4<? super A,? super B,? super C,? super D,? extends Object> fn,
Class<A> argTypeA,
Class<B> argTypeB,
Class<C> argTypeC,
Class<D> argTypeD)
Factory method that wraps provided function interface into JavaScript
function object.
|
static Function |
newFunction(Function.A5<? extends Object,? extends Object,? extends Object,? extends Object,? extends Object,? extends Object> fn)
Factory method that wraps provided function interface into JavaScript
function object.
|
static Function |
newFunction(Function.A5<? extends Object,? extends Object,? extends Object,? extends Object,? extends Object,? extends Object> fn,
Class[] argTypes)
Factory method that wraps provided function interface into JavaScript
function object.
|
static <A,B,C,D,E> |
newFunction(Function.A5<? super A,? super B,? super C,? super D,? super E,? extends Object> fn,
Class<A> argTypeA,
Class<B> argTypeB,
Class<C> argTypeC,
Class<D> argTypeD,
Class<E> argTypeE)
Factory method that wraps provided function interface into JavaScript
function object.
|
static Function |
newFunction(String... args)
Calls the
constructor . |
$as, $cast, $delete, $get, $js, $set, create, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor, getOwnPropertyNames, getPrototypeOf, hasOwnProperty, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, newObject, newObject, preventExtensions, propertyIsEnumerable, seal, toLocaleString, toString, valueOf
public final Objs.Property<Objs> prototype
public final Objs.Property<Number> length
protected Function(Objs.Constructor<?> constructor, Object js)
public Function(String... args)
args
- a list of arguments the function accepts followed by function's bodypublic static Function $as(Object obj)
obj
- any objectobj
objectpublic Object apply(Object thisArg, Object... argArray)
thisArg
- The object to be used as the this object.argArray
- A set of arguments to be passed to the function.public Object bind(Object thisArg, Object... argArray)
thisArg
- An object to which the this keyword can refer inside the new function.argArray
- A list of arguments to be passed to the new function.public static Function newFunction(String... args)
constructor
.args
- a list of arguments the function accepts followed by function's bodypublic static <A> Function newFunction(Function.A1<? super A,? extends Object> fn, Class<A> argTypeA)
A
- type of parameter Afn
- implementation of the function to wrapargTypeA
- class of parameter Apublic static <A,B> Function newFunction(Function.A2<? super A,? super B,? extends Object> fn, Class<A> argTypeA, Class<B> argTypeB)
A
- type of parameter AB
- type of parameter Bfn
- implementation of the function to wrapargTypeA
- class of parameter AargTypeB
- class of parameter Bpublic static <A,B,C> Function newFunction(Function.A3<? super A,? super B,? super C,? extends Object> fn, Class<A> argTypeA, Class<B> argTypeB, Class<C> argTypeC)
A
- type of parameter AB
- type of parameter BC
- type of parameter Cfn
- implementation of the function to wrapargTypeA
- class of parameter AargTypeB
- class of parameter BargTypeC
- class of parameter Cpublic static <A,B,C,D> Function newFunction(Function.A4<? super A,? super B,? super C,? super D,? extends Object> fn, Class<A> argTypeA, Class<B> argTypeB, Class<C> argTypeC, Class<D> argTypeD)
A
- type of parameter AB
- type of parameter BC
- type of parameter CD
- type of parameter Dfn
- implementation of the function to wrapargTypeA
- class of parameter AargTypeB
- class of parameter BargTypeC
- class of parameter CargTypeD
- class of parameter Dpublic static <A,B,C,D,E> Function newFunction(Function.A5<? super A,? super B,? super C,? super D,? super E,? extends Object> fn, Class<A> argTypeA, Class<B> argTypeB, Class<C> argTypeC, Class<D> argTypeD, Class<E> argTypeE)
A
- type of parameter AB
- type of parameter BC
- type of parameter CD
- type of parameter DE
- type of parameter Efn
- implementation of the function to wrapargTypeA
- class of parameter AargTypeB
- class of parameter BargTypeC
- class of parameter CargTypeD
- class of parameter DargTypeE
- class of parameter Epublic static Function newFunction(Function.A5<? extends Object,? extends Object,? extends Object,? extends Object,? extends Object,? extends Object> fn)
fn
- the implementation of the functionpublic static Function newFunction(Function.A5<? extends Object,? extends Object,? extends Object,? extends Object,? extends Object,? extends Object> fn, Class[] argTypes)
fn
- the implementation of the functionargTypes
- array with classes of the argumentspublic static Object $call(Object fn, Object... params)
Function.A0
,
Function.A1
, etc.fn
- the object representing a functionparams
- parameters to pass to the functionIllegalArgumentException
- if the object fn
isn't a functionCopyright © 2018. All rights reserved.