當前位置: 首頁>>代碼示例>>Java>>正文


Java Function類代碼示例

本文整理匯總了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);
}
 
開發者ID:Axellience,項目名稱:vue-gwt,代碼行數:19,代碼來源:VueDirectiveOptions.java

示例2: asFunction

import elemental2.core.Function; //導入依賴的package包/類
@JsOverlay
public final Function asFunction() {
    return Js.uncheckedCast(this);
}
 
開發者ID:WeTheInternet,項目名稱:xapi,代碼行數:5,代碼來源:RunSoon.java

示例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)");
}
 
開發者ID:Axellience,項目名稱:vue-gwt,代碼行數:15,代碼來源:ComponentJsTypeGenerator.java

示例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();
}
 
開發者ID:Axellience,項目名稱:vue-gwt,代碼行數:10,代碼來源:VueDirectiveOptions.java

示例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);
}
 
開發者ID:Axellience,項目名稱:vue-gwt,代碼行數:25,代碼來源:VueGWTTools.java

示例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);
}
 
開發者ID:Axellience,項目名稱:vue-gwt,代碼行數:16,代碼來源:VueComponentOptions.java

示例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;
}
 
開發者ID:Axellience,項目名稱:vue-gwt,代碼行數:10,代碼來源:VueComponentOptions.java

示例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);
}
 
開發者ID:Axellience,項目名稱:vue-gwt,代碼行數:11,代碼來源:VueComponentOptions.java

示例9: getMethods

import elemental2.core.Function; //導入依賴的package包/類
@JsOverlay
public final JsPropertyMap<Function> getMethods()
{
    return methods;
}
 
開發者ID:Axellience,項目名稱:vue-gwt,代碼行數:6,代碼來源:VueComponentOptions.java

示例10: set

import elemental2.core.Function; //導入依賴的package包/類
@JsProperty(name = "set")
Function set();
 
開發者ID:WeTheInternet,項目名稱:xapi,代碼行數:3,代碼來源:JsObjectDescriptor.java

示例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]);
         });
 }-*/;
 
開發者ID:WeTheInternet,項目名稱:xapi,代碼行數:7,代碼來源:JsFunctionSupport.java

示例12: setImmediate

import elemental2.core.Function; //導入依賴的package包/類
@JsProperty(name = "setImmediate")
public native Function setImmediate();
 
開發者ID:WeTheInternet,項目名稱:xapi,代碼行數:3,代碼來源:RunSoon.java

示例13: runNow

import elemental2.core.Function; //導入依賴的package包/類
@JsProperty(name = "runNow")
public native Function runNow();
 
開發者ID:WeTheInternet,項目名稱:xapi,代碼行數:3,代碼來源:RunSoon.java

示例14: clearImmediate

import elemental2.core.Function; //導入依賴的package包/類
@JsProperty(name = "clearImmediate")
public native Function clearImmediate();
 
開發者ID:WeTheInternet,項目名稱:xapi,代碼行數:3,代碼來源:RunSoon.java

示例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);
 
開發者ID:gwidgets,項目名稱:gwty-leaflet,代碼行數:9,代碼來源:GeoJSON.java


注:本文中的elemental2.core.Function類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。