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

com.mongodb.operation.BsonArrayWrapper Maven / Gradle / Ivy

Go to download

The MongoDB Java Driver uber-artifact, containing the legacy driver, the mongodb-driver, mongodb-driver-core, and bson

There is a newer version: 3.12.14
Show newest version
/*
 * Copyright 2008-present MongoDB, Inc.
 *
 * 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 com.mongodb.operation;

import org.bson.BsonArray;
import org.bson.BsonValue;

import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

import static org.bson.assertions.Assertions.notNull;


class BsonArrayWrapper extends BsonArray {

    private final List wrappedArray;

    BsonArrayWrapper(final List wrappedArray) {
        this.wrappedArray = notNull("wrappedArray", wrappedArray);
    }

    /**
     * Get the wrapped array.
     *
     * @return the wrapped array
     */
    public List getWrappedArray() {
        return wrappedArray;
    }

    @Override
    public List getValues() {
        throw new UnsupportedOperationException();
    }

    @Override
    public int size() {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean isEmpty() {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean contains(final Object o) {
        throw new UnsupportedOperationException();
    }

    @Override
    public Iterator iterator() {
        throw new UnsupportedOperationException();
    }

    @Override
    public Object[] toArray() {
        throw new UnsupportedOperationException();
    }

    @Override
    public  T[] toArray(final T[] a) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean add(final BsonValue bsonValue) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean remove(final Object o) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean containsAll(final Collection c) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean addAll(final Collection c) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean addAll(final int index, final Collection c) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean removeAll(final Collection c) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean retainAll(final Collection c) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void clear() {
        throw new UnsupportedOperationException();
    }

    @Override
    public BsonValue get(final int index) {
        throw new UnsupportedOperationException();
    }

    @Override
    public BsonValue set(final int index, final BsonValue element) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void add(final int index, final BsonValue element) {
        throw new UnsupportedOperationException();
    }

    @Override
    public BsonValue remove(final int index) {
        throw new UnsupportedOperationException();
    }

    @Override
    public int indexOf(final Object o) {
        throw new UnsupportedOperationException();
    }

    @Override
    public int lastIndexOf(final Object o) {
        throw new UnsupportedOperationException();
    }

    @Override
    public ListIterator listIterator() {
        throw new UnsupportedOperationException();
    }

    @Override
    public ListIterator listIterator(final int index) {
        throw new UnsupportedOperationException();
    }

    @Override
    public List subList(final int fromIndex, final int toIndex) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        BsonArrayWrapper that = (BsonArrayWrapper) o;
        if (!wrappedArray.equals(that.wrappedArray)) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + wrappedArray.hashCode();
        return result;
    }

    @Override
    public String toString() {
        return "BsonArrayWrapper{"
                + "wrappedArray=" + wrappedArray
                + '}';
    }

    @Override
    public BsonArray clone() {
        throw new UnsupportedOperationException("This should never be called on an instance of this type");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy