9296780d57d994aa4a44dd880c3bf33c7c566018
[policy/models.git] /
1 /*
2  * ============LICENSE_START=======================================================
3  * ONAP Policy Models
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.models.tosca.authorative.concepts;
22
23 import com.google.gson.annotations.SerializedName;
24 import lombok.Data;
25 import lombok.NoArgsConstructor;
26 import lombok.NonNull;
27
28 /**
29  * Policy identifier with an optional version; only the "name" is required.
30  */
31 @Data
32 @NoArgsConstructor
33 public class ToscaPolicyIdentifierOptVersion {
34
35     @NonNull
36     @SerializedName("policy-id")
37     private String name;
38
39     @SerializedName("policy-version")
40     private String version;
41
42
43     public ToscaPolicyIdentifierOptVersion(@NonNull String name, String version) {
44         this.name = name;
45         this.version = version;
46     }
47
48     public ToscaPolicyIdentifierOptVersion(ToscaPolicyIdentifierOptVersion source) {
49         this.name = source.name;
50         this.version = source.version;
51     }
52
53     /**
54      * Determines if the version is null/missing.
55      *
56      * @return {@code true} if the version is null/missing, {@code false}
57      */
58     public boolean isNullVersion() {
59         return (version == null);
60     }
61 }