You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/11/25 09:29:18 UTC

[GitHub] [flink] dawidwys commented on a change in pull request #10307: [FLINK-14903][table] Relax structured types constraints

dawidwys commented on a change in pull request #10307: [FLINK-14903][table] Relax structured types constraints
URL: https://github.com/apache/flink/pull/10307#discussion_r350053412
 
 

 ##########
 File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/logical/StructuredType.java
 ##########
 @@ -150,54 +159,62 @@ public int hashCode() {
 
 		private @Nullable String description;
 
-		private @Nullable Class<?> implementationClass;
+		public Builder(Class<?> implementationClass) {
+			this.objectIdentifier = null;
+			this.implementationClass =
+				Preconditions.checkNotNull(implementationClass, "Implementation class must not be null.");
+		}
+
+		public Builder(ObjectIdentifier objectIdentifier) {
+			this.objectIdentifier =
+				Preconditions.checkNotNull(objectIdentifier, "Object identifier must not be null.");
+			this.implementationClass = null;
+		}
+
+		public Builder(ObjectIdentifier objectIdentifier, Class<?> implementationClass) {
+			this.objectIdentifier =
+				Preconditions.checkNotNull(objectIdentifier, "Object identifier must not be null.");
+			this.implementationClass =
+				Preconditions.checkNotNull(implementationClass, "Implementation class must not be null.");
+		}
 
-		public Builder(ObjectIdentifier objectIdentifier, List<StructuredAttribute> attributes) {
-			this.objectIdentifier = Preconditions.checkNotNull(objectIdentifier, "Object identifier must not be null.");
+		public Builder attributes(List<StructuredAttribute> attributes) {
 			this.attributes = Collections.unmodifiableList(
 				new ArrayList<>(
 					Preconditions.checkNotNull(attributes, "Attributes must not be null.")));
-
-			Preconditions.checkArgument(
-				attributes.size() > 0,
-				"Attribute list must not be empty.");
+			return this;
 		}
 
-		public Builder setNullable(boolean isNullable) {
+		public Builder isNullable(boolean isNullable) {
 
 Review comment:
   nit: Personally I would not use `is` prefix for setters. I'd use this prefix only for getters. How about just `nullable`?

----------------------------------------------------------------
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


With regards,
Apache Git Services