浏览代码

add @NonNull annotation

zhiru 5 年之前
父节点
当前提交
517e7eab06

+ 1 - 1
src/main/java/io/milvus/client/CommandParam.java

@@ -13,7 +13,7 @@ public class CommandParam {
         // Optional parameters - initialized to default values
         private long timeout = 86400;
 
-        public Builder(String command) {
+        public Builder(@Nonnull String command) {
             this.command = command;
         }
 

+ 2 - 2
src/main/java/io/milvus/client/ConnectParam.java

@@ -11,12 +11,12 @@ public class ConnectParam {
         private String host = "127.0.0.1";
         private String port = "19530";
 
-        public Builder withHost(String host) {
+        public Builder withHost(@Nonnull String host) {
             this.host = host;
             return this;
         }
 
-        public Builder withPort(String port) {
+        public Builder withPort(@Nonnull String port) {
             this.port = port;
             return this;
         }

+ 4 - 3
src/main/java/io/milvus/client/DateRange.java

@@ -1,21 +1,22 @@
 package io.milvus.client;
 
+import javax.annotation.Nonnull;
 import java.util.Date;
 
 public class DateRange {
     private Date startDate;
     private Date endDate;
 
-    public DateRange(Date startDate, Date endDate) {
+    public DateRange(@Nonnull Date startDate, @Nonnull Date endDate) {
         this.startDate = startDate;
         this.endDate = endDate;
     }
 
-    public void setStartDate(Date startDate) {
+    public void setStartDate(@Nonnull Date startDate) {
         this.startDate = startDate;
     }
 
-    public void setEndDate(Date endDate) {
+    public void setEndDate(@Nonnull Date endDate) {
         this.endDate = endDate;
     }
 

+ 1 - 1
src/main/java/io/milvus/client/DeleteByRangeParam.java

@@ -15,7 +15,7 @@ public class DeleteByRangeParam {
         // Optional parameters - initialized to default values
         private long timeout = 86400;
 
-        public Builder(DateRange dateRange, String tableName) {
+        public Builder(@Nonnull DateRange dateRange, @Nonnull String tableName) {
             this.dateRange = dateRange;
             this.tableName = tableName;
         }

+ 1 - 1
src/main/java/io/milvus/client/Index.java

@@ -11,7 +11,7 @@ public class Index {
         private IndexType indexType = IndexType.FLAT;
         private int nList = 16384;
 
-        public Builder withIndexType(IndexType indexType) {
+        public Builder withIndexType(@Nonnull IndexType indexType) {
             this.indexType = indexType;
             return this;
         }

+ 1 - 1
src/main/java/io/milvus/client/IndexParam.java

@@ -16,7 +16,7 @@ public class IndexParam {
         private Index index;
         private long timeout = 86400;
 
-        public Builder(String tableName) {
+        public Builder(@Nonnull String tableName) {
             this.tableName = tableName;
         }
 

+ 2 - 2
src/main/java/io/milvus/client/InsertParam.java

@@ -19,12 +19,12 @@ public class InsertParam {
         private List<Long> vectorIds = new ArrayList<>();
         private long timeout = 86400;
 
-        public Builder(String tableName, List<List<Float>> vectors) {
+        public Builder(@Nonnull String tableName, @Nonnull List<List<Float>> vectors) {
             this.tableName = tableName;
             this.vectors = vectors;
         }
 
-        public Builder withVectorIds(List<Long> vectorIds) {
+        public Builder withVectorIds(@Nonnull List<Long> vectorIds) {
             this.vectorIds = vectorIds;
             return this;
         }

+ 19 - 0
src/main/java/io/milvus/client/MilvusClient.java

@@ -3,10 +3,29 @@ package io.milvus.client;
 public interface MilvusClient {
 
     String clientVersion = "0.1.0";
+
+    /**
+     * @return the current Milvus client version
+     */
     default String clientVersion() {
         return clientVersion;
     }
 
+    /**
+     * Connects to Milvus server
+     * @param connectParam the <code>ConnectParam</code> object
+     *                     <pre>
+     *                     example usage:
+     *                     <code>
+     *                         ConnectParam connectParam = new ConnectParam.Builder()
+     *                                                                     .withHost("localhost")
+     *                                                                     .withPort("19530")
+     *                                                                     .build();
+     *                     </code>
+     *                     </pre>
+     * @return <code>Response</code>
+     * @see ConnectParam
+     */
     Response connect(ConnectParam connectParam);
 
     boolean connected();

+ 2 - 2
src/main/java/io/milvus/client/SearchParam.java

@@ -24,12 +24,12 @@ public class SearchParam {
         private long nProbe = 10;
         private long timeout = 86400;
 
-        public Builder(String tableName, List<List<Float>> queryVectors) {
+        public Builder(@Nonnull String tableName, @Nonnull List<List<Float>> queryVectors) {
             this.tableName = tableName;
             this.queryVectors = queryVectors;
         }
 
-        public Builder withDateRanges(List<DateRange> queryRanges) {
+        public Builder withDateRanges(@Nonnull List<DateRange> queryRanges) {
             this.queryRanges = queryRanges;
             return this;
         }

+ 1 - 1
src/main/java/io/milvus/client/TableParam.java

@@ -13,7 +13,7 @@ public class TableParam {
         // Optional parameters - initialized to default values
         private long timeout = 86400;
 
-        public Builder(String tableName) {
+        public Builder(@Nonnull String tableName) {
             this.tableName = tableName;
         }
 

+ 2 - 2
src/main/java/io/milvus/client/TableSchema.java

@@ -18,7 +18,7 @@ public class TableSchema {
         private long indexFileSize = 1024;
         private MetricType metricType = MetricType.L2;
 
-        public Builder(String tableName, long dimension) {
+        public Builder(@Nonnull String tableName, long dimension) {
             this.tableName = tableName;
             this.dimension = dimension;
         }
@@ -27,7 +27,7 @@ public class TableSchema {
             this.indexFileSize = indexFileSize;
             return this;
         }
-        public Builder withMetricType(MetricType metricType) {
+        public Builder withMetricType(@Nonnull MetricType metricType) {
             this.metricType = metricType;
             return this;
         }

+ 1 - 1
src/main/java/io/milvus/client/TableSchemaParam.java

@@ -13,7 +13,7 @@ public class TableSchemaParam {
         // Optional parameters - initialized to default values
         private long timeout = 86400;
 
-        public Builder(TableSchema tableSchema) {
+        public Builder(@Nonnull TableSchema tableSchema) {
             this.tableSchema = tableSchema;
         }