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

com.linkedin.restli.common.Link Maven / Gradle / Ivy

Go to download

Pegasus is a framework for building robust, scalable service architectures using dynamic discovery and simple asychronous type-checked REST + JSON APIs.

There is a newer version: 27.7.18
Show newest version

package com.linkedin.restli.common;

import java.util.List;
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import com.linkedin.data.DataMap;
import com.linkedin.data.schema.PathSpec;
import com.linkedin.data.schema.RecordDataSchema;
import com.linkedin.data.template.DataTemplateUtil;
import com.linkedin.data.template.GetMode;
import com.linkedin.data.template.RecordTemplate;
import com.linkedin.data.template.SetMode;


/**
 * A atom:link-inspired link
 * 
 */
@Generated(value = "com.linkedin.pegasus.generator.JavaCodeUtil", comments = "Rest.li Data Template. Generated from /Users/mnchen/dev/pegasus_trunk/pegasus/restli-common/src/main/pegasus/com/linkedin/restli/common/Link.pdsc.", date = "Tue Oct 03 15:15:24 PDT 2017")
public class Link
    extends RecordTemplate
{

    private final static Link.Fields _fields = new Link.Fields();
    private final static RecordDataSchema SCHEMA = ((RecordDataSchema) DataTemplateUtil.parseSchema("{\"type\":\"record\",\"name\":\"Link\",\"namespace\":\"com.linkedin.restli.common\",\"doc\":\"A atom:link-inspired link\",\"fields\":[{\"name\":\"rel\",\"type\":\"string\",\"doc\":\"The link relation e.g. 'self' or 'next'\"},{\"name\":\"href\",\"type\":\"string\",\"doc\":\"The link URI\"},{\"name\":\"type\",\"type\":\"string\",\"doc\":\"The type (media type) of the resource\"}]}"));
    private final static RecordDataSchema.Field FIELD_Rel = SCHEMA.getField("rel");
    private final static RecordDataSchema.Field FIELD_Href = SCHEMA.getField("href");
    private final static RecordDataSchema.Field FIELD_Type = SCHEMA.getField("type");

    public Link() {
        super(new DataMap(), SCHEMA);
    }

    public Link(DataMap data) {
        super(data, SCHEMA);
    }

    public static Link.Fields fields() {
        return _fields;
    }

    /**
     * Existence checker for rel
     * 
     * @see Link.Fields#rel
     */
    public boolean hasRel() {
        return contains(FIELD_Rel);
    }

    /**
     * Remover for rel
     * 
     * @see Link.Fields#rel
     */
    public void removeRel() {
        remove(FIELD_Rel);
    }

    /**
     * Getter for rel
     * 
     * @see Link.Fields#rel
     */
    public String getRel(GetMode mode) {
        return obtainDirect(FIELD_Rel, String.class, mode);
    }

    /**
     * Getter for rel
     * 
     * @return
     *     Required field. Could be null for partial record.
     * @see Link.Fields#rel
     */
    @Nonnull
    public String getRel() {
        return obtainDirect(FIELD_Rel, String.class, GetMode.STRICT);
    }

    /**
     * Setter for rel
     * 
     * @see Link.Fields#rel
     */
    public Link setRel(String value, SetMode mode) {
        putDirect(FIELD_Rel, String.class, String.class, value, mode);
        return this;
    }

    /**
     * Setter for rel
     * 
     * @param value
     *     Must not be null. For more control, use setters with mode instead.
     * @see Link.Fields#rel
     */
    public Link setRel(
        @Nonnull
        String value) {
        putDirect(FIELD_Rel, String.class, String.class, value, SetMode.DISALLOW_NULL);
        return this;
    }

    /**
     * Existence checker for href
     * 
     * @see Link.Fields#href
     */
    public boolean hasHref() {
        return contains(FIELD_Href);
    }

    /**
     * Remover for href
     * 
     * @see Link.Fields#href
     */
    public void removeHref() {
        remove(FIELD_Href);
    }

    /**
     * Getter for href
     * 
     * @see Link.Fields#href
     */
    public String getHref(GetMode mode) {
        return obtainDirect(FIELD_Href, String.class, mode);
    }

    /**
     * Getter for href
     * 
     * @return
     *     Required field. Could be null for partial record.
     * @see Link.Fields#href
     */
    @Nonnull
    public String getHref() {
        return obtainDirect(FIELD_Href, String.class, GetMode.STRICT);
    }

    /**
     * Setter for href
     * 
     * @see Link.Fields#href
     */
    public Link setHref(String value, SetMode mode) {
        putDirect(FIELD_Href, String.class, String.class, value, mode);
        return this;
    }

    /**
     * Setter for href
     * 
     * @param value
     *     Must not be null. For more control, use setters with mode instead.
     * @see Link.Fields#href
     */
    public Link setHref(
        @Nonnull
        String value) {
        putDirect(FIELD_Href, String.class, String.class, value, SetMode.DISALLOW_NULL);
        return this;
    }

    /**
     * Existence checker for type
     * 
     * @see Link.Fields#type
     */
    public boolean hasType() {
        return contains(FIELD_Type);
    }

    /**
     * Remover for type
     * 
     * @see Link.Fields#type
     */
    public void removeType() {
        remove(FIELD_Type);
    }

    /**
     * Getter for type
     * 
     * @see Link.Fields#type
     */
    public String getType(GetMode mode) {
        return obtainDirect(FIELD_Type, String.class, mode);
    }

    /**
     * Getter for type
     * 
     * @return
     *     Required field. Could be null for partial record.
     * @see Link.Fields#type
     */
    @Nonnull
    public String getType() {
        return obtainDirect(FIELD_Type, String.class, GetMode.STRICT);
    }

    /**
     * Setter for type
     * 
     * @see Link.Fields#type
     */
    public Link setType(String value, SetMode mode) {
        putDirect(FIELD_Type, String.class, String.class, value, mode);
        return this;
    }

    /**
     * Setter for type
     * 
     * @param value
     *     Must not be null. For more control, use setters with mode instead.
     * @see Link.Fields#type
     */
    public Link setType(
        @Nonnull
        String value) {
        putDirect(FIELD_Type, String.class, String.class, value, SetMode.DISALLOW_NULL);
        return this;
    }

    @Override
    public Link clone()
        throws CloneNotSupportedException
    {
        return ((Link) super.clone());
    }

    @Override
    public Link copy()
        throws CloneNotSupportedException
    {
        return ((Link) super.copy());
    }

    public static class Fields
        extends PathSpec
    {


        public Fields(List path, String name) {
            super(path, name);
        }

        public Fields() {
            super();
        }

        /**
         * The link relation e.g. 'self' or 'next'
         * 
         */
        public PathSpec rel() {
            return new PathSpec(getPathComponents(), "rel");
        }

        /**
         * The link URI
         * 
         */
        public PathSpec href() {
            return new PathSpec(getPathComponents(), "href");
        }

        /**
         * The type (media type) of the resource
         * 
         */
        public PathSpec type() {
            return new PathSpec(getPathComponents(), "type");
        }

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy