View Javadoc
1   /*
2    * Copyright 2020 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.bremersee.data.minio;
18  
19  import javax.validation.constraints.NotEmpty;
20  import javax.validation.constraints.NotNull;
21  import lombok.EqualsAndHashCode;
22  import lombok.Getter;
23  import lombok.ToString;
24  
25  /**
26   * The default minio object id.
27   */
28  @Getter
29  @ToString
30  @EqualsAndHashCode
31  public class DefaultMinioObjectId implements MinioObjectId {
32  
33    private final String name;
34  
35    private final String versionId;
36  
37    /**
38     * Instantiates a new default minio object id.
39     *
40     * @param minioObjectId the minio object id
41     */
42    public DefaultMinioObjectId(@NotNull MinioObjectId minioObjectId) {
43      this(minioObjectId.getName(), minioObjectId.getVersionId());
44    }
45  
46    /**
47     * Instantiates a new default minio object id.
48     *
49     * @param name the name
50     */
51    public DefaultMinioObjectId(@NotEmpty String name) {
52      this(name, null);
53    }
54  
55    /**
56     * Instantiates a new default minio object id.
57     *
58     * @param name the name
59     * @param versionId the version id
60     */
61    public DefaultMinioObjectId(@NotEmpty String name, String versionId) {
62      this.name = name;
63      this.versionId = versionId;
64    }
65  
66  }