|
| 1 | +/* |
| 2 | + * Copyright 2014 Stackify |
| 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 | +package com.stackify.api; |
| 17 | + |
| 18 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 19 | +import com.fasterxml.jackson.annotation.JsonInclude; |
| 20 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 21 | +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
| 22 | + |
| 23 | +/** |
| 24 | + * AppIdentity |
| 25 | + * @author Eric Martin |
| 26 | + */ |
| 27 | +@JsonInclude(JsonInclude.Include.NON_NULL) |
| 28 | +@JsonDeserialize(builder = AppIdentity.Builder.class) |
| 29 | +public class AppIdentity { |
| 30 | + |
| 31 | + /** |
| 32 | + * Device id |
| 33 | + */ |
| 34 | + @JsonProperty("DeviceID") |
| 35 | + private final Integer deviceId; |
| 36 | + |
| 37 | + /** |
| 38 | + * Device application id |
| 39 | + */ |
| 40 | + @JsonProperty("DeviceAppID") |
| 41 | + private final Integer deviceAppId; |
| 42 | + |
| 43 | + /** |
| 44 | + * Application name id |
| 45 | + */ |
| 46 | + @JsonProperty("AppNameID") |
| 47 | + private final String appNameId; |
| 48 | + |
| 49 | + /** |
| 50 | + * Environment id |
| 51 | + */ |
| 52 | + @JsonProperty("EnvID") |
| 53 | + private final Integer envId; |
| 54 | + |
| 55 | + /** |
| 56 | + * Environment |
| 57 | + */ |
| 58 | + @JsonProperty("Env") |
| 59 | + private final String env; |
| 60 | + |
| 61 | + /** |
| 62 | + * Application name |
| 63 | + */ |
| 64 | + @JsonProperty("AppName") |
| 65 | + private final String appName; |
| 66 | + |
| 67 | + /** |
| 68 | + * Application-Environment id |
| 69 | + */ |
| 70 | + @JsonProperty("AppEnvID") |
| 71 | + private final String appEnvId; |
| 72 | + |
| 73 | + /** |
| 74 | + * Device alias |
| 75 | + */ |
| 76 | + @JsonProperty("DeviceAlias") |
| 77 | + private final String deviceAlias; |
| 78 | + |
| 79 | + /** |
| 80 | + * @return the deviceId |
| 81 | + */ |
| 82 | + public Integer getDeviceId() { |
| 83 | + return deviceId; |
| 84 | + } |
| 85 | + |
| 86 | + /** |
| 87 | + * @return the deviceAppId |
| 88 | + */ |
| 89 | + public Integer getDeviceAppId() { |
| 90 | + return deviceAppId; |
| 91 | + } |
| 92 | + |
| 93 | + /** |
| 94 | + * @return the appNameId |
| 95 | + */ |
| 96 | + public String getAppNameId() { |
| 97 | + return appNameId; |
| 98 | + } |
| 99 | + |
| 100 | + /** |
| 101 | + * @return the envId |
| 102 | + */ |
| 103 | + public Integer getEnvId() { |
| 104 | + return envId; |
| 105 | + } |
| 106 | + |
| 107 | + /** |
| 108 | + * @return the env |
| 109 | + */ |
| 110 | + public String getEnv() { |
| 111 | + return env; |
| 112 | + } |
| 113 | + |
| 114 | + /** |
| 115 | + * @return the appName |
| 116 | + */ |
| 117 | + public String getAppName() { |
| 118 | + return appName; |
| 119 | + } |
| 120 | + |
| 121 | + /** |
| 122 | + * @return the appEnvId |
| 123 | + */ |
| 124 | + public String getAppEnvId() { |
| 125 | + return appEnvId; |
| 126 | + } |
| 127 | + |
| 128 | + /** |
| 129 | + * @return the deviceAlias |
| 130 | + */ |
| 131 | + public String getDeviceAlias() { |
| 132 | + return deviceAlias; |
| 133 | + } |
| 134 | + |
| 135 | + /** |
| 136 | + * @return An instance of Builder, based on current state |
| 137 | + */ |
| 138 | + public Builder toBuilder() { |
| 139 | + return newBuilder() |
| 140 | + .deviceId(this.deviceId) |
| 141 | + .deviceAppId(this.deviceAppId) |
| 142 | + .appNameId(this.appNameId) |
| 143 | + .envId(this.envId) |
| 144 | + .env(this.env) |
| 145 | + .appName(this.appName) |
| 146 | + .appEnvId(this.appEnvId) |
| 147 | + .deviceAlias(this.deviceAlias); |
| 148 | + } |
| 149 | + |
| 150 | + /** |
| 151 | + * @param builder The Builder object that contains all of the values for initialization |
| 152 | + */ |
| 153 | + private AppIdentity(final Builder builder) { |
| 154 | + this.deviceId = builder.deviceId; |
| 155 | + this.deviceAppId = builder.deviceAppId; |
| 156 | + this.appNameId = builder.appNameId; |
| 157 | + this.envId = builder.envId; |
| 158 | + this.env = builder.env; |
| 159 | + this.appName = builder.appName; |
| 160 | + this.appEnvId = builder.appEnvId; |
| 161 | + this.deviceAlias = builder.deviceAlias; |
| 162 | + } |
| 163 | + |
| 164 | + /** |
| 165 | + * @return A new instance of the Builder |
| 166 | + */ |
| 167 | + public static Builder newBuilder() { |
| 168 | + return new Builder(); |
| 169 | + } |
| 170 | + |
| 171 | + /** |
| 172 | + * AppIdentity.Builder separates the construction of a AppIdentity from its representation |
| 173 | + */ |
| 174 | + @JsonIgnoreProperties(ignoreUnknown = true) |
| 175 | + public static class Builder { |
| 176 | + |
| 177 | + /** |
| 178 | + * The builder's deviceId |
| 179 | + */ |
| 180 | + @JsonProperty("DeviceID") |
| 181 | + private Integer deviceId; |
| 182 | + |
| 183 | + /** |
| 184 | + * The builder's deviceAppId |
| 185 | + */ |
| 186 | + @JsonProperty("DeviceAppID") |
| 187 | + private Integer deviceAppId; |
| 188 | + |
| 189 | + /** |
| 190 | + * The builder's appNameId |
| 191 | + */ |
| 192 | + @JsonProperty("AppNameID") |
| 193 | + private String appNameId; |
| 194 | + |
| 195 | + /** |
| 196 | + * The builder's envId |
| 197 | + */ |
| 198 | + @JsonProperty("EnvID") |
| 199 | + private Integer envId; |
| 200 | + |
| 201 | + /** |
| 202 | + * The builder's env |
| 203 | + */ |
| 204 | + @JsonProperty("Env") |
| 205 | + private String env; |
| 206 | + |
| 207 | + /** |
| 208 | + * The builder's appName |
| 209 | + */ |
| 210 | + @JsonProperty("AppName") |
| 211 | + private String appName; |
| 212 | + |
| 213 | + /** |
| 214 | + * The builder's appEnvId |
| 215 | + */ |
| 216 | + @JsonProperty("AppEnvID") |
| 217 | + private String appEnvId; |
| 218 | + |
| 219 | + /** |
| 220 | + * The builder's deviceAlias |
| 221 | + */ |
| 222 | + @JsonProperty("DeviceAlias") |
| 223 | + private String deviceAlias; |
| 224 | + |
| 225 | + /** |
| 226 | + * Sets the builder's deviceId |
| 227 | + * @param deviceId The deviceId to be set |
| 228 | + * @return Reference to the current object |
| 229 | + */ |
| 230 | + public Builder deviceId(final Integer deviceId) { |
| 231 | + this.deviceId = deviceId; |
| 232 | + return this; |
| 233 | + } |
| 234 | + |
| 235 | + /** |
| 236 | + * Sets the builder's deviceAppId |
| 237 | + * @param deviceAppId The deviceAppId to be set |
| 238 | + * @return Reference to the current object |
| 239 | + */ |
| 240 | + public Builder deviceAppId(final Integer deviceAppId) { |
| 241 | + this.deviceAppId = deviceAppId; |
| 242 | + return this; |
| 243 | + } |
| 244 | + |
| 245 | + /** |
| 246 | + * Sets the builder's appNameId |
| 247 | + * @param appNameId The appNameId to be set |
| 248 | + * @return Reference to the current object |
| 249 | + */ |
| 250 | + public Builder appNameId(final String appNameId) { |
| 251 | + this.appNameId = appNameId; |
| 252 | + return this; |
| 253 | + } |
| 254 | + |
| 255 | + /** |
| 256 | + * Sets the builder's envId |
| 257 | + * @param envId The envId to be set |
| 258 | + * @return Reference to the current object |
| 259 | + */ |
| 260 | + public Builder envId(final Integer envId) { |
| 261 | + this.envId = envId; |
| 262 | + return this; |
| 263 | + } |
| 264 | + |
| 265 | + /** |
| 266 | + * Sets the builder's env |
| 267 | + * @param env The env to be set |
| 268 | + * @return Reference to the current object |
| 269 | + */ |
| 270 | + public Builder env(final String env) { |
| 271 | + this.env = env; |
| 272 | + return this; |
| 273 | + } |
| 274 | + |
| 275 | + /** |
| 276 | + * Sets the builder's appName |
| 277 | + * @param appName The appName to be set |
| 278 | + * @return Reference to the current object |
| 279 | + */ |
| 280 | + public Builder appName(final String appName) { |
| 281 | + this.appName = appName; |
| 282 | + return this; |
| 283 | + } |
| 284 | + |
| 285 | + /** |
| 286 | + * Sets the builder's appEnvId |
| 287 | + * @param appEnvId The appEnvId to be set |
| 288 | + * @return Reference to the current object |
| 289 | + */ |
| 290 | + public Builder appEnvId(final String appEnvId) { |
| 291 | + this.appEnvId = appEnvId; |
| 292 | + return this; |
| 293 | + } |
| 294 | + |
| 295 | + /** |
| 296 | + * Sets the builder's deviceAlias |
| 297 | + * @param deviceAlias The deviceAlias to be set |
| 298 | + * @return Reference to the current object |
| 299 | + */ |
| 300 | + public Builder deviceAlias(final String deviceAlias) { |
| 301 | + this.deviceAlias = deviceAlias; |
| 302 | + return this; |
| 303 | + } |
| 304 | + |
| 305 | + /** |
| 306 | + * @return A new object constructed from this builder |
| 307 | + */ |
| 308 | + public AppIdentity build() { |
| 309 | + return new AppIdentity(this); |
| 310 | + } |
| 311 | + } |
| 312 | + |
| 313 | + /** |
| 314 | + * @see java.lang.Object#toString() |
| 315 | + */ |
| 316 | + @Override |
| 317 | + public String toString() { |
| 318 | + return "AppIdentity{deviceId=" + deviceId + ", deviceAppId=" |
| 319 | + + deviceAppId + ", appNameId=" + appNameId + ", envId=" + envId |
| 320 | + + ", env=" + env + ", appName=" + appName + ", appEnvId=" |
| 321 | + + appEnvId + ", deviceAlias=" + deviceAlias + "}"; |
| 322 | + } |
| 323 | +} |
0 commit comments