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

com.speedment.common.tuple.TupleBuilder Maven / Gradle / Ivy

Go to download

A collection of Immutable Tuple classes that represent sets of a fixed length where every element has a specific type.

There is a newer version: 3.2.10
Show newest version
/**
 * 
 * Copyright (c) 2006-2019, Speedment, Inc. All Rights Reserved.
 * 
 * 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.speedment.common.tuple;

/**
 * This class is a Builder that can be used to build type safe Tuple of degree
 * up to 23 that can hold non-null values.
 * 

* Generated by com.speedment.sources.pattern.tuple.TupleBuilderPattern * * @author Per Minborg */ public class TupleBuilder { private Tuple current; private TupleBuilder() { this.current = Tuples.of(); } public static Builder0 builder() { return new TupleBuilder().new Builder0(); } public class Builder0 extends BaseBuilder { public Builder1 add(T0 e0) { current = Tuples.of( e0 ); return new Builder1<>(); } } public class Builder1 extends BaseBuilder> { public Builder2 add(T1 e1) { current = Tuples.of( current.get(0), e1 ); return new Builder2<>(); } } public class Builder2 extends BaseBuilder> { public Builder3 add(T2 e2) { current = Tuples.of( current.get(0), current.get(1), e2 ); return new Builder3<>(); } } public class Builder3 extends BaseBuilder> { public Builder4 add(T3 e3) { current = Tuples.of( current.get(0), current.get(1), current.get(2), e3 ); return new Builder4<>(); } } public class Builder4 extends BaseBuilder> { public Builder5 add(T4 e4) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), e4 ); return new Builder5<>(); } } public class Builder5 extends BaseBuilder> { public Builder6 add(T5 e5) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), e5 ); return new Builder6<>(); } } public class Builder6 extends BaseBuilder> { public Builder7 add(T6 e6) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), e6 ); return new Builder7<>(); } } public class Builder7 extends BaseBuilder> { public Builder8 add(T7 e7) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), current.get(6), e7 ); return new Builder8<>(); } } public class Builder8 extends BaseBuilder> { public Builder9 add(T8 e8) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), current.get(6), current.get(7), e8 ); return new Builder9<>(); } } public class Builder9 extends BaseBuilder> { public Builder10 add(T9 e9) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), current.get(6), current.get(7), current.get(8), e9 ); return new Builder10<>(); } } public class Builder10 extends BaseBuilder> { public Builder11 add(T10 e10) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), current.get(6), current.get(7), current.get(8), current.get(9), e10 ); return new Builder11<>(); } } public class Builder11 extends BaseBuilder> { public Builder12 add(T11 e11) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), current.get(6), current.get(7), current.get(8), current.get(9), current.get(10), e11 ); return new Builder12<>(); } } public class Builder12 extends BaseBuilder> { public Builder13 add(T12 e12) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), current.get(6), current.get(7), current.get(8), current.get(9), current.get(10), current.get(11), e12 ); return new Builder13<>(); } } public class Builder13 extends BaseBuilder> { public Builder14 add(T13 e13) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), current.get(6), current.get(7), current.get(8), current.get(9), current.get(10), current.get(11), current.get(12), e13 ); return new Builder14<>(); } } public class Builder14 extends BaseBuilder> { public Builder15 add(T14 e14) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), current.get(6), current.get(7), current.get(8), current.get(9), current.get(10), current.get(11), current.get(12), current.get(13), e14 ); return new Builder15<>(); } } public class Builder15 extends BaseBuilder> { public Builder16 add(T15 e15) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), current.get(6), current.get(7), current.get(8), current.get(9), current.get(10), current.get(11), current.get(12), current.get(13), current.get(14), e15 ); return new Builder16<>(); } } public class Builder16 extends BaseBuilder> { public Builder17 add(T16 e16) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), current.get(6), current.get(7), current.get(8), current.get(9), current.get(10), current.get(11), current.get(12), current.get(13), current.get(14), current.get(15), e16 ); return new Builder17<>(); } } public class Builder17 extends BaseBuilder> { public Builder18 add(T17 e17) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), current.get(6), current.get(7), current.get(8), current.get(9), current.get(10), current.get(11), current.get(12), current.get(13), current.get(14), current.get(15), current.get(16), e17 ); return new Builder18<>(); } } public class Builder18 extends BaseBuilder> { public Builder19 add(T18 e18) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), current.get(6), current.get(7), current.get(8), current.get(9), current.get(10), current.get(11), current.get(12), current.get(13), current.get(14), current.get(15), current.get(16), current.get(17), e18 ); return new Builder19<>(); } } public class Builder19 extends BaseBuilder> { public Builder20 add(T19 e19) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), current.get(6), current.get(7), current.get(8), current.get(9), current.get(10), current.get(11), current.get(12), current.get(13), current.get(14), current.get(15), current.get(16), current.get(17), current.get(18), e19 ); return new Builder20<>(); } } public class Builder20 extends BaseBuilder> { public Builder21 add(T20 e20) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), current.get(6), current.get(7), current.get(8), current.get(9), current.get(10), current.get(11), current.get(12), current.get(13), current.get(14), current.get(15), current.get(16), current.get(17), current.get(18), current.get(19), e20 ); return new Builder21<>(); } } public class Builder21 extends BaseBuilder> { public Builder22 add(T21 e21) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), current.get(6), current.get(7), current.get(8), current.get(9), current.get(10), current.get(11), current.get(12), current.get(13), current.get(14), current.get(15), current.get(16), current.get(17), current.get(18), current.get(19), current.get(20), e21 ); return new Builder22<>(); } } public class Builder22 extends BaseBuilder> { public Builder23 add(T22 e22) { current = Tuples.of( current.get(0), current.get(1), current.get(2), current.get(3), current.get(4), current.get(5), current.get(6), current.get(7), current.get(8), current.get(9), current.get(10), current.get(11), current.get(12), current.get(13), current.get(14), current.get(15), current.get(16), current.get(17), current.get(18), current.get(19), current.get(20), current.get(21), e22 ); return new Builder23<>(); } } public class Builder23 extends BaseBuilder> {} private class BaseBuilder { @SuppressWarnings("unchecked") public T build() { return (T) current; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy