lombok.Functions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lombok-pg Show documentation
Show all versions of lombok-pg Show documentation
lombok-pg is a collection of extensions to Project Lombok
The newest version!
/*
* Copyright © 2011-2012 Philipp Eichhorn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package lombok;
/**
* Collection of function templates.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class Functions {
/**
* Encapsulates a method that has no parameters and returns a value of the type specified by the R parameter.
*
* @param
* The type of the return value of the method that this delegate encapsulates.
*/
public static abstract class Function0 {
public abstract R apply();
public final Class> getReturnType() {
return TypeArguments.getClassFor(getClass(), 0);
}
}
/**
* Encapsulates a method that has a single parameter and returns a value of the type specified by the R parameter.
*
* @param
* The type of the parameter of the method that this delegate encapsulates.
* @param
* The type of the return value of the method that this delegate encapsulates.
*/
public static abstract class Function1 {
public abstract R apply(T1 t1);
public final Class> getReturnType() {
return TypeArguments.getClassFor(getClass(), 1);
}
public final Class> getParameterType1() {
return TypeArguments.getClassFor(getClass(), 0);
}
}
/**
* Encapsulates a method that has two parameters and returns a value of the type specified by the R parameter.
*
* @param
* The type of the first parameter of the method that this delegate encapsulates.
* @param
* The type of the second parameter of the method that this delegate encapsulates.
* @param
* The type of the return value of the method that this delegate encapsulates.
*/
public static abstract class Function2 {
public abstract R apply(T1 t1, T2 t2);
public final Class> getReturnType() {
return TypeArguments.getClassFor(getClass(), 2);
}
public final Class> getParameterType1() {
return TypeArguments.getClassFor(getClass(), 0);
}
public final Class> getParameterType2() {
return TypeArguments.getClassFor(getClass(), 1);
}
}
/**
* Encapsulates a method that has three parameters and returns a value of the type specified by the R parameter.
*
* @param
* The type of the parameter of the method that this delegate encapsulates.
* @param
* The type of the second parameter of the method that this delegate encapsulates.
* @param
* The type of the third parameter of the method that this delegate encapsulates.
* @param
* The type of the return value of the method that this delegate encapsulates.
*/
public static abstract class Function3 {
public abstract R apply(T1 t1, T2 t2, T3 t3);
public final Class> getReturnType() {
return TypeArguments.getClassFor(getClass(), 3);
}
public final Class> getParameterType1() {
return TypeArguments.getClassFor(getClass(), 0);
}
public final Class> getParameterType2() {
return TypeArguments.getClassFor(getClass(), 1);
}
public final Class> getParameterType3() {
return TypeArguments.getClassFor(getClass(), 2);
}
}
/**
* Encapsulates a method that has four parameters and returns a value of the type specified by the R parameter.
*
* @param
* The type of the parameter of the method that this delegate encapsulates.
* @param
* The type of the second parameter of the method that this delegate encapsulates.
* @param
* The type of the third parameter of the method that this delegate encapsulates.
* @param
* The type of the four parameter of the method that this delegate encapsulates.
* @param
* The type of the return value of the method that this delegate encapsulates.
*/
public static abstract class Function4 {
public abstract R apply(T1 t1, T2 t2, T3 t3, T4 t4);
public final Class> getReturnType() {
return TypeArguments.getClassFor(getClass(), 4);
}
public final Class> getParameterType1() {
return TypeArguments.getClassFor(getClass(), 0);
}
public final Class> getParameterType2() {
return TypeArguments.getClassFor(getClass(), 1);
}
public final Class> getParameterType3() {
return TypeArguments.getClassFor(getClass(), 2);
}
public final Class> getParameterType4() {
return TypeArguments.getClassFor(getClass(), 3);
}
}
/**
* Encapsulates a method that has five parameters and returns a value of the type specified by the R parameter.
*
* @param
* The type of the parameter of the method that this delegate encapsulates.
* @param
* The type of the second parameter of the method that this delegate encapsulates.
* @param
* The type of the third parameter of the method that this delegate encapsulates.
* @param
* The type of the four parameter of the method that this delegate encapsulates.
* @param
* The type of the five parameter of the method that this delegate encapsulates.
* @param
* The type of the return value of the method that this delegate encapsulates.
*/
public static abstract class Function5 {
public abstract R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5);
public final Class> getReturnType() {
return TypeArguments.getClassFor(getClass(), 5);
}
public final Class> getParameterType1() {
return TypeArguments.getClassFor(getClass(), 0);
}
public final Class> getParameterType2() {
return TypeArguments.getClassFor(getClass(), 1);
}
public final Class> getParameterType3() {
return TypeArguments.getClassFor(getClass(), 2);
}
public final Class> getParameterType4() {
return TypeArguments.getClassFor(getClass(), 3);
}
public final Class> getParameterType5() {
return TypeArguments.getClassFor(getClass(), 4);
}
}
/**
* Encapsulates a method that has six parameters and returns a value of the type specified by the R parameter.
*
* @param
* The type of the parameter of the method that this delegate encapsulates.
* @param
* The type of the second parameter of the method that this delegate encapsulates.
* @param
* The type of the third parameter of the method that this delegate encapsulates.
* @param
* The type of the four parameter of the method that this delegate encapsulates.
* @param
* The type of the five parameter of the method that this delegate encapsulates.
* @param
* The type of the six parameter of the method that this delegate encapsulates.
* @param
* The type of the return value of the method that this delegate encapsulates.
*/
public static abstract class Function6 {
public abstract R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6);
public final Class> getReturnType() {
return TypeArguments.getClassFor(getClass(), 6);
}
public final Class> getParameterType1() {
return TypeArguments.getClassFor(getClass(), 0);
}
public final Class> getParameterType2() {
return TypeArguments.getClassFor(getClass(), 1);
}
public final Class> getParameterType3() {
return TypeArguments.getClassFor(getClass(), 2);
}
public final Class> getParameterType4() {
return TypeArguments.getClassFor(getClass(), 3);
}
public final Class> getParameterType5() {
return TypeArguments.getClassFor(getClass(), 4);
}
public final Class> getParameterType6() {
return TypeArguments.getClassFor(getClass(), 5);
}
}
/**
* Encapsulates a method that has seven parameters and returns a value of the type specified by the R parameter.
*
* @param
* The type of the parameter of the method that this delegate encapsulates.
* @param
* The type of the second parameter of the method that this delegate encapsulates.
* @param
* The type of the third parameter of the method that this delegate encapsulates.
* @param
* The type of the four parameter of the method that this delegate encapsulates.
* @param
* The type of the five parameter of the method that this delegate encapsulates.
* @param
* The type of the six parameter of the method that this delegate encapsulates.
* @param
* The type of the seven parameter of the method that this delegate encapsulates.
* @param
* The type of the return value of the method that this delegate encapsulates.
*/
public static abstract class Function7 {
public abstract R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7);
public final Class> getReturnType() {
return TypeArguments.getClassFor(getClass(), 7);
}
public final Class> getParameterType1() {
return TypeArguments.getClassFor(getClass(), 0);
}
public final Class> getParameterType2() {
return TypeArguments.getClassFor(getClass(), 1);
}
public final Class> getParameterType3() {
return TypeArguments.getClassFor(getClass(), 2);
}
public final Class> getParameterType4() {
return TypeArguments.getClassFor(getClass(), 3);
}
public final Class> getParameterType5() {
return TypeArguments.getClassFor(getClass(), 4);
}
public final Class> getParameterType6() {
return TypeArguments.getClassFor(getClass(), 5);
}
public final Class> getParameterType7() {
return TypeArguments.getClassFor(getClass(), 6);
}
}
/**
* Encapsulates a method that has eight parameters and returns a value of the type specified by the R parameter.
*
* @param
* The type of the parameter of the method that this delegate encapsulates.
* @param
* The type of the second parameter of the method that this delegate encapsulates.
* @param
* The type of the third parameter of the method that this delegate encapsulates.
* @param
* The type of the four parameter of the method that this delegate encapsulates.
* @param
* The type of the five parameter of the method that this delegate encapsulates.
* @param
* The type of the six parameter of the method that this delegate encapsulates.
* @param
* The type of the seven parameter of the method that this delegate encapsulates.
* @param
* The type of the eight parameter of the method that this delegate encapsulates.
* @param
* The type of the return value of the method that this delegate encapsulates.
*/
public static abstract class Function8 {
public abstract R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8);
public final Class> getReturnType() {
return TypeArguments.getClassFor(getClass(), 8);
}
public final Class> getParameterType1() {
return TypeArguments.getClassFor(getClass(), 0);
}
public final Class> getParameterType2() {
return TypeArguments.getClassFor(getClass(), 1);
}
public final Class> getParameterType3() {
return TypeArguments.getClassFor(getClass(), 2);
}
public final Class> getParameterType4() {
return TypeArguments.getClassFor(getClass(), 3);
}
public final Class> getParameterType5() {
return TypeArguments.getClassFor(getClass(), 4);
}
public final Class> getParameterType6() {
return TypeArguments.getClassFor(getClass(), 5);
}
public final Class> getParameterType7() {
return TypeArguments.getClassFor(getClass(), 6);
}
public Class> getParameterType8() {
return TypeArguments.getClassFor(getClass(), 7);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy