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

net.ucanaccess.complex.SingleValue Maven / Gradle / Ivy

Go to download

An open source pure Java JDBC Driver implementation which allows Java developers and JDBC client programs (e.g., Open Office, Libre Office, Squirrel SQL) to read/write Microsoft Access databases.

There is a newer version: 5.0.1
Show newest version
/*
Copyright (c) 2012 Marco Amadei.

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 net.ucanaccess.complex;

import com.healthmarketscience.jackcess.complex.ComplexValue;

public class SingleValue extends ComplexBase {

    private static final long serialVersionUID = 1L;
    private Object            value;

    public SingleValue(com.healthmarketscience.jackcess.complex.SingleValue cv) {
        super(cv);
        this.value = cv.get();
    }

    public SingleValue(ComplexValue.Id id, String tableName, String columnName, String _value) {
        super(id, tableName, columnName);
        this.value = _value;
    }

    public SingleValue(String _value) {
        this(CREATE_ID, null, null, _value);

    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        SingleValue other = (SingleValue) obj;
        if (value == null) {
            if (other.value != null) {
                return false;
            }
        } else if (!value.equals(other.value)) {
            return false;
        }
        return true;
    }

    public Object getValue() {
        return value;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();
        result = prime * result + ((value == null) ? 0 : value.hashCode());
        return result;
    }

    public void setValue(Object _value) {
        this.value = _value;
    }

    @Override
    public String toString() {
        return "SingleValue [value=" + value + "]";
    }

    public static SingleValue[] multipleValue(String... rv) {
        SingleValue[] sv = new SingleValue[rv.length];
        for (int j = 0; j < rv.length; j++) {
            sv[j] = new SingleValue(rv[j]);
        }
        return sv;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy