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

org.xlcloud.openstack.api.Query Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2012 AMG.lab, a Bull Group Company
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.xlcloud.openstack.api;

import javax.xml.bind.annotation.XmlAttribute;

import com.fasterxml.jackson.annotation.JsonValue;


/**
 * @author Andrzej Stasiak, AMG.net
 *
 */
public class Query {
    
    public enum Operator {
        LT("lt"),
        LE("le"),
        EQ("eq"),
        NE("ne"),
        GT("gt"),
        GE("ge");
        
        private final String value;

        private Operator(String v) {
            value = v;
        }

        @JsonValue
        public String value() {
            return value;
        }

        public static Operator fromValue(String v) {
            for (Operator c: Operator.values()) {
                if (c.value.equals(v)) {
                    return c;
                }
            }
            throw new IllegalArgumentException(v);
        }
        
        public String toString() {
            return value;
        }
    }
    
    @XmlAttribute
    private String field;
    
    @XmlAttribute
    private Operator op;
    
    @XmlAttribute
    private String type;
    
    @XmlAttribute
    private String value;
    
    public Query(String field, Operator op, String type, String value) {
        super();
        this.field = field;
        this.op = op;
        this.type = type;
        this.value = value;
    }
    
    /**
     * @return the field
     */
    public String getField() {
        return field;
    }
    /**
     * @param field the field to set
     */
    public void setField(String field) {
        this.field = field;
    }
    /**
     * @return the op
     */
    public Operator getOp() {
        return op;
    }
    /**
     * @param op the op to set
     */
    public void setOp(Operator op) {
        this.op = op;
    }
    /**
     * @return the type
     */
    public String getType() {
        return type;
    }
    /**
     * @param type the type to set
     */
    public void setType(String type) {
        this.type = type;
    }
    /**
     * @return the value
     */
    public String getValue() {
        return value;
    }
    /**
     * @param value the value to set
     */
    public void setValue(String value) {
        this.value = value;
    }
    
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy