Skip to content

Commit 590340f

Browse files
committed
Add converters for various temporal and other types. Finish the gitlab connector
1 parent eb772bb commit 590340f

File tree

32 files changed

+1602
-726
lines changed

32 files changed

+1602
-726
lines changed

connector/aws/base/src/main/java/com/blazebit/query/connector/aws/base/AwsConventionContext.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package com.blazebit.query.connector.aws.base;
1818

19-
import java.lang.reflect.Method;
19+
import java.lang.reflect.Member;
2020

2121
import com.blazebit.query.connector.base.ConventionContext;
2222

@@ -34,8 +34,8 @@ private AwsConventionContext() {
3434
}
3535

3636
@Override
37-
public ConventionContext getSubFilter(Class<?> concreteClass, Method method) {
38-
switch (method.getName()) {
37+
public ConventionContext getSubFilter(Class<?> concreteClass, Member member) {
38+
switch (member.getName()) {
3939
case "sdkFields":
4040
case "toBuilder":
4141
case "serializableBuilderClass":

connector/azure/graph/src/main/java/com/blazebit/query/connector/azure/graph/AzureGraphConventionContext.java

Lines changed: 110 additions & 110 deletions
Large diffs are not rendered by default.

connector/azure/resourcemanager/src/main/java/com/blazebit/query/connector/azure/resourcemanager/AzureResourceManagerConventionContext.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package com.blazebit.query.connector.azure.resourcemanager;
1818

19-
import java.lang.reflect.Method;
19+
import java.lang.reflect.Member;
2020

2121
import com.azure.core.management.exception.ManagementError;
2222
import com.azure.core.util.ExpandableStringEnum;
@@ -36,8 +36,8 @@ private AzureResourceManagerConventionContext() {
3636
}
3737

3838
@Override
39-
public ConventionContext getSubFilter(Class<?> concreteClass, Method method) {
40-
switch (method.getName()) {
39+
public ConventionContext getSubFilter(Class<?> concreteClass, Member member) {
40+
switch (member.getName()) {
4141
case "getDetails":
4242
return concreteClass != ManagementError.class ? this : NestedManagementErrorContext.INSTANCE;
4343
default:
@@ -46,8 +46,8 @@ public ConventionContext getSubFilter(Class<?> concreteClass, Method method) {
4646
}
4747

4848
@Override
49-
public boolean isBaseType(Class<?> typeClass) {
50-
return ConventionContext.super.isBaseType( typeClass )
49+
public boolean isEnumType(Class<?> typeClass) {
50+
return ConventionContext.super.isEnumType(typeClass)
5151
|| ExpandableStringEnum.class.isAssignableFrom(typeClass);
5252
}
5353

@@ -56,8 +56,8 @@ private static final class NestedManagementErrorContext implements ConventionCon
5656
private static final NestedManagementErrorContext INSTANCE = new NestedManagementErrorContext();
5757

5858
@Override
59-
public ConventionContext getSubFilter(Class<?> concreteClass, Method method) {
60-
switch ( method.getName() ) {
59+
public ConventionContext getSubFilter(Class<?> concreteClass, Member member) {
60+
switch (member.getName()) {
6161
// Filter out cycles in the model
6262
case "getDetails":
6363
return concreteClass != ManagementError.class ? this : null;

connector/base/src/main/java/com/blazebit/query/connector/base/ConventionContext.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package com.blazebit.query.connector.base;
1818

19-
import java.lang.reflect.Method;
19+
import java.lang.reflect.Member;
2020
import java.time.Duration;
2121
import java.time.Instant;
2222
import java.time.LocalDate;
@@ -41,7 +41,7 @@ public interface ConventionContext {
4141
*/
4242
ConventionContext NO_FILTER = new ConventionContext() {
4343
@Override
44-
public ConventionContext getSubFilter(Class<?> concreteClass, Method method) {
44+
public ConventionContext getSubFilter(Class<?> concreteClass, Member member) {
4545
return this;
4646
}
4747
};
@@ -51,11 +51,11 @@ public ConventionContext getSubFilter(Class<?> concreteClass, Method method) {
5151
* A {@code null} return means that the attribute identified by the given method should be filtered.
5252
*
5353
* @param concreteClass The concrete class for which this method should be checked
54-
* @param method The method for an attribute that should be checked
54+
* @param member The member for an attribute that should be checked
5555
*
5656
* @return The sub-filter to use or {@code null} if the attribute for this method should be filtered.
5757
*/
58-
ConventionContext getSubFilter(Class<?> concreteClass, Method method);
58+
ConventionContext getSubFilter(Class<?> concreteClass, Member member);
5959

6060
/**
6161
* Returns whether the given class is a basic type.
@@ -64,7 +64,7 @@ public ConventionContext getSubFilter(Class<?> concreteClass, Method method) {
6464
* @return whether the given class is a basic type
6565
*/
6666
default boolean isBaseType(Class<?> typeClass) {
67-
return typeClass.isEnum()
67+
return isEnumType(typeClass)
6868
|| JavaToSqlTypeConversionRules.instance().lookup(typeClass) != null
6969
|| typeClass == Object.class
7070
|| typeClass == Instant.class
@@ -80,4 +80,14 @@ default boolean isBaseType(Class<?> typeClass) {
8080
;
8181
}
8282

83+
/**
84+
* Returns whether the given class is an enum type.
85+
*
86+
* @param typeClass The class to check
87+
* @return whether the given class is an enum type
88+
*/
89+
default boolean isEnumType(Class<?> typeClass) {
90+
return typeClass.isEnum();
91+
}
92+
8393
}

0 commit comments

Comments
 (0)