diff --git a/jOOQ/src/main/java/org/jooq/Function1.java b/jOOQ/src/main/java/org/jooq/Function1.java new file mode 100644 index 0000000000..66fa7962e0 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function1.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 1. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function1 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1); +} diff --git a/jOOQ/src/main/java/org/jooq/Function10.java b/jOOQ/src/main/java/org/jooq/Function10.java new file mode 100644 index 0000000000..77506c69ab --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function10.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 10. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function10 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10); +} diff --git a/jOOQ/src/main/java/org/jooq/Function11.java b/jOOQ/src/main/java/org/jooq/Function11.java new file mode 100644 index 0000000000..8bc25cfc40 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function11.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 11. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function11 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11); +} diff --git a/jOOQ/src/main/java/org/jooq/Function12.java b/jOOQ/src/main/java/org/jooq/Function12.java new file mode 100644 index 0000000000..deded23bc0 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function12.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 12. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function12 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12); +} diff --git a/jOOQ/src/main/java/org/jooq/Function13.java b/jOOQ/src/main/java/org/jooq/Function13.java new file mode 100644 index 0000000000..e42a2cea21 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function13.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 13. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function13 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13); +} diff --git a/jOOQ/src/main/java/org/jooq/Function14.java b/jOOQ/src/main/java/org/jooq/Function14.java new file mode 100644 index 0000000000..a40473f44b --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function14.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 14. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function14 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14); +} diff --git a/jOOQ/src/main/java/org/jooq/Function15.java b/jOOQ/src/main/java/org/jooq/Function15.java new file mode 100644 index 0000000000..41a9b2098c --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function15.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 15. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function15 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15); +} diff --git a/jOOQ/src/main/java/org/jooq/Function16.java b/jOOQ/src/main/java/org/jooq/Function16.java new file mode 100644 index 0000000000..a514fb368c --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function16.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 16. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function16 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16); +} diff --git a/jOOQ/src/main/java/org/jooq/Function17.java b/jOOQ/src/main/java/org/jooq/Function17.java new file mode 100644 index 0000000000..c48f51577b --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function17.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 17. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function17 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17); +} diff --git a/jOOQ/src/main/java/org/jooq/Function18.java b/jOOQ/src/main/java/org/jooq/Function18.java new file mode 100644 index 0000000000..ad91df4932 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function18.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 18. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function18 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18); +} diff --git a/jOOQ/src/main/java/org/jooq/Function19.java b/jOOQ/src/main/java/org/jooq/Function19.java new file mode 100644 index 0000000000..76d062ea20 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function19.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 19. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function19 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19); +} diff --git a/jOOQ/src/main/java/org/jooq/Function2.java b/jOOQ/src/main/java/org/jooq/Function2.java new file mode 100644 index 0000000000..6883bdad58 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function2.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 2. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function2 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2); +} diff --git a/jOOQ/src/main/java/org/jooq/Function20.java b/jOOQ/src/main/java/org/jooq/Function20.java new file mode 100644 index 0000000000..c2de2fe685 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function20.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 20. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function20 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20); +} diff --git a/jOOQ/src/main/java/org/jooq/Function21.java b/jOOQ/src/main/java/org/jooq/Function21.java new file mode 100644 index 0000000000..e282e6da69 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function21.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 21. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function21 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21); +} diff --git a/jOOQ/src/main/java/org/jooq/Function22.java b/jOOQ/src/main/java/org/jooq/Function22.java new file mode 100644 index 0000000000..ff83254f49 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function22.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 22. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function22 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22); +} diff --git a/jOOQ/src/main/java/org/jooq/Function3.java b/jOOQ/src/main/java/org/jooq/Function3.java new file mode 100644 index 0000000000..a22802cbc7 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function3.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 3. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function3 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3); +} diff --git a/jOOQ/src/main/java/org/jooq/Function4.java b/jOOQ/src/main/java/org/jooq/Function4.java new file mode 100644 index 0000000000..639021a207 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function4.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 4. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function4 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4); +} diff --git a/jOOQ/src/main/java/org/jooq/Function5.java b/jOOQ/src/main/java/org/jooq/Function5.java new file mode 100644 index 0000000000..b49778656b --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function5.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 5. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function5 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5); +} diff --git a/jOOQ/src/main/java/org/jooq/Function6.java b/jOOQ/src/main/java/org/jooq/Function6.java new file mode 100644 index 0000000000..85a28a67db --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function6.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 6. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function6 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6); +} diff --git a/jOOQ/src/main/java/org/jooq/Function7.java b/jOOQ/src/main/java/org/jooq/Function7.java new file mode 100644 index 0000000000..a35fd504be --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function7.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 7. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function7 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7); +} diff --git a/jOOQ/src/main/java/org/jooq/Function8.java b/jOOQ/src/main/java/org/jooq/Function8.java new file mode 100644 index 0000000000..e6253ade2d --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function8.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 8. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function8 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8); +} diff --git a/jOOQ/src/main/java/org/jooq/Function9.java b/jOOQ/src/main/java/org/jooq/Function9.java new file mode 100644 index 0000000000..5c9aaf75f2 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Function9.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A function of degree 9. + *

