本文整理汇总了Java中elemental2.core.Function类的典型用法代码示例。如果您正苦于以下问题:Java Function类的具体用法?Java Function怎么用?Java Function使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Function类属于elemental2.core包,在下文中一共展示了Function类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyHook
import elemental2.core.Function; //导入依赖的package包/类
/**
* Copy the given hook function from the Java instance to the options we pass to Vue
* @param hookFunctionName The name of the hook function to copy
*/
private void copyHook(String hookFunctionName)
{
Function hookFunction =
(Function) ((JsPropertyMap) vuegwt$javaDirectiveInstance).get(hookFunctionName);
if (hookFunction == null)
return;
// Filter empty function inherited from VueDirective
String body = getFunctionBody(hookFunction);
if ("".equals(body))
return;
set(hookFunctionName, hookFunction);
}
示例2: asFunction
import elemental2.core.Function; //导入依赖的package包/类
@JsOverlay
public final Function asFunction() {
return Js.uncheckedCast(this);
}
示例3: callConstructor
import elemental2.core.Function; //导入依赖的package包/类
/**
* Call our {@link VueComponent} constructor. Pass injected parameters if needed.
* @param component {@link VueComponent} to process
* @param createdMethodBuilder Builder for our Create method
*/
private void callConstructor(TypeElement component, MethodSpec.Builder createdMethodBuilder)
{
createdMethodBuilder.addStatement("$T javaConstructor = $T.getJavaConstructor($T.class)",
Function.class,
VueGWT.class,
componentJsTypeName(component));
createdMethodBuilder.addStatement("javaConstructor.apply(this)");
}
示例4: getFunctionBody
import elemental2.core.Function; //导入依赖的package包/类
private String getFunctionBody(Function jsFunction)
{
JsString jsString = cast(jsFunction.toString());
// Get content between first { and last }
JsString m = cast(jsString.match(new JsRegExp("\\{([\\s\\S]*)\\}", "m"))[1]);
// Strip comments
return m.replace(new JsRegExp("^\\s*\\/\\/.*$", "mg"), "").trim();
}
示例5: wrapMethod
import elemental2.core.Function; //导入依赖的package包/类
/**
* Proxy a method call to be warned when it called. This requires the
* function to be JsInterop (name shouldn't change at runtime). This used to
* observe Java Collections/Map. It won't be necessary in future versions of
* Vue.js based on ES6 proxies.
* @param object The object to observe
* @param methodName The name of the method to proxify
* @param afterMethodCall A callback called each time after the method has
* been executed
* @param <T> Type of the object the we Proxy
*/
public static <T> void wrapMethod(T object, String methodName,
AfterMethodCall<T> afterMethodCall)
{
Function method = (Function) ((JsPropertyMap) object).get(methodName);
WrappingFunction wrappingFunction = args -> {
Object result = method.apply(object, args);
afterMethodCall.execute(object, methodName, result, args);
return result;
};
((JsPropertyMap) object).set(methodName, wrappingFunction);
}
示例6: initRenderFunctions
import elemental2.core.Function; //导入依赖的package包/类
/**
* Initialise the render functions from our template.
*/
@JsOverlay
private void initRenderFunctions()
{
this.set("render", new Function(componentTemplate.getRenderFunction()));
JsArray<Object> staticRenderFns = new JsArray<>();
for (String staticRenderFunction : componentTemplate.getStaticRenderFunctions())
{
staticRenderFns.push(new Function(staticRenderFunction));
}
this.setStaticRenderFns(staticRenderFns);
}
示例7: addMethod
import elemental2.core.Function; //导入依赖的package包/类
@JsOverlay
public final VueComponentOptions addMethod(String name, Function method)
{
if (this.methods == null)
this.methods = (JsPropertyMap<Function>) new JsObject();
this.methods.set(name, method);
return this;
}
示例8: getJavaComponentMethod
import elemental2.core.Function; //导入依赖的package包/类
/**
* Get the given java method from the {@link ComponentTemplate}.
* @param javaMethodName Name of the Java method to retrieve
* @return The JS function that represent our Java method.
*/
@JsOverlay
private Function getJavaComponentMethod(String javaMethodName)
{
return (Function) componentJavaPrototype.get(javaMethodName);
}
示例9: getMethods
import elemental2.core.Function; //导入依赖的package包/类
@JsOverlay
public final JsPropertyMap<Function> getMethods()
{
return methods;
}
示例10: set
import elemental2.core.Function; //导入依赖的package包/类
@JsProperty(name = "set")
Function set();
示例11: curryThisIn1
import elemental2.core.Function; //导入依赖的package包/类
public static native <This, Arg1> Function curryThisIn1(In2<This, Arg1> task)
/*-{
return @JsFunctionSupport::maybeEnter(*)(function(){
[email protected]::in(Ljava/lang/Object;Ljava/lang/Object;)(this, arguments[0]);
});
}-*/;
示例12: setImmediate
import elemental2.core.Function; //导入依赖的package包/类
@JsProperty(name = "setImmediate")
public native Function setImmediate();
示例13: runNow
import elemental2.core.Function; //导入依赖的package包/类
@JsProperty(name = "runNow")
public native Function runNow();
示例14: clearImmediate
import elemental2.core.Function; //导入依赖的package包/类
@JsProperty(name = "clearImmediate")
public native Function clearImmediate();
示例15: setStyle
import elemental2.core.Function; //导入依赖的package包/类
/**
* Changes styles of GeoJSON vector layers with the given style function.
*
* @param style the style function
* @return the L class
*/
@JsMethod
public native L setStyle(Function style);