Skip to content

Commit

Permalink
new functional-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
jyrimatti committed Jul 25, 2023
1 parent 16b6869 commit 7d13665
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fi.solita.utils</groupId>
<artifactId>meta-utils</artifactId>
<version>0.12.23</version>
<version>0.12.24</version>
<build>
<resources>
<resource>
Expand Down Expand Up @@ -36,7 +36,7 @@
<dependency>
<groupId>fi.solita.utils</groupId>
<artifactId>functional-utils</artifactId>
<version>0.12.29</version>
<version>0.12.37</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ public boolean constructorsAsFunctionsEnabled() {
};
}

@SuppressWarnings("unchecked")
public List<Generator<? super OPTIONS>> generators() {
return Arrays.<Generator<? super OPTIONS>>asList(
InstanceFieldsAsEnum.instance,
Expand Down Expand Up @@ -378,6 +377,7 @@ public Class<? extends Apply> getClassForMethods(int argCount) {
case 33: return MetaMethods.M33.class;
case 34: return MetaMethods.M34.class;
case 35: return MetaMethods.M35.class;
case 36: return MetaMethods.M36.class;
}
throw new RuntimeException("Not implemented: F" + argCount);
}
Expand Down Expand Up @@ -426,6 +426,7 @@ public Class<? extends Apply> getClassForConstructors(int argCount) {
case 33: return MetaConstructors.C33.class;
case 34: return MetaConstructors.C34.class;
case 35: return MetaConstructors.C35.class;
case 36: return MetaConstructors.C36.class;
}
throw new RuntimeException("Not implemented: F" + argCount);
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/fi/solita/utils/meta/Helpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ public boolean accept(Element candidate) {
};

public static final Predicate<Element> nonGeneratedElements = new Predicate<Element>() {
@SuppressWarnings("unchecked")
@Override
public boolean accept(Element candidate) {
return candidate.getAnnotation(Helpers.GENERATED) == null;
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/fi/solita/utils/meta/MetaConstructors.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import fi.solita.utils.functional.Function33;
import fi.solita.utils.functional.Function34;
import fi.solita.utils.functional.Function35;
import fi.solita.utils.functional.Function36;
import fi.solita.utils.functional.Function4;
import fi.solita.utils.functional.Function5;
import fi.solita.utils.functional.Function6;
Expand Down Expand Up @@ -74,6 +75,7 @@
import fi.solita.utils.functional.Tuple33;
import fi.solita.utils.functional.Tuple34;
import fi.solita.utils.functional.Tuple35;
import fi.solita.utils.functional.Tuple36;
import fi.solita.utils.functional.Tuple4;
import fi.solita.utils.functional.Tuple5;
import fi.solita.utils.functional.Tuple6;
Expand Down Expand Up @@ -976,4 +978,29 @@ public String toString() {
return doToString(clazz, argClasses);
}
}

public static abstract class C36<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,R> extends Function36<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,R> implements MetaConstructor<Tuple36<? extends T1,? extends T2,? extends T3,? extends T4,? extends T5,? extends T6,? extends T7,? extends T8,? extends T9,? extends T10,? extends T11,? extends T12,? extends T13,? extends T14,? extends T15,? extends T16,? extends T17,? extends T18,? extends T19,? extends T20,? extends T21,? extends T22,? extends T23,? extends T24,? extends T25,? extends T26,? extends T27,? extends T28,? extends T29,? extends T30,? extends T31,? extends T32,? extends T33,? extends T34,? extends T35,? extends T36>,R> {
private transient Constructor<R> $r;
private final Class<?> clazz;
private final Class<?>[] argClasses;
public C36(Class<?> clazz, Class<?>... argClasses) {
this.clazz = clazz;
this.argClasses = argClasses;
}
@Override
public List<Class<?>> getConstructorParameterTypes() {
return Collections.unmodifiableList(Arrays.asList(argClasses));
}
@Override
public Constructor<R> getMember() {
if ($r == null) {
$r = doGetMember(clazz, argClasses);
}
return $r;
}
@Override
public String toString() {
return doToString(clazz, argClasses);
}
}
}
28 changes: 28 additions & 0 deletions src/main/java/fi/solita/utils/meta/MetaMethods.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import fi.solita.utils.functional.Function33;
import fi.solita.utils.functional.Function34;
import fi.solita.utils.functional.Function35;
import fi.solita.utils.functional.Function36;
import fi.solita.utils.functional.Function4;
import fi.solita.utils.functional.Function5;
import fi.solita.utils.functional.Function6;
Expand Down Expand Up @@ -67,6 +68,7 @@
import fi.solita.utils.functional.Tuple33;
import fi.solita.utils.functional.Tuple34;
import fi.solita.utils.functional.Tuple35;
import fi.solita.utils.functional.Tuple36;
import fi.solita.utils.functional.Tuple4;
import fi.solita.utils.functional.Tuple5;
import fi.solita.utils.functional.Tuple6;
Expand Down Expand Up @@ -998,4 +1000,30 @@ public final String toString() {
return doToString(clazz, name);
}
}

public static abstract class M36<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,R> extends Function36<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,R> implements MetaMethod<Tuple36<? extends T1,? extends T2,? extends T3,? extends T4,? extends T5,? extends T6,? extends T7,? extends T8,? extends T9,? extends T10,? extends T11,? extends T12,? extends T13,? extends T14,? extends T15,? extends T16,? extends T17,? extends T18,? extends T19,? extends T20,? extends T21,? extends T22,? extends T23,? extends T24,? extends T25,? extends T26,? extends T27,? extends T28,? extends T29,? extends T30,? extends T31,? extends T32,? extends T33,? extends T34,? extends T35,? extends T36>,R> {
private transient Method $r;
private final Class<?> clazz;
private final String name;
private final Class<?>[] argClasses;
public M36(Class<?> clazz, String name, Class<?>... argClasses) {
this.clazz = clazz;
this.name = name;
this.argClasses = argClasses;
}
@Override
public final Method getMember() {
if ($r == null) {
$r = doGetMember(clazz, name, argClasses);
}
return $r;
}
public final String getName() {
return name;
}
@Override
public final String toString() {
return doToString(clazz, name);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import static fi.solita.utils.functional.Functional.mkString;
import static fi.solita.utils.functional.Functional.zip;
import static fi.solita.utils.functional.Functional.zipWithIndex;
import static fi.solita.utils.functional.FunctionalA.concat;
import static fi.solita.utils.functional.Option.Some;
import static fi.solita.utils.functional.Predicates.not;
import static fi.solita.utils.meta.Helpers.boxedQualifiedName;
Expand Down

0 comments on commit 7d13665

Please sign in to comment.