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

com.gooddata.md.Restriction Maven / Gradle / Ivy

There is a newer version: 3.11.1+api3
Show newest version
/*
 * Copyright (C) 2004-2017, GoodData(R) Corporation. All rights reserved.
 * This source code is licensed under the BSD-style license found in the
 * LICENSE.txt file in the root directory of this source tree.
 */
package com.gooddata.md;

import com.gooddata.util.GoodDataToStringBuilder;

/**
 * Metadata query restriction. See static factory methods to get instance of desired restriction type.
 */
public class Restriction {

    private final Type type;

    private final String value;

    private Restriction(Type type, String value) {
        this.type = type;
        this.value = value;
    }

    public Type getType() {
        return type;
    }

    public String getValue() {
        return value;
    }

    /**
     * Construct a new instance with restriction type identifier and given value.
     *
     * @param value identifier you want to search for
     * @return new restriction for identifier restriction
     */
    public static Restriction identifier(String value) {
        return new Restriction(Type.IDENTIFIER, value);
    }

    /**
     * Construct a new instance with restriction type title and given value.
     *
     * @param value title you want to search for
     * @return new restriction for title restriction
     */
    public static Restriction title(String value) {
        return new Restriction(Type.TITLE, value);
    }

    /**
     * Construct a new instance with restriction type summary and given value.
     *
     * @param value summary you want to search for
     * @return new restriction for summary restriction
     */
    public static Restriction summary(String value) {
        return new Restriction(Type.SUMMARY, value);
    }

    @Override
    public String toString() {
        return GoodDataToStringBuilder.defaultToString(this);
    }

    enum Type {
        IDENTIFIER, TITLE, SUMMARY
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy