All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.axellience.vueroutergwt.client.RouteConfig Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
package com.axellience.vueroutergwt.client;

import com.axellience.vuegwt.core.client.VueGWT;
import com.axellience.vuegwt.core.client.component.VueComponent;
import com.axellience.vuegwt.core.client.vue.VueFactory;
import com.axellience.vuegwt.core.client.vue.VueJsConstructor;
import com.axellience.vueroutergwt.client.functions.NavigationGuard;
import elemental2.core.Array;
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import jsinterop.base.JsPropertyMap;

/**
 * @author Adrien Baron
 */
@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
public final class RouteConfig
{
    @JsProperty private String path;
    @JsProperty private String name;
    @JsProperty private Object component;
    @JsProperty private JsPropertyMap components;
    @JsProperty private Object redirect;
    @JsProperty private Object alias;
    @JsProperty private Array children;
    @JsProperty private Object meta;
    @JsProperty private NavigationGuard beforeEnter;
    @JsProperty private Object props;
    @JsProperty private boolean caseSensitive;
    @JsProperty private PathToRegexpOptions pathToRegexpOptions;

    @JsOverlay
    public static  RouteConfig of(String path, Class componentClass)
    {
        return of(path, VueGWT.getFactory(componentClass));
    }

    @JsOverlay
    public static  RouteConfig of(String path,
        VueFactory componentFactory)
    {
        return of(path, componentFactory.getJsConstructor());
    }

    @JsOverlay
    public static  RouteConfig of(String path,
        VueJsConstructor componentJsConstructor)
    {
        return new RouteConfig().setPath(path).setComponent(componentJsConstructor);
    }

    @JsOverlay
    public static  RouteConfig of(String name, String path,
        Class componentClass)
    {
        return of(path, componentClass).setName(name);
    }

    @JsOverlay
    public static  RouteConfig of(String name, String path,
        VueFactory componentFactory)
    {
        return of(path, componentFactory).setName(name);
    }

    @JsOverlay
    public static  RouteConfig of(String name, String path,
        VueJsConstructor componentJsConstructor)
    {
        return of(path, componentJsConstructor).setName(name);
    }

    @JsOverlay
    public final String getPath()
    {
        return path;
    }

    @JsOverlay
    public final RouteConfig setPath(String path)
    {
        this.path = path;
        return this;
    }

    @JsOverlay
    public final String getName()
    {
        return name;
    }

    @JsOverlay
    public final RouteConfig setName(String name)
    {
        this.name = name;
        return this;
    }

    @JsOverlay
    public final Object getComponent()
    {
        return component;
    }

    @JsOverlay
    public final RouteConfig setComponent(Object component)
    {
        this.component = component;
        return this;
    }

    @JsOverlay
    public final JsPropertyMap getComponents()
    {
        return components;
    }

    @JsOverlay
    public final RouteConfig setComponents(JsPropertyMap components)
    {
        this.components = components;
        return this;
    }

    @JsOverlay
    public final  RouteConfig addComponent(String id,
        Class componentClass)
    {
        return this.addComponent(id, VueGWT.getFactory(componentClass));
    }

    @JsOverlay
    public final  RouteConfig addComponent(String id,
        VueFactory componentFactory)
    {
        return this.addComponent(id, componentFactory.getJsConstructor());
    }

    @JsOverlay
    public final  RouteConfig addComponent(String id,
        VueJsConstructor componentJsConstructor)
    {
        if (this.components == null)
            this.components = JsPropertyMap.of();

        this.components.set(id, componentJsConstructor);
        return this;
    }

    @JsOverlay
    public final Object getRedirect()
    {
        return redirect;
    }

    @JsOverlay
    public final RouteConfig setRedirect(Object redirect)
    {
        this.redirect = redirect;
        return this;
    }

    @JsOverlay
    public final Object getAlias()
    {
        return alias;
    }

    @JsOverlay
    public final RouteConfig setAlias(Object alias)
    {
        this.alias = alias;
        return this;
    }

    @JsOverlay
    public final Array getChildren()
    {
        return children;
    }

    @JsOverlay
    public final RouteConfig setChildren(Array children)
    {
        this.children = children;
        return this;
    }

    @JsOverlay
    public final RouteConfig addChild(RouteConfig child)
    {
        if (this.children == null)
            this.children = new Array<>();

        this.children.push(child);
        return this;
    }

    @JsOverlay
    public final Object getMeta()
    {
        return meta;
    }

    @JsOverlay
    public final RouteConfig setMeta(Object meta)
    {
        this.meta = meta;
        return this;
    }

    @JsOverlay
    public final NavigationGuard getBeforeEnter()
    {
        return beforeEnter;
    }

    @JsOverlay
    public final RouteConfig setBeforeEnter(NavigationGuard beforeEnter)
    {
        this.beforeEnter = beforeEnter;
        return this;
    }

    @JsOverlay
    public final Object getProps()
    {
        return props;
    }

    @JsOverlay
    public final RouteConfig setProps(Object props)
    {
        this.props = props;
        return this;
    }

    @JsOverlay
    public final boolean isCaseSensitive()
    {
        return caseSensitive;
    }

    @JsOverlay
    public final RouteConfig setCaseSensitive(boolean caseSensitive)
    {
        this.caseSensitive = caseSensitive;
        return this;
    }

    @JsOverlay
    public final PathToRegexpOptions getPathToRegexpOptions()
    {
        return pathToRegexpOptions;
    }

    @JsOverlay
    public final RouteConfig setPathToRegexpOptions(PathToRegexpOptions pathToRegexpOptions)
    {
        this.pathToRegexpOptions = pathToRegexpOptions;
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy