You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by GitBox <gi...@apache.org> on 2020/05/20 21:54:11 UTC

[GitHub] [incubator-gobblin] zxcware commented on a change in pull request #2910: Add typed config in salesforce

zxcware commented on a change in pull request #2910:
URL: https://github.com/apache/incubator-gobblin/pull/2910#discussion_r428329643



##########
File path: gobblin-salesforce/src/main/java/org/apache/gobblin/typedconfig/ConstraintUtil.java
##########
@@ -0,0 +1,80 @@
+package org.apache.gobblin.typedconfig;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import org.apache.gobblin.typedconfig.compiletime.EnumOptions;
+import org.apache.gobblin.typedconfig.compiletime.IntRange;
+import org.apache.gobblin.typedconfig.compiletime.LongRange;
+import org.apache.gobblin.typedconfig.compiletime.StringRegex;
+
+
+public class ConstraintUtil {
+  private ConstraintUtil() {
+  }
+
+  public static Object constraint(Field field, Object value, Object defaultValue) {
+    if (value == null) {
+      return defaultValue;
+    }
+    Class type = field.getType();
+    if (type == int.class) {

Review comment:
       I mean something like this https://github.com/apache/incubator-gobblin/blob/master/gobblin-modules/gobblin-parquet/src/main/java/org/apache/gobblin/converter/parquet/JsonElementConversionFactory.java.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org