001// -------------------------------------------------------------------------------- 002// Copyright 2002-2026 Echo Three, LLC 003// 004// Licensed under the Apache License, Version 2.0 (the "License"); 005// you may not use this file except in compliance with the License. 006// You may obtain a copy of the License at 007// 008// http://www.apache.org/licenses/LICENSE-2.0 009// 010// Unless required by applicable law or agreed to in writing, software 011// distributed under the License is distributed on an "AS IS" BASIS, 012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013// See the License for the specific language governing permissions and 014// limitations under the License. 015// -------------------------------------------------------------------------------- 016// Generated File -- DO NOT EDIT BY HAND 017// -------------------------------------------------------------------------------- 018 019/** 020 * PostalAddressLineElementValue.java 021 */ 022 023package com.echothree.model.data.contact.server.value; 024 025import com.echothree.model.data.contact.common.pk.PostalAddressLineElementPK; 026 027import com.echothree.model.data.contact.server.factory.PostalAddressLineElementFactory; 028 029import com.echothree.model.data.contact.common.pk.PostalAddressLinePK; 030import com.echothree.model.data.contact.common.pk.PostalAddressElementTypePK; 031 032import com.echothree.util.common.exception.PersistenceCloneException; 033import com.echothree.util.common.exception.PersistenceNotNullException; 034 035import com.echothree.util.server.persistence.BaseValue; 036 037import java.io.Serializable; 038 039import javax.annotation.Nonnull; 040import javax.annotation.Nullable; 041 042public class PostalAddressLineElementValue 043 extends BaseValue<PostalAddressLineElementPK> 044 implements Cloneable, Serializable { 045 046 private PostalAddressLinePK postalAddressLinePK; 047 private boolean postalAddressLinePKHasBeenModified = false; 048 private Integer postalAddressLineElementSortOrder; 049 private boolean postalAddressLineElementSortOrderHasBeenModified = false; 050 private PostalAddressElementTypePK postalAddressElementTypePK; 051 private boolean postalAddressElementTypePKHasBeenModified = false; 052 private String prefix; 053 private boolean prefixHasBeenModified = false; 054 private Boolean alwaysIncludePrefix; 055 private boolean alwaysIncludePrefixHasBeenModified = false; 056 private String suffix; 057 private boolean suffixHasBeenModified = false; 058 private Boolean alwaysIncludeSuffix; 059 private boolean alwaysIncludeSuffixHasBeenModified = false; 060 private Long fromTime; 061 private boolean fromTimeHasBeenModified = false; 062 private Long thruTime; 063 private boolean thruTimeHasBeenModified = false; 064 065 private transient Integer _hashCode = null; 066 private transient String _stringValue = null; 067 068 private void constructFields(PostalAddressLinePK postalAddressLinePK, Integer postalAddressLineElementSortOrder, PostalAddressElementTypePK postalAddressElementTypePK, String prefix, Boolean alwaysIncludePrefix, String suffix, Boolean alwaysIncludeSuffix, Long fromTime, Long thruTime) 069 throws PersistenceNotNullException { 070 checkForNull(postalAddressLinePK); 071 this.postalAddressLinePK = postalAddressLinePK; 072 checkForNull(postalAddressLineElementSortOrder); 073 this.postalAddressLineElementSortOrder = postalAddressLineElementSortOrder; 074 checkForNull(postalAddressElementTypePK); 075 this.postalAddressElementTypePK = postalAddressElementTypePK; 076 this.prefix = prefix; 077 checkForNull(alwaysIncludePrefix); 078 this.alwaysIncludePrefix = alwaysIncludePrefix; 079 this.suffix = suffix; 080 checkForNull(alwaysIncludeSuffix); 081 this.alwaysIncludeSuffix = alwaysIncludeSuffix; 082 checkForNull(fromTime); 083 this.fromTime = fromTime; 084 checkForNull(thruTime); 085 this.thruTime = thruTime; 086 } 087 088 /** Creates a new instance of PostalAddressLineElementValue */ 089 public PostalAddressLineElementValue(PostalAddressLineElementPK postalAddressLineElementPK, PostalAddressLinePK postalAddressLinePK, Integer postalAddressLineElementSortOrder, PostalAddressElementTypePK postalAddressElementTypePK, String prefix, Boolean alwaysIncludePrefix, String suffix, Boolean alwaysIncludeSuffix, Long fromTime, Long thruTime) 090 throws PersistenceNotNullException { 091 super(postalAddressLineElementPK); 092 constructFields(postalAddressLinePK, postalAddressLineElementSortOrder, postalAddressElementTypePK, prefix, alwaysIncludePrefix, suffix, alwaysIncludeSuffix, fromTime, thruTime); 093 } 094 095 /** Creates a new instance of PostalAddressLineElementValue */ 096 public PostalAddressLineElementValue(PostalAddressLinePK postalAddressLinePK, Integer postalAddressLineElementSortOrder, PostalAddressElementTypePK postalAddressElementTypePK, String prefix, Boolean alwaysIncludePrefix, String suffix, Boolean alwaysIncludeSuffix, Long fromTime, Long thruTime) 097 throws PersistenceNotNullException { 098 super(); 099 constructFields(postalAddressLinePK, postalAddressLineElementSortOrder, postalAddressElementTypePK, prefix, alwaysIncludePrefix, suffix, alwaysIncludeSuffix, fromTime, thruTime); 100 } 101 102 @Override 103 @Nonnull 104 public PostalAddressLineElementFactory getBaseFactoryInstance() { 105 return PostalAddressLineElementFactory.getInstance(); 106 } 107 108 @Override 109 @Nonnull 110 public PostalAddressLineElementValue clone() { 111 Object result; 112 113 try { 114 result = super.clone(); 115 } catch (CloneNotSupportedException cnse) { 116 // This shouldn't happen, fail when it does. 117 throw new PersistenceCloneException(cnse); 118 } 119 120 return (PostalAddressLineElementValue)result; 121 } 122 123 @Override 124 @Nonnull 125 public PostalAddressLineElementPK getPrimaryKey() { 126 if(_primaryKey == null) { 127 _primaryKey = new PostalAddressLineElementPK(entityId); 128 } 129 130 return _primaryKey; 131 } 132 133 private void clearHashAndString() { 134 _hashCode = null; 135 _stringValue = null; 136 } 137 138 @Override 139 public int hashCode() { 140 if(_hashCode == null) { 141 int hashCode = 17; 142 143 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 144 145 hashCode = 37 * hashCode + ((postalAddressLinePK != null) ? postalAddressLinePK.hashCode() : 0); 146 hashCode = 37 * hashCode + ((postalAddressLineElementSortOrder != null) ? postalAddressLineElementSortOrder.hashCode() : 0); 147 hashCode = 37 * hashCode + ((postalAddressElementTypePK != null) ? postalAddressElementTypePK.hashCode() : 0); 148 hashCode = 37 * hashCode + ((prefix != null) ? prefix.hashCode() : 0); 149 hashCode = 37 * hashCode + ((alwaysIncludePrefix != null) ? alwaysIncludePrefix.hashCode() : 0); 150 hashCode = 37 * hashCode + ((suffix != null) ? suffix.hashCode() : 0); 151 hashCode = 37 * hashCode + ((alwaysIncludeSuffix != null) ? alwaysIncludeSuffix.hashCode() : 0); 152 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 153 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 154 155 _hashCode = hashCode; 156 } 157 158 return _hashCode; 159 } 160 161 @Override 162 @Nonnull 163 public String toString() { 164 if(_stringValue == null) { 165 _stringValue = "{" + 166 "entityId=" + getEntityId() + 167 ", postalAddressLinePK=" + getPostalAddressLinePK() + 168 ", postalAddressLineElementSortOrder=" + getPostalAddressLineElementSortOrder() + 169 ", postalAddressElementTypePK=" + getPostalAddressElementTypePK() + 170 ", prefix=" + getPrefix() + 171 ", alwaysIncludePrefix=" + getAlwaysIncludePrefix() + 172 ", suffix=" + getSuffix() + 173 ", alwaysIncludeSuffix=" + getAlwaysIncludeSuffix() + 174 ", fromTime=" + getFromTime() + 175 ", thruTime=" + getThruTime() + 176 "}"; 177 } 178 return _stringValue; 179 } 180 181 @Override 182 public boolean equals(Object other) { 183 if(this == other) 184 return true; 185 186 if(!hasIdentity()) 187 return false; 188 189 if(other instanceof PostalAddressLineElementValue that) { 190 if(!that.hasIdentity()) 191 return false; 192 193 Long thisEntityId = getEntityId(); 194 Long thatEntityId = that.getEntityId(); 195 196 boolean objectsEqual = thisEntityId.equals(thatEntityId); 197 if(objectsEqual) 198 objectsEqual = isIdentical(that); 199 200 return objectsEqual; 201 } else { 202 return false; 203 } 204 } 205 206 public boolean isIdentical(Object other) { 207 if(other instanceof PostalAddressLineElementValue that) { 208 boolean objectsEqual = true; 209 210 211 if(objectsEqual) { 212 PostalAddressLinePK thisPostalAddressLinePK = getPostalAddressLinePK(); 213 PostalAddressLinePK thatPostalAddressLinePK = that.getPostalAddressLinePK(); 214 215 if(thisPostalAddressLinePK == null) { 216 objectsEqual = objectsEqual && (thatPostalAddressLinePK == null); 217 } else { 218 objectsEqual = objectsEqual && thisPostalAddressLinePK.equals(thatPostalAddressLinePK); 219 } 220 } 221 222 if(objectsEqual) { 223 Integer thisPostalAddressLineElementSortOrder = getPostalAddressLineElementSortOrder(); 224 Integer thatPostalAddressLineElementSortOrder = that.getPostalAddressLineElementSortOrder(); 225 226 if(thisPostalAddressLineElementSortOrder == null) { 227 objectsEqual = objectsEqual && (thatPostalAddressLineElementSortOrder == null); 228 } else { 229 objectsEqual = objectsEqual && thisPostalAddressLineElementSortOrder.equals(thatPostalAddressLineElementSortOrder); 230 } 231 } 232 233 if(objectsEqual) { 234 PostalAddressElementTypePK thisPostalAddressElementTypePK = getPostalAddressElementTypePK(); 235 PostalAddressElementTypePK thatPostalAddressElementTypePK = that.getPostalAddressElementTypePK(); 236 237 if(thisPostalAddressElementTypePK == null) { 238 objectsEqual = objectsEqual && (thatPostalAddressElementTypePK == null); 239 } else { 240 objectsEqual = objectsEqual && thisPostalAddressElementTypePK.equals(thatPostalAddressElementTypePK); 241 } 242 } 243 244 if(objectsEqual) { 245 String thisPrefix = getPrefix(); 246 String thatPrefix = that.getPrefix(); 247 248 if(thisPrefix == null) { 249 objectsEqual = objectsEqual && (thatPrefix == null); 250 } else { 251 objectsEqual = objectsEqual && thisPrefix.equals(thatPrefix); 252 } 253 } 254 255 if(objectsEqual) { 256 Boolean thisAlwaysIncludePrefix = getAlwaysIncludePrefix(); 257 Boolean thatAlwaysIncludePrefix = that.getAlwaysIncludePrefix(); 258 259 if(thisAlwaysIncludePrefix == null) { 260 objectsEqual = objectsEqual && (thatAlwaysIncludePrefix == null); 261 } else { 262 objectsEqual = objectsEqual && thisAlwaysIncludePrefix.equals(thatAlwaysIncludePrefix); 263 } 264 } 265 266 if(objectsEqual) { 267 String thisSuffix = getSuffix(); 268 String thatSuffix = that.getSuffix(); 269 270 if(thisSuffix == null) { 271 objectsEqual = objectsEqual && (thatSuffix == null); 272 } else { 273 objectsEqual = objectsEqual && thisSuffix.equals(thatSuffix); 274 } 275 } 276 277 if(objectsEqual) { 278 Boolean thisAlwaysIncludeSuffix = getAlwaysIncludeSuffix(); 279 Boolean thatAlwaysIncludeSuffix = that.getAlwaysIncludeSuffix(); 280 281 if(thisAlwaysIncludeSuffix == null) { 282 objectsEqual = objectsEqual && (thatAlwaysIncludeSuffix == null); 283 } else { 284 objectsEqual = objectsEqual && thisAlwaysIncludeSuffix.equals(thatAlwaysIncludeSuffix); 285 } 286 } 287 288 if(objectsEqual) { 289 Long thisFromTime = getFromTime(); 290 Long thatFromTime = that.getFromTime(); 291 292 if(thisFromTime == null) { 293 objectsEqual = objectsEqual && (thatFromTime == null); 294 } else { 295 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 296 } 297 } 298 299 if(objectsEqual) { 300 Long thisThruTime = getThruTime(); 301 Long thatThruTime = that.getThruTime(); 302 303 if(thisThruTime == null) { 304 objectsEqual = objectsEqual && (thatThruTime == null); 305 } else { 306 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 307 } 308 } 309 310 return objectsEqual; 311 } else { 312 return false; 313 } 314 } 315 316 @Override 317 public boolean hasBeenModified() { 318 return postalAddressLinePKHasBeenModified || postalAddressLineElementSortOrderHasBeenModified || postalAddressElementTypePKHasBeenModified || prefixHasBeenModified || alwaysIncludePrefixHasBeenModified || suffixHasBeenModified || alwaysIncludeSuffixHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 319 } 320 321 @Override 322 public void clearHasBeenModified() { 323 postalAddressLinePKHasBeenModified = false; 324 postalAddressLineElementSortOrderHasBeenModified = false; 325 postalAddressElementTypePKHasBeenModified = false; 326 prefixHasBeenModified = false; 327 alwaysIncludePrefixHasBeenModified = false; 328 suffixHasBeenModified = false; 329 alwaysIncludeSuffixHasBeenModified = false; 330 fromTimeHasBeenModified = false; 331 thruTimeHasBeenModified = false; 332 } 333 334 @Nonnull 335 public PostalAddressLinePK getPostalAddressLinePK() { 336 return postalAddressLinePK; 337 } 338 339 public void setPostalAddressLinePK(@Nonnull PostalAddressLinePK postalAddressLinePK) 340 throws PersistenceNotNullException { 341 checkForNull(postalAddressLinePK); 342 343 boolean update = true; 344 345 if(this.postalAddressLinePK != null) { 346 if(this.postalAddressLinePK.equals(postalAddressLinePK)) { 347 update = false; 348 } 349 } else if(postalAddressLinePK == null) { 350 update = false; 351 } 352 353 if(update) { 354 this.postalAddressLinePK = postalAddressLinePK; 355 postalAddressLinePKHasBeenModified = true; 356 clearHashAndString(); 357 } 358 } 359 360 public boolean getPostalAddressLinePKHasBeenModified() { 361 return postalAddressLinePKHasBeenModified; 362 } 363 364 @Nonnull 365 public Integer getPostalAddressLineElementSortOrder() { 366 return postalAddressLineElementSortOrder; 367 } 368 369 public void setPostalAddressLineElementSortOrder(@Nonnull Integer postalAddressLineElementSortOrder) 370 throws PersistenceNotNullException { 371 checkForNull(postalAddressLineElementSortOrder); 372 373 boolean update = true; 374 375 if(this.postalAddressLineElementSortOrder != null) { 376 if(this.postalAddressLineElementSortOrder.equals(postalAddressLineElementSortOrder)) { 377 update = false; 378 } 379 } else if(postalAddressLineElementSortOrder == null) { 380 update = false; 381 } 382 383 if(update) { 384 this.postalAddressLineElementSortOrder = postalAddressLineElementSortOrder; 385 postalAddressLineElementSortOrderHasBeenModified = true; 386 clearHashAndString(); 387 } 388 } 389 390 public boolean getPostalAddressLineElementSortOrderHasBeenModified() { 391 return postalAddressLineElementSortOrderHasBeenModified; 392 } 393 394 @Nonnull 395 public PostalAddressElementTypePK getPostalAddressElementTypePK() { 396 return postalAddressElementTypePK; 397 } 398 399 public void setPostalAddressElementTypePK(@Nonnull PostalAddressElementTypePK postalAddressElementTypePK) 400 throws PersistenceNotNullException { 401 checkForNull(postalAddressElementTypePK); 402 403 boolean update = true; 404 405 if(this.postalAddressElementTypePK != null) { 406 if(this.postalAddressElementTypePK.equals(postalAddressElementTypePK)) { 407 update = false; 408 } 409 } else if(postalAddressElementTypePK == null) { 410 update = false; 411 } 412 413 if(update) { 414 this.postalAddressElementTypePK = postalAddressElementTypePK; 415 postalAddressElementTypePKHasBeenModified = true; 416 clearHashAndString(); 417 } 418 } 419 420 public boolean getPostalAddressElementTypePKHasBeenModified() { 421 return postalAddressElementTypePKHasBeenModified; 422 } 423 424 @Nullable 425 public String getPrefix() { 426 return prefix; 427 } 428 429 public void setPrefix(@Nullable String prefix) { 430 boolean update = true; 431 432 if(this.prefix != null) { 433 if(this.prefix.equals(prefix)) { 434 update = false; 435 } 436 } else if(prefix == null) { 437 update = false; 438 } 439 440 if(update) { 441 this.prefix = prefix; 442 prefixHasBeenModified = true; 443 clearHashAndString(); 444 } 445 } 446 447 public boolean getPrefixHasBeenModified() { 448 return prefixHasBeenModified; 449 } 450 451 @Nonnull 452 public Boolean getAlwaysIncludePrefix() { 453 return alwaysIncludePrefix; 454 } 455 456 public void setAlwaysIncludePrefix(@Nonnull Boolean alwaysIncludePrefix) 457 throws PersistenceNotNullException { 458 checkForNull(alwaysIncludePrefix); 459 460 boolean update = true; 461 462 if(this.alwaysIncludePrefix != null) { 463 if(this.alwaysIncludePrefix.equals(alwaysIncludePrefix)) { 464 update = false; 465 } 466 } else if(alwaysIncludePrefix == null) { 467 update = false; 468 } 469 470 if(update) { 471 this.alwaysIncludePrefix = alwaysIncludePrefix; 472 alwaysIncludePrefixHasBeenModified = true; 473 clearHashAndString(); 474 } 475 } 476 477 public boolean getAlwaysIncludePrefixHasBeenModified() { 478 return alwaysIncludePrefixHasBeenModified; 479 } 480 481 @Nullable 482 public String getSuffix() { 483 return suffix; 484 } 485 486 public void setSuffix(@Nullable String suffix) { 487 boolean update = true; 488 489 if(this.suffix != null) { 490 if(this.suffix.equals(suffix)) { 491 update = false; 492 } 493 } else if(suffix == null) { 494 update = false; 495 } 496 497 if(update) { 498 this.suffix = suffix; 499 suffixHasBeenModified = true; 500 clearHashAndString(); 501 } 502 } 503 504 public boolean getSuffixHasBeenModified() { 505 return suffixHasBeenModified; 506 } 507 508 @Nonnull 509 public Boolean getAlwaysIncludeSuffix() { 510 return alwaysIncludeSuffix; 511 } 512 513 public void setAlwaysIncludeSuffix(@Nonnull Boolean alwaysIncludeSuffix) 514 throws PersistenceNotNullException { 515 checkForNull(alwaysIncludeSuffix); 516 517 boolean update = true; 518 519 if(this.alwaysIncludeSuffix != null) { 520 if(this.alwaysIncludeSuffix.equals(alwaysIncludeSuffix)) { 521 update = false; 522 } 523 } else if(alwaysIncludeSuffix == null) { 524 update = false; 525 } 526 527 if(update) { 528 this.alwaysIncludeSuffix = alwaysIncludeSuffix; 529 alwaysIncludeSuffixHasBeenModified = true; 530 clearHashAndString(); 531 } 532 } 533 534 public boolean getAlwaysIncludeSuffixHasBeenModified() { 535 return alwaysIncludeSuffixHasBeenModified; 536 } 537 538 @Nonnull 539 public Long getFromTime() { 540 return fromTime; 541 } 542 543 public void setFromTime(@Nonnull Long fromTime) 544 throws PersistenceNotNullException { 545 checkForNull(fromTime); 546 547 boolean update = true; 548 549 if(this.fromTime != null) { 550 if(this.fromTime.equals(fromTime)) { 551 update = false; 552 } 553 } else if(fromTime == null) { 554 update = false; 555 } 556 557 if(update) { 558 this.fromTime = fromTime; 559 fromTimeHasBeenModified = true; 560 clearHashAndString(); 561 } 562 } 563 564 public boolean getFromTimeHasBeenModified() { 565 return fromTimeHasBeenModified; 566 } 567 568 @Nonnull 569 public Long getThruTime() { 570 return thruTime; 571 } 572 573 public void setThruTime(@Nonnull Long thruTime) 574 throws PersistenceNotNullException { 575 checkForNull(thruTime); 576 577 boolean update = true; 578 579 if(this.thruTime != null) { 580 if(this.thruTime.equals(thruTime)) { 581 update = false; 582 } 583 } else if(thruTime == null) { 584 update = false; 585 } 586 587 if(update) { 588 this.thruTime = thruTime; 589 thruTimeHasBeenModified = true; 590 clearHashAndString(); 591 } 592 } 593 594 public boolean getThruTimeHasBeenModified() { 595 return thruTimeHasBeenModified; 596 } 597 598}