From 55c3074739b6530303a2d06f87fc7e793893de33 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Mon, 5 May 2014 15:14:42 +0200 Subject: [PATCH] [#3111] Support multiple Converters for the same type in the code generator --- jOOQ-test/pom.xml | 32 +++ .../test/java/org/jooq/test/PostgresTest.java | 55 ++++ .../_/converters/T_3111_Bool1Converter.java | 77 ++++++ .../_/converters/T_3111_Bool2Converter.java | 77 ++++++ .../_/converters/T_3111_InverseConverter.java | 71 ++++++ .../java/org/jooq/test/postgres/create.sql | 11 + .../test/postgres/generatedclasses/Keys.java | 2 + .../postgres/generatedclasses/Public.java | 3 +- .../postgres/generatedclasses/Tables.java | 5 + .../generatedclasses/tables/T_3111.java | 99 ++++++++ .../tables/interfaces/IT_3111.java | 31 +++ .../generatedclasses/tables/pojos/T_3111.java | 50 ++++ .../tables/records/T_3111Record.java | 240 ++++++++++++++++++ .../configuration/lukas/postgres/library.xml | 32 +++ 14 files changed, 784 insertions(+), 1 deletion(-) create mode 100644 jOOQ-test/src/test/java/org/jooq/test/_/converters/T_3111_Bool1Converter.java create mode 100644 jOOQ-test/src/test/java/org/jooq/test/_/converters/T_3111_Bool2Converter.java create mode 100644 jOOQ-test/src/test/java/org/jooq/test/_/converters/T_3111_InverseConverter.java create mode 100644 jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/tables/T_3111.java create mode 100644 jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/tables/interfaces/IT_3111.java create mode 100644 jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/tables/pojos/T_3111.java create mode 100644 jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/tables/records/T_3111Record.java diff --git a/jOOQ-test/pom.xml b/jOOQ-test/pom.xml index 10dd4afd00..817ff22e51 100644 --- a/jOOQ-test/pom.xml +++ b/jOOQ-test/pom.xml @@ -465,6 +465,22 @@ false true + + 3111_INVERSE + java.lang.Integer + org.jooq.test._.converters.T_3111_InverseConverter + + + 3111_BOOL1 + java.lang.Integer + org.jooq.test._.converters.T_3111_Bool1Converter + + + 3111_BOOL2 + java.lang.Integer + org.jooq.test._.converters.T_3111_Bool2Converter + + B10 org.jooq.test._.converters.Boolean_10 @@ -497,6 +513,22 @@ + + + + 3111_INVERSE + (?i:(.*?\.)?T_3111\.INVERSE) + + + 3111_BOOL1 + (?i:(.*?\.)?T_3111\.BOOL1) + + + 3111_BOOL2 + (?i:(.*?\.)?T_3111\.BOOL2) + + + BOOLEAN (?i:(.*?.)?T_BOOLEANS.(VC|C|N)_BOOLEAN) diff --git a/jOOQ-test/src/test/java/org/jooq/test/PostgresTest.java b/jOOQ-test/src/test/java/org/jooq/test/PostgresTest.java index 6ffe20181c..25b962811d 100644 --- a/jOOQ-test/src/test/java/org/jooq/test/PostgresTest.java +++ b/jOOQ-test/src/test/java/org/jooq/test/PostgresTest.java @@ -43,12 +43,14 @@ package org.jooq.test; import static java.util.Arrays.asList; import static org.jooq.conf.StatementType.STATIC_STATEMENT; +import static org.jooq.impl.DSL.field; import static org.jooq.impl.DSL.inline; import static org.jooq.impl.DSL.name; import static org.jooq.impl.DSL.select; import static org.jooq.impl.DSL.selectOne; import static org.jooq.impl.DSL.val; import static org.jooq.test.postgres.generatedclasses.Routines.fSearchBook; +import static org.jooq.test.postgres.generatedclasses.Tables.T_3111; import static org.jooq.test.postgres.generatedclasses.Tables.T_639_NUMBERS_TABLE; import static org.jooq.test.postgres.generatedclasses.Tables.T_725_LOB_TEST; import static org.jooq.test.postgres.generatedclasses.Tables.T_785; @@ -94,6 +96,7 @@ import org.jooq.Name; import org.jooq.Param; import org.jooq.Record; import org.jooq.Record1; +import org.jooq.Record3; import org.jooq.Record5; import org.jooq.Result; import org.jooq.SQLDialect; @@ -131,6 +134,7 @@ import org.jooq.test.postgres.generatedclasses.tables.records.TIdentityRecord; import org.jooq.test.postgres.generatedclasses.tables.records.TPgExtensionsRecord; import org.jooq.test.postgres.generatedclasses.tables.records.TTriggersRecord; import org.jooq.test.postgres.generatedclasses.tables.records.TUnsignedRecord; +import org.jooq.test.postgres.generatedclasses.tables.records.T_3111Record; import org.jooq.test.postgres.generatedclasses.tables.records.T_639NumbersTableRecord; import org.jooq.test.postgres.generatedclasses.tables.records.T_725LobTestRecord; import org.jooq.test.postgres.generatedclasses.tables.records.T_785Record; @@ -1224,4 +1228,55 @@ public class PostgresTest extends jOOQAbstractTest< assertEquals(1, countries.get(3).length); assertEquals(UCountry.Brazil, countries.get(3)[0]); } + + @Test + public void testPostgresMultipleConvertersForJavaLangInteger() { + try { + T_3111Record record; + + record = create().newRecord(T_3111); + record.setId(1); + assertEquals(1, record.store()); + + record = create().newRecord(T_3111); + record.setId(2); + record.setInverse(0); + record.setBool1(0); + record.setBool2(0); + assertEquals(1, record.store()); + + record = create().newRecord(T_3111); + record.setId(3); + record.setInverse(1); + record.setBool1(1); + record.setBool2(-1); + assertEquals(1, record.store()); + + Result> r1 = + create().select(T_3111.INVERSE, T_3111.BOOL1, T_3111.BOOL2) + .from(T_3111) + .orderBy(T_3111.ID) + .fetch(); + + assertEquals(3, r1.size()); + assertEquals(asList(null, 0, 1), r1.getValues(T_3111.INVERSE)); + assertEquals(asList(null, 0, 1), r1.getValues(T_3111.BOOL1)); + assertEquals(asList(null, 0, -1), r1.getValues(T_3111.BOOL2)); + + // Check if actual data in database are the correct boolean values: + Result r2 = + create().select(field("inverse"), field("bool1"), field("bool2")) + .from("t_3111") + .orderBy(field("id")) + .fetch(); + + assertEquals(3, r2.size()); + assertEquals(asList(null, 0, -1), r2.getValues(0)); + assertEquals(asList(null, false, true), r2.getValues(1)); + assertEquals(asList(null, false, true), r2.getValues(2)); + } + finally { + create().delete(T_3111).execute(); + } + } } diff --git a/jOOQ-test/src/test/java/org/jooq/test/_/converters/T_3111_Bool1Converter.java b/jOOQ-test/src/test/java/org/jooq/test/_/converters/T_3111_Bool1Converter.java new file mode 100644 index 0000000000..0d514c2644 --- /dev/null +++ b/jOOQ-test/src/test/java/org/jooq/test/_/converters/T_3111_Bool1Converter.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) + * All rights reserved. + * + * This work is dual-licensed + * - under the Apache Software License 2.0 (the "ASL") + * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") + * ============================================================================= + * You may choose which license applies to you: + * + * - If you're using this work with Open Source databases, you may choose + * either ASL or jOOQ License. + * - If you're using this work with at least one commercial database, you must + * choose jOOQ License + * + * For more information, please visit http://www.jooq.org/licenses + * + * Apache Software License 2.0: + * ----------------------------------------------------------------------------- + * 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. + * + * jOOQ License and Maintenance Agreement: + * ----------------------------------------------------------------------------- + * Data Geekery grants the Customer the non-exclusive, timely limited and + * non-transferable license to install and use the Software under the terms of + * the jOOQ License and Maintenance Agreement. + * + * This library is distributed with a LIMITED WARRANTY. See the jOOQ License + * and Maintenance Agreement for more details: http://www.jooq.org/licensing + */ +package org.jooq.test._.converters; + +import org.jooq.Converter; + +/** + * A converter that converts boolean database columns into 1/0 Java values. + * + * @author Lukas Eder + */ +public class T_3111_Bool1Converter implements Converter { + + /** + * Generated UID + */ + private static final long serialVersionUID = 7738949966475457017L; + + @Override + public Integer from(Boolean t) { + return t == null ? null : t ? 1 : 0; + } + + @Override + public Boolean to(Integer u) { + return u == null ? null : u == 1; + } + + @Override + public Class fromType() { + return Boolean.class; + } + + @Override + public Class toType() { + return Integer.class; + } + +} diff --git a/jOOQ-test/src/test/java/org/jooq/test/_/converters/T_3111_Bool2Converter.java b/jOOQ-test/src/test/java/org/jooq/test/_/converters/T_3111_Bool2Converter.java new file mode 100644 index 0000000000..67a6c3d0c5 --- /dev/null +++ b/jOOQ-test/src/test/java/org/jooq/test/_/converters/T_3111_Bool2Converter.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) + * All rights reserved. + * + * This work is dual-licensed + * - under the Apache Software License 2.0 (the "ASL") + * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") + * ============================================================================= + * You may choose which license applies to you: + * + * - If you're using this work with Open Source databases, you may choose + * either ASL or jOOQ License. + * - If you're using this work with at least one commercial database, you must + * choose jOOQ License + * + * For more information, please visit http://www.jooq.org/licenses + * + * Apache Software License 2.0: + * ----------------------------------------------------------------------------- + * 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. + * + * jOOQ License and Maintenance Agreement: + * ----------------------------------------------------------------------------- + * Data Geekery grants the Customer the non-exclusive, timely limited and + * non-transferable license to install and use the Software under the terms of + * the jOOQ License and Maintenance Agreement. + * + * This library is distributed with a LIMITED WARRANTY. See the jOOQ License + * and Maintenance Agreement for more details: http://www.jooq.org/licensing + */ +package org.jooq.test._.converters; + +import org.jooq.Converter; + +/** + * A converter that converts boolean database columns into -1/0 Java values. + * + * @author Lukas Eder + */ + +public class T_3111_Bool2Converter implements Converter { + + /** + * Generated UID + */ + private static final long serialVersionUID = -4817801645513273720L; + + @Override + public Integer from(Boolean t) { + return t == null ? null : t ? -1 : 0; + } + + @Override + public Boolean to(Integer u) { + return u == null ? null : u == -1; + } + + @Override + public Class fromType() { + return Boolean.class; + } + + @Override + public Class toType() { + return Integer.class; + } +} diff --git a/jOOQ-test/src/test/java/org/jooq/test/_/converters/T_3111_InverseConverter.java b/jOOQ-test/src/test/java/org/jooq/test/_/converters/T_3111_InverseConverter.java new file mode 100644 index 0000000000..351cd42643 --- /dev/null +++ b/jOOQ-test/src/test/java/org/jooq/test/_/converters/T_3111_InverseConverter.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) + * All rights reserved. + * + * This work is dual-licensed + * - under the Apache Software License 2.0 (the "ASL") + * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") + * ============================================================================= + * You may choose which license applies to you: + * + * - If you're using this work with Open Source databases, you may choose + * either ASL or jOOQ License. + * - If you're using this work with at least one commercial database, you must + * choose jOOQ License + * + * For more information, please visit http://www.jooq.org/licenses + * + * Apache Software License 2.0: + * ----------------------------------------------------------------------------- + * 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. + * + * jOOQ License and Maintenance Agreement: + * ----------------------------------------------------------------------------- + * Data Geekery grants the Customer the non-exclusive, timely limited and + * non-transferable license to install and use the Software under the terms of + * the jOOQ License and Maintenance Agreement. + * + * This library is distributed with a LIMITED WARRANTY. See the jOOQ License + * and Maintenance Agreement for more details: http://www.jooq.org/licensing + */ +package org.jooq.test._.converters; + +import org.jooq.Converter; + +public class T_3111_InverseConverter implements Converter { + + /** + * Generated UID + */ + private static final long serialVersionUID = 5022623086597770262L; + + @Override + public Integer from(Integer t) { + return t == null ? null : -t; + } + + @Override + public Integer to(Integer u) { + return from(u); + } + + @Override + public Class fromType() { + return Integer.class; + } + + @Override + public Class toType() { + return fromType(); + } +} diff --git a/jOOQ-test/src/test/java/org/jooq/test/postgres/create.sql b/jOOQ-test/src/test/java/org/jooq/test/postgres/create.sql index 1ae7dbfe29..bf0fdd6460 100644 --- a/jOOQ-test/src/test/java/org/jooq/test/postgres/create.sql +++ b/jOOQ-test/src/test/java/org/jooq/test/postgres/create.sql @@ -70,6 +70,7 @@ DROP TABLE IF EXISTS t_inheritance_1_2/ DROP TABLE IF EXISTS t_inheritance_1_1/ DROP TABLE IF EXISTS t_inheritance_1/ DROP TABLE IF EXISTS t_2781/ +DROP TABLE IF EXISTS t_3111/ DROP TYPE IF EXISTS u_address_type/ DROP TYPE IF EXISTS u_street_type/ @@ -116,6 +117,16 @@ CREATE TYPE u_address_type AS ( ) / +CREATE TABLE t_3111 ( + id int, + inverse int, + bool1 boolean, + bool2 boolean, + + CONSTRAINT pk_t_3111 PRIMARY KEY (id) +) +/ + CREATE TABLE t_2781 ( org text, jooq text diff --git a/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/Keys.java b/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/Keys.java index 76eb30a04e..c959c00ab3 100644 --- a/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/Keys.java +++ b/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/Keys.java @@ -25,6 +25,7 @@ public class Keys { // UNIQUE and PRIMARY KEY definitions // ------------------------------------------------------------------------- + public static final org.jooq.UniqueKey PK_T_3111 = UniqueKeys0.PK_T_3111; public static final org.jooq.UniqueKey PK_T_639_NUMBERS_TABLE = UniqueKeys0.PK_T_639_NUMBERS_TABLE; public static final org.jooq.UniqueKey PK_T_725_LOB_TEST = UniqueKeys0.PK_T_725_LOB_TEST; public static final org.jooq.UniqueKey PK_T_ARRAYS = UniqueKeys0.PK_T_ARRAYS; @@ -77,6 +78,7 @@ public class Keys { } private static class UniqueKeys0 extends org.jooq.impl.AbstractKeys { + public static final org.jooq.UniqueKey PK_T_3111 = createUniqueKey(org.jooq.test.postgres.generatedclasses.tables.T_3111.T_3111, org.jooq.test.postgres.generatedclasses.tables.T_3111.T_3111.ID); public static final org.jooq.UniqueKey PK_T_639_NUMBERS_TABLE = createUniqueKey(org.jooq.test.postgres.generatedclasses.tables.T_639NumbersTable.T_639_NUMBERS_TABLE, org.jooq.test.postgres.generatedclasses.tables.T_639NumbersTable.T_639_NUMBERS_TABLE.ID); public static final org.jooq.UniqueKey PK_T_725_LOB_TEST = createUniqueKey(org.jooq.test.postgres.generatedclasses.tables.T_725LobTest.T_725_LOB_TEST, org.jooq.test.postgres.generatedclasses.tables.T_725LobTest.T_725_LOB_TEST.ID); public static final org.jooq.UniqueKey PK_T_ARRAYS = createUniqueKey(org.jooq.test.postgres.generatedclasses.tables.TArrays.T_ARRAYS, org.jooq.test.postgres.generatedclasses.tables.TArrays.T_ARRAYS.ID); diff --git a/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/Public.java b/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/Public.java index d83a84be7f..78bcfced66 100644 --- a/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/Public.java +++ b/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/Public.java @@ -9,7 +9,7 @@ package org.jooq.test.postgres.generatedclasses; @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Public extends org.jooq.impl.SchemaImpl { - private static final long serialVersionUID = -424292889; + private static final long serialVersionUID = 1407093112; /** * The singleton instance of public @@ -45,6 +45,7 @@ public class Public extends org.jooq.impl.SchemaImpl { private final java.util.List> getTables0() { return java.util.Arrays.>asList( org.jooq.test.postgres.generatedclasses.tables.T_2781.T_2781, + org.jooq.test.postgres.generatedclasses.tables.T_3111.T_3111, org.jooq.test.postgres.generatedclasses.tables.T_639NumbersTable.T_639_NUMBERS_TABLE, org.jooq.test.postgres.generatedclasses.tables.T_725LobTest.T_725_LOB_TEST, org.jooq.test.postgres.generatedclasses.tables.T_785.T_785, diff --git a/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/Tables.java b/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/Tables.java index 07cc19d7f6..6049297d6e 100644 --- a/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/Tables.java +++ b/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/Tables.java @@ -16,6 +16,11 @@ public class Tables { */ public static final org.jooq.test.postgres.generatedclasses.tables.T_2781 T_2781 = org.jooq.test.postgres.generatedclasses.tables.T_2781.T_2781; + /** + * The table public.t_3111 + */ + public static final org.jooq.test.postgres.generatedclasses.tables.T_3111 T_3111 = org.jooq.test.postgres.generatedclasses.tables.T_3111.T_3111; + /** * The table public.t_639_numbers_table */ diff --git a/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/tables/T_3111.java b/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/tables/T_3111.java new file mode 100644 index 0000000000..a76a1ef391 --- /dev/null +++ b/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/tables/T_3111.java @@ -0,0 +1,99 @@ +/** + * This class is generated by jOOQ + */ +package org.jooq.test.postgres.generatedclasses.tables; + +/** + * This class is generated by jOOQ. + */ +@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class T_3111 extends org.jooq.impl.TableImpl { + + private static final long serialVersionUID = -768298040; + + /** + * The singleton instance of public.t_3111 + */ + public static final org.jooq.test.postgres.generatedclasses.tables.T_3111 T_3111 = new org.jooq.test.postgres.generatedclasses.tables.T_3111(); + + /** + * The class holding records for this type + */ + @Override + public java.lang.Class getRecordType() { + return org.jooq.test.postgres.generatedclasses.tables.records.T_3111Record.class; + } + + /** + * The column public.t_3111.id. + */ + public final org.jooq.TableField ID = createField("id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column public.t_3111.inverse. + */ + public final org.jooq.TableField INVERSE = createField("inverse", org.jooq.impl.SQLDataType.INTEGER, this, "", new org.jooq.test._.converters.T_3111_InverseConverter()); + + /** + * The column public.t_3111.bool1. + */ + public final org.jooq.TableField BOOL1 = createField("bool1", org.jooq.impl.SQLDataType.BOOLEAN, this, "", new org.jooq.test._.converters.T_3111_Bool1Converter()); + + /** + * The column public.t_3111.bool2. + */ + public final org.jooq.TableField BOOL2 = createField("bool2", org.jooq.impl.SQLDataType.BOOLEAN, this, "", new org.jooq.test._.converters.T_3111_Bool2Converter()); + + /** + * Create a public.t_3111 table reference + */ + public T_3111() { + this("t_3111", null); + } + + /** + * Create an aliased public.t_3111 table reference + */ + public T_3111(java.lang.String alias) { + this(alias, org.jooq.test.postgres.generatedclasses.tables.T_3111.T_3111); + } + + private T_3111(java.lang.String alias, org.jooq.Table aliased) { + this(alias, aliased, null); + } + + private T_3111(java.lang.String alias, org.jooq.Table aliased, org.jooq.Field[] parameters) { + super(alias, org.jooq.test.postgres.generatedclasses.Public.PUBLIC, aliased, parameters, ""); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.UniqueKey getPrimaryKey() { + return org.jooq.test.postgres.generatedclasses.Keys.PK_T_3111; + } + + /** + * {@inheritDoc} + */ + @Override + public java.util.List> getKeys() { + return java.util.Arrays.>asList(org.jooq.test.postgres.generatedclasses.Keys.PK_T_3111); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.test.postgres.generatedclasses.tables.T_3111 as(java.lang.String alias) { + return new org.jooq.test.postgres.generatedclasses.tables.T_3111(alias, this); + } + + /** + * Rename this table + */ + public org.jooq.test.postgres.generatedclasses.tables.T_3111 rename(java.lang.String name) { + return new org.jooq.test.postgres.generatedclasses.tables.T_3111(name, null); + } +} diff --git a/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/tables/interfaces/IT_3111.java b/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/tables/interfaces/IT_3111.java new file mode 100644 index 0000000000..843a20ae84 --- /dev/null +++ b/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/tables/interfaces/IT_3111.java @@ -0,0 +1,31 @@ +/** + * This class is generated by jOOQ + */ +package org.jooq.test.postgres.generatedclasses.tables.interfaces; + +/** + * This class is generated by jOOQ. + */ +@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public interface IT_3111 extends java.io.Serializable { + + /** + * Getter for public.t_3111.id. + */ + public java.lang.Integer getId(); + + /** + * Getter for public.t_3111.inverse. + */ + public java.lang.Integer getInverse(); + + /** + * Getter for public.t_3111.bool1. + */ + public java.lang.Integer getBool1(); + + /** + * Getter for public.t_3111.bool2. + */ + public java.lang.Integer getBool2(); +} diff --git a/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/tables/pojos/T_3111.java b/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/tables/pojos/T_3111.java new file mode 100644 index 0000000000..cb761fe990 --- /dev/null +++ b/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/tables/pojos/T_3111.java @@ -0,0 +1,50 @@ +/** + * This class is generated by jOOQ + */ +package org.jooq.test.postgres.generatedclasses.tables.pojos; + +/** + * This class is generated by jOOQ. + */ +@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class T_3111 implements org.jooq.test.postgres.generatedclasses.tables.interfaces.IT_3111 { + + private static final long serialVersionUID = 731898893; + + private final java.lang.Integer id; + private final java.lang.Integer inverse; + private final java.lang.Integer bool1; + private final java.lang.Integer bool2; + + public T_3111( + java.lang.Integer id, + java.lang.Integer inverse, + java.lang.Integer bool1, + java.lang.Integer bool2 + ) { + this.id = id; + this.inverse = inverse; + this.bool1 = bool1; + this.bool2 = bool2; + } + + @Override + public java.lang.Integer getId() { + return this.id; + } + + @Override + public java.lang.Integer getInverse() { + return this.inverse; + } + + @Override + public java.lang.Integer getBool1() { + return this.bool1; + } + + @Override + public java.lang.Integer getBool2() { + return this.bool2; + } +} diff --git a/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/tables/records/T_3111Record.java b/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/tables/records/T_3111Record.java new file mode 100644 index 0000000000..7a3f47733c --- /dev/null +++ b/jOOQ-test/src/test/java/org/jooq/test/postgres/generatedclasses/tables/records/T_3111Record.java @@ -0,0 +1,240 @@ +/** + * This class is generated by jOOQ + */ +package org.jooq.test.postgres.generatedclasses.tables.records; + +/** + * This class is generated by jOOQ. + */ +@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class T_3111Record extends org.jooq.impl.UpdatableRecordImpl implements org.jooq.Record4, org.jooq.test.postgres.generatedclasses.tables.interfaces.IT_3111 { + + private static final long serialVersionUID = -1992016764; + + /** + * Setter for public.t_3111.id. + */ + public T_3111Record setId(java.lang.Integer value) { + setValue(0, value); + return this; + } + + /** + * Getter for public.t_3111.id. + */ + @Override + public java.lang.Integer getId() { + return (java.lang.Integer) getValue(0); + } + + /** + * Setter for public.t_3111.inverse. + */ + public T_3111Record setInverse(java.lang.Integer value) { + setValue(1, value); + return this; + } + + /** + * Getter for public.t_3111.inverse. + */ + @Override + public java.lang.Integer getInverse() { + return (java.lang.Integer) getValue(1); + } + + /** + * Setter for public.t_3111.bool1. + */ + public T_3111Record setBool1(java.lang.Integer value) { + setValue(2, value); + return this; + } + + /** + * Getter for public.t_3111.bool1. + */ + @Override + public java.lang.Integer getBool1() { + return (java.lang.Integer) getValue(2); + } + + /** + * Setter for public.t_3111.bool2. + */ + public T_3111Record setBool2(java.lang.Integer value) { + setValue(3, value); + return this; + } + + /** + * Getter for public.t_3111.bool2. + */ + @Override + public java.lang.Integer getBool2() { + return (java.lang.Integer) getValue(3); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Record1 key() { + return (org.jooq.Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record4 type implementation + // ------------------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Row4 fieldsRow() { + return (org.jooq.Row4) super.fieldsRow(); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Row4 valuesRow() { + return (org.jooq.Row4) super.valuesRow(); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field1() { + return org.jooq.test.postgres.generatedclasses.tables.T_3111.T_3111.ID; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field2() { + return org.jooq.test.postgres.generatedclasses.tables.T_3111.T_3111.INVERSE; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field3() { + return org.jooq.test.postgres.generatedclasses.tables.T_3111.T_3111.BOOL1; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field4() { + return org.jooq.test.postgres.generatedclasses.tables.T_3111.T_3111.BOOL2; + } + + /** + * {@inheritDoc} + */ + @Override + public java.lang.Integer value1() { + return getId(); + } + + /** + * {@inheritDoc} + */ + @Override + public java.lang.Integer value2() { + return getInverse(); + } + + /** + * {@inheritDoc} + */ + @Override + public java.lang.Integer value3() { + return getBool1(); + } + + /** + * {@inheritDoc} + */ + @Override + public java.lang.Integer value4() { + return getBool2(); + } + + /** + * {@inheritDoc} + */ + @Override + public T_3111Record value1(java.lang.Integer value) { + setId(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public T_3111Record value2(java.lang.Integer value) { + setInverse(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public T_3111Record value3(java.lang.Integer value) { + setBool1(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public T_3111Record value4(java.lang.Integer value) { + setBool2(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public T_3111Record values(java.lang.Integer value1, java.lang.Integer value2, java.lang.Integer value3, java.lang.Integer value4) { + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached T_3111Record + */ + public T_3111Record() { + super(org.jooq.test.postgres.generatedclasses.tables.T_3111.T_3111); + } + + /** + * Create a detached, initialised T_3111Record + */ + public T_3111Record(java.lang.Integer id, java.lang.Integer inverse, java.lang.Integer bool1, java.lang.Integer bool2) { + super(org.jooq.test.postgres.generatedclasses.tables.T_3111.T_3111); + + setValue(0, id); + setValue(1, inverse); + setValue(2, bool1); + setValue(3, bool2); + } +} diff --git a/jOOQ-test/src/test/resources/org/jooq/configuration/lukas/postgres/library.xml b/jOOQ-test/src/test/resources/org/jooq/configuration/lukas/postgres/library.xml index 5b49b40cb6..b9f29db829 100644 --- a/jOOQ-test/src/test/resources/org/jooq/configuration/lukas/postgres/library.xml +++ b/jOOQ-test/src/test/resources/org/jooq/configuration/lukas/postgres/library.xml @@ -28,6 +28,23 @@ false true + + + 3111_INVERSE + java.lang.Integer + org.jooq.test._.converters.T_3111_InverseConverter + + + 3111_BOOL1 + java.lang.Integer + org.jooq.test._.converters.T_3111_Bool1Converter + + + 3111_BOOL2 + java.lang.Integer + org.jooq.test._.converters.T_3111_Bool2Converter + + B10 org.jooq.test._.converters.Boolean_10 @@ -60,6 +77,21 @@ + + + + 3111_INVERSE + (?i:(.*?\.)?T_3111\.INVERSE) + + + 3111_BOOL1 + (?i:(.*?\.)?T_3111\.BOOL1) + + + 3111_BOOL2 + (?i:(.*?\.)?T_3111\.BOOL2) + + BOOLEAN (?i:(.*?.)?T_BOOLEANS.(VC|C|N)_BOOLEAN)