+ * This is EXPERIMENTAL API. Future jOOQ versions may instead use the + * functional interfaces from jOOλ, and remove these types again. + * + * @author Lukas Eder + */ +@Internal +@FunctionalInterface +public interface Function9 { + + /** + * Applies this function to the given arguments. + */ + R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9); +} diff --git a/jOOQ/src/main/java/org/jooq/RecordMapper.java b/jOOQ/src/main/java/org/jooq/RecordMapper.java index 6c9f3eccbb..9f8c2c2be6 100644 --- a/jOOQ/src/main/java/org/jooq/RecordMapper.java +++ b/jOOQ/src/main/java/org/jooq/RecordMapper.java @@ -52,7 +52,9 @@ import org.jetbrains.annotations.Nullable; * The default RecordMapper behaviour in the context of a * {@link Configuration} can be overridden through that * configuration's {@link Configuration#recordMapperProvider()} - * SPI. + * SPI. Custom record mappers can be constructed using lambda expressions, using + * various {@link Records#mapping(Function1)}, + * {@link Records#mapping(Function2)}, etc. utilities, and other ways. *

* The inverse operation is modelled by {@link RecordUnmapper}. * diff --git a/jOOQ/src/main/java/org/jooq/Records.java b/jOOQ/src/main/java/org/jooq/Records.java new file mode 100644 index 0000000000..6256303197 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Records.java @@ -0,0 +1,284 @@ +/* + * 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. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * Common utilities related to {@link Record} types and constructing + * {@link RecordMapper}. + *

+ * The various mapping() methods can be used e.g. to map between + * {@link Record} types and constructors of known degree, such as in this + * example: + *

+ *

+ * final /* record */ class Actor { private final int id; private final String firstName; private final String lastName; public Actor(int id, String firstName, String lastName) { this.id = id; this.firstName = firstName; this.lastName = lastName; } public int id() { return id; } public String firstName() { return firstName; } public String lastName() { return lastName; } @Override public boolean equals(Object o) { if (!(o instanceof Actor)) return false; Actor other = (Actor) o; if (!java.util.Objects.equals(this.id, other.id)) return false; if (!java.util.Objects.equals(this.firstName, other.firstName)) return false; if (!java.util.Objects.equals(this.lastName, other.lastName)) return false; return true; } @Override public int hashCode() { return java.util.Objects.hash(this.id, this.firstName, this.lastName); } @Override public String toString() { return new StringBuilder("Actor[").append("id=").append(this.id).append(", firstName=").append(this.firstName).append(", lastName=").append(this.lastName).append("]").toString(); } }
+ *
+ * List<Actor> actors =
+ * ctx.select(ACTOR.ID, ACTOR.FIRST_NAME, ACTOR.LAST_NAME)
+ *    .from(ACTOR)
+ *    .fetch(mapping(Actor::new));
+ * 
+ * + * @author Lukas Eder + */ +public final class Records { + + + + /** + * Create a {@link RecordMapper} that can map from {@link Record1} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function1 function + ) { + return r -> function.apply(r.value1()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record2} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function2 function + ) { + return r -> function.apply(r.value1(), r.value2()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record3} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function3 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record4} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function4 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record5} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function5 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record6} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function6 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record7} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function7 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6(), r.value7()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record8} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function8 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6(), r.value7(), r.value8()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record9} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function9 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6(), r.value7(), r.value8(), r.value9()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record10} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function10 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6(), r.value7(), r.value8(), r.value9(), r.value10()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record11} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function11 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6(), r.value7(), r.value8(), r.value9(), r.value10(), r.value11()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record12} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function12 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6(), r.value7(), r.value8(), r.value9(), r.value10(), r.value11(), r.value12()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record13} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function13 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6(), r.value7(), r.value8(), r.value9(), r.value10(), r.value11(), r.value12(), r.value13()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record14} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function14 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6(), r.value7(), r.value8(), r.value9(), r.value10(), r.value11(), r.value12(), r.value13(), r.value14()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record15} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function15 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6(), r.value7(), r.value8(), r.value9(), r.value10(), r.value11(), r.value12(), r.value13(), r.value14(), r.value15()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record16} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function16 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6(), r.value7(), r.value8(), r.value9(), r.value10(), r.value11(), r.value12(), r.value13(), r.value14(), r.value15(), r.value16()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record17} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function17 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6(), r.value7(), r.value8(), r.value9(), r.value10(), r.value11(), r.value12(), r.value13(), r.value14(), r.value15(), r.value16(), r.value17()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record18} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function18 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6(), r.value7(), r.value8(), r.value9(), r.value10(), r.value11(), r.value12(), r.value13(), r.value14(), r.value15(), r.value16(), r.value17(), r.value18()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record19} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function19 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6(), r.value7(), r.value8(), r.value9(), r.value10(), r.value11(), r.value12(), r.value13(), r.value14(), r.value15(), r.value16(), r.value17(), r.value18(), r.value19()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record20} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function20 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6(), r.value7(), r.value8(), r.value9(), r.value10(), r.value11(), r.value12(), r.value13(), r.value14(), r.value15(), r.value16(), r.value17(), r.value18(), r.value19(), r.value20()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record21} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function21 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6(), r.value7(), r.value8(), r.value9(), r.value10(), r.value11(), r.value12(), r.value13(), r.value14(), r.value15(), r.value16(), r.value17(), r.value18(), r.value19(), r.value20(), r.value21()); + } + + /** + * Create a {@link RecordMapper} that can map from {@link Record22} to a user type + * in a type safe way. + */ + public static final , Q> RecordMapper mapping( + Function22 function + ) { + return r -> function.apply(r.value1(), r.value2(), r.value3(), r.value4(), r.value5(), r.value6(), r.value7(), r.value8(), r.value9(), r.value10(), r.value11(), r.value12(), r.value13(), r.value14(), r.value15(), r.value16(), r.value17(), r.value18(), r.value19(), r.value20(), r.value21(), r.value22()); + } + + +}