Android Open Source - loopback-sdk-android Rest Contract Item






From Project

Back to project page loopback-sdk-android.

License

The source code is released under:

MIT License

If you think the Android project loopback-sdk-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.strongloop.android.remoting.adapters;
/*from   w ww  .j  a v  a2 s .  com*/
/**
 * A single item within a larger SLRESTContract, encapsulation a single route's
 * verb and pattern, e.g. GET /widgets/:id.
 */
public class RestContractItem {

    private final String pattern;
    private final String verb;
    private final RestAdapter.ParameterEncoding parameterEncoding;

    /**
     * Creates a new item encapsulating the given pattern and the default verb,
     * <code>"POST"</code>.
     * @param pattern The pattern corresponding to this route, e.g.
     * <code>"/widgets/:id"</code>.
     */
    public RestContractItem(String pattern) {
        this(pattern, "POST");
    }

    /**
     * Creates a new item encapsulating the given pattern and verb.
     * @param pattern The pattern corresponding to this route, e.g.
     * <code>"/widgets/:id"</code>.
     * @param verb The verb corresponding to this route, e.g.
     * <code>"GET"</code>.
     */
    public RestContractItem(String pattern, String verb) {
        this(pattern, verb, RestAdapter.ParameterEncoding.JSON);
    }

    /**
     * Creates a new item encapsulating a route that expects multi-part request
     * (e.g. file upload).
     * @param pattern The pattern corresponding to this route, e.g.
     * <code>"/files/:id"</code>.
     * @param verb The verb corresponding to this route, e.g.
     * <code>"POST"</code>.
     * @return The RestContractItem created.
     */
    public static RestContractItem createMultipart(String pattern, String verb) {
        return new RestContractItem(pattern, verb,
                RestAdapter.ParameterEncoding.FORM_MULTIPART);
    }

    private RestContractItem(String pattern,
                             String verb,
                             RestAdapter.ParameterEncoding parameterEncoding) {
        this.pattern = pattern;
        this.verb = verb;
        this.parameterEncoding = parameterEncoding;
    }

    /**
     * Gets the pattern corresponding to this route, e.g.
     * <code>"/widgets/:id"</code>.
     * @return the pattern.
     */
    public String getPattern() {
        return pattern;
    }

    /**
     * Gets the verb corresponding to this route, e.g. <code>"GET"</code>.
     * @return the verb.
     */
    public String getVerb() {
        return verb;
    }

    /**
     * Gets a boolean that indicates if the item is a multipart form mime type.
     * @return true if the item is multipart
     */
    public RestAdapter.ParameterEncoding getParameterEncoding() {
        return parameterEncoding;
    }
}




Java Source Code List

com.strongloop.android.loopback.AccessTokenRepository.java
com.strongloop.android.loopback.AccessToken.java
com.strongloop.android.loopback.ContainerRepository.java
com.strongloop.android.loopback.Container.java
com.strongloop.android.loopback.FileRepository.java
com.strongloop.android.loopback.File.java
com.strongloop.android.loopback.LocalInstallation.java
com.strongloop.android.loopback.ModelRepository.java
com.strongloop.android.loopback.Model.java
com.strongloop.android.loopback.RestAdapter.java
com.strongloop.android.loopback.RestRepository.java
com.strongloop.android.loopback.UserRepository.java
com.strongloop.android.loopback.User.java
com.strongloop.android.loopback.callbacks.EmptyResponseParser.java
com.strongloop.android.loopback.callbacks.JsonArrayParser.java
com.strongloop.android.loopback.callbacks.JsonObjectParser.java
com.strongloop.android.loopback.callbacks.ListCallback.java
com.strongloop.android.loopback.callbacks.ObjectCallback.java
com.strongloop.android.loopback.callbacks.VoidCallback.java
com.strongloop.android.remoting.BeanUtil.java
com.strongloop.android.remoting.JsonUtil.java
com.strongloop.android.remoting.Repository.java
com.strongloop.android.remoting.Transient.java
com.strongloop.android.remoting.VirtualObject.java
com.strongloop.android.remoting.adapters.Adapter.java
com.strongloop.android.remoting.adapters.RestAdapter.java
com.strongloop.android.remoting.adapters.RestContractItem.java
com.strongloop.android.remoting.adapters.RestContract.java
com.strongloop.android.remoting.adapters.StreamParam.java