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

com.kenshoo.jooq.IntIdsList Maven / Gradle / Ivy

Go to download

A Java persistence layer based on JOOQ for high performance and business flow support.

There is a newer version: 0.1.121-jooq-3.16.3
Show newest version
package com.kenshoo.jooq;

import com.google.common.base.Function;
import com.google.common.collect.Iterators;
import org.jooq.DSLContext;
import org.jooq.Field;
import org.jooq.Record;
import org.jooq.SelectConnectByStep;
import org.jooq.UpdateConditionStep;
import org.jooq.UpdateWhereStep;

import java.util.Collection;
import java.util.Iterator;

public class IntIdsList extends IdsListImpl implements IdsList {

    public IntIdsList(DSLContext dslContext) {
        super(dslContext, IdsTempTable.INT_TABLE);
    }

    public IntIdsList(DSLContext dslContext, Collection ids) {
        super(dslContext, IdsTempTable.INT_TABLE, ids);
    }

    public IdsList asLongIdsList() {
        return new AsLongIdsList();
    }

    private class AsLongIdsList implements IdsList {
        private IdsList delegate = IntIdsList.this;

        @Override
        public void add(Long id) {
            throw new UnsupportedOperationException("Adding IDs to int list wrapper is not allowed");
        }

        @Override
        public void addAll(Collection ids) {
            throw new UnsupportedOperationException("Adding IDs to int list wrapper is not allowed");
        }

        @Override
        public boolean isEmpty() {
            return delegate.isEmpty();
        }

        @Override
        public Iterator iterator() {
            return Iterators.transform(delegate.iterator(), new Function() {
                @Override
                public Long apply(Integer input) {
                    return (long) input;
                }
            });
        }

        @Override
        public void close() {
            throw new UnsupportedOperationException("Closing int list wrapper is not allowed");
        }

        @Override
        public , FT> S imposeOnQuery(S query, Field idField) {
            return delegate.imposeOnQuery(query, idField);
        }

        @Override
        public , FT> UpdateConditionStep imposeOnUpdate(S update, Field idField) {
            return delegate.imposeOnUpdate(update, idField);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy