DescribeCollectionParam.java 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. package io.milvus.param.collection;
  20. import io.milvus.exception.ParamException;
  21. import io.milvus.param.ParamUtils;
  22. import lombok.Getter;
  23. import lombok.NonNull;
  24. /**
  25. * Parameters for <code>describeCollection</code> interface.
  26. */
  27. @Getter
  28. public class DescribeCollectionParam {
  29. private final String collectionName;
  30. private DescribeCollectionParam(@NonNull Builder builder) {
  31. this.collectionName = builder.collectionName;
  32. }
  33. public static Builder newBuilder() {
  34. return new Builder();
  35. }
  36. /**
  37. * Builder for <code>DescribeCollectionParam</code> class.
  38. */
  39. public static final class Builder {
  40. private String collectionName;
  41. private Builder() {
  42. }
  43. /**
  44. * Set collection name. Collection name cannot be empty or null.
  45. *
  46. * @param collectionName collection name
  47. * @return <code>Builder</code>
  48. */
  49. public Builder withCollectionName(@NonNull String collectionName) {
  50. this.collectionName = collectionName;
  51. return this;
  52. }
  53. /**
  54. * Verify parameters and create a new <code>DescribeCollectionParam</code> instance.
  55. *
  56. * @return <code>DescribeCollectionParam</code>
  57. */
  58. public DescribeCollectionParam build() throws ParamException {
  59. ParamUtils.CheckNullEmptyString(collectionName, "Collection name");
  60. return new DescribeCollectionParam(this);
  61. }
  62. }
  63. /**
  64. * Construct a <code>String</code> by <code>DescribeCollectionParam</code> instance.
  65. *
  66. * @return <code>String</code>
  67. */
  68. @Override
  69. public String toString() {
  70. return "DescribeCollectionParam{" +
  71. "collectionName='" + collectionName + '\'' + '}';
  72. }
  73. }