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 * PostalAddressLineDetailValue.java 021 */ 022 023package com.echothree.model.data.contact.server.value; 024 025import com.echothree.model.data.contact.common.pk.PostalAddressLineDetailPK; 026 027import com.echothree.model.data.contact.server.factory.PostalAddressLineDetailFactory; 028 029import com.echothree.model.data.contact.common.pk.PostalAddressLinePK; 030import com.echothree.model.data.contact.common.pk.PostalAddressFormatPK; 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 PostalAddressLineDetailValue 043 extends BaseValue<PostalAddressLineDetailPK> 044 implements Cloneable, Serializable { 045 046 private PostalAddressLinePK postalAddressLinePK; 047 private boolean postalAddressLinePKHasBeenModified = false; 048 private PostalAddressFormatPK postalAddressFormatPK; 049 private boolean postalAddressFormatPKHasBeenModified = false; 050 private Integer postalAddressLineSortOrder; 051 private boolean postalAddressLineSortOrderHasBeenModified = 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 Boolean collapseIfEmpty; 061 private boolean collapseIfEmptyHasBeenModified = false; 062 private Long fromTime; 063 private boolean fromTimeHasBeenModified = false; 064 private Long thruTime; 065 private boolean thruTimeHasBeenModified = false; 066 067 private transient Integer _hashCode = null; 068 private transient String _stringValue = null; 069 070 private void constructFields(PostalAddressLinePK postalAddressLinePK, PostalAddressFormatPK postalAddressFormatPK, Integer postalAddressLineSortOrder, String prefix, Boolean alwaysIncludePrefix, String suffix, Boolean alwaysIncludeSuffix, Boolean collapseIfEmpty, Long fromTime, Long thruTime) 071 throws PersistenceNotNullException { 072 checkForNull(postalAddressLinePK); 073 this.postalAddressLinePK = postalAddressLinePK; 074 checkForNull(postalAddressFormatPK); 075 this.postalAddressFormatPK = postalAddressFormatPK; 076 checkForNull(postalAddressLineSortOrder); 077 this.postalAddressLineSortOrder = postalAddressLineSortOrder; 078 this.prefix = prefix; 079 checkForNull(alwaysIncludePrefix); 080 this.alwaysIncludePrefix = alwaysIncludePrefix; 081 this.suffix = suffix; 082 checkForNull(alwaysIncludeSuffix); 083 this.alwaysIncludeSuffix = alwaysIncludeSuffix; 084 checkForNull(collapseIfEmpty); 085 this.collapseIfEmpty = collapseIfEmpty; 086 checkForNull(fromTime); 087 this.fromTime = fromTime; 088 checkForNull(thruTime); 089 this.thruTime = thruTime; 090 } 091 092 /** Creates a new instance of PostalAddressLineDetailValue */ 093 public PostalAddressLineDetailValue(PostalAddressLineDetailPK postalAddressLineDetailPK, PostalAddressLinePK postalAddressLinePK, PostalAddressFormatPK postalAddressFormatPK, Integer postalAddressLineSortOrder, String prefix, Boolean alwaysIncludePrefix, String suffix, Boolean alwaysIncludeSuffix, Boolean collapseIfEmpty, Long fromTime, Long thruTime) 094 throws PersistenceNotNullException { 095 super(postalAddressLineDetailPK); 096 constructFields(postalAddressLinePK, postalAddressFormatPK, postalAddressLineSortOrder, prefix, alwaysIncludePrefix, suffix, alwaysIncludeSuffix, collapseIfEmpty, fromTime, thruTime); 097 } 098 099 /** Creates a new instance of PostalAddressLineDetailValue */ 100 public PostalAddressLineDetailValue(PostalAddressLinePK postalAddressLinePK, PostalAddressFormatPK postalAddressFormatPK, Integer postalAddressLineSortOrder, String prefix, Boolean alwaysIncludePrefix, String suffix, Boolean alwaysIncludeSuffix, Boolean collapseIfEmpty, Long fromTime, Long thruTime) 101 throws PersistenceNotNullException { 102 super(); 103 constructFields(postalAddressLinePK, postalAddressFormatPK, postalAddressLineSortOrder, prefix, alwaysIncludePrefix, suffix, alwaysIncludeSuffix, collapseIfEmpty, fromTime, thruTime); 104 } 105 106 @Override 107 @Nonnull 108 public PostalAddressLineDetailFactory getBaseFactoryInstance() { 109 return PostalAddressLineDetailFactory.getInstance(); 110 } 111 112 @Override 113 @Nonnull 114 public PostalAddressLineDetailValue clone() { 115 Object result; 116 117 try { 118 result = super.clone(); 119 } catch (CloneNotSupportedException cnse) { 120 // This shouldn't happen, fail when it does. 121 throw new PersistenceCloneException(cnse); 122 } 123 124 return (PostalAddressLineDetailValue)result; 125 } 126 127 @Override 128 @Nonnull 129 public PostalAddressLineDetailPK getPrimaryKey() { 130 if(_primaryKey == null) { 131 _primaryKey = new PostalAddressLineDetailPK(entityId); 132 } 133 134 return _primaryKey; 135 } 136 137 private void clearHashAndString() { 138 _hashCode = null; 139 _stringValue = null; 140 } 141 142 @Override 143 public int hashCode() { 144 if(_hashCode == null) { 145 int hashCode = 17; 146 147 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 148 149 hashCode = 37 * hashCode + ((postalAddressLinePK != null) ? postalAddressLinePK.hashCode() : 0); 150 hashCode = 37 * hashCode + ((postalAddressFormatPK != null) ? postalAddressFormatPK.hashCode() : 0); 151 hashCode = 37 * hashCode + ((postalAddressLineSortOrder != null) ? postalAddressLineSortOrder.hashCode() : 0); 152 hashCode = 37 * hashCode + ((prefix != null) ? prefix.hashCode() : 0); 153 hashCode = 37 * hashCode + ((alwaysIncludePrefix != null) ? alwaysIncludePrefix.hashCode() : 0); 154 hashCode = 37 * hashCode + ((suffix != null) ? suffix.hashCode() : 0); 155 hashCode = 37 * hashCode + ((alwaysIncludeSuffix != null) ? alwaysIncludeSuffix.hashCode() : 0); 156 hashCode = 37 * hashCode + ((collapseIfEmpty != null) ? collapseIfEmpty.hashCode() : 0); 157 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 158 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 159 160 _hashCode = hashCode; 161 } 162 163 return _hashCode; 164 } 165 166 @Override 167 @Nonnull 168 public String toString() { 169 if(_stringValue == null) { 170 _stringValue = "{" + 171 "entityId=" + getEntityId() + 172 ", postalAddressLinePK=" + getPostalAddressLinePK() + 173 ", postalAddressFormatPK=" + getPostalAddressFormatPK() + 174 ", postalAddressLineSortOrder=" + getPostalAddressLineSortOrder() + 175 ", prefix=" + getPrefix() + 176 ", alwaysIncludePrefix=" + getAlwaysIncludePrefix() + 177 ", suffix=" + getSuffix() + 178 ", alwaysIncludeSuffix=" + getAlwaysIncludeSuffix() + 179 ", collapseIfEmpty=" + getCollapseIfEmpty() + 180 ", fromTime=" + getFromTime() + 181 ", thruTime=" + getThruTime() + 182 "}"; 183 } 184 return _stringValue; 185 } 186 187 @Override 188 public boolean equals(Object other) { 189 if(this == other) 190 return true; 191 192 if(!hasIdentity()) 193 return false; 194 195 if(other instanceof PostalAddressLineDetailValue that) { 196 if(!that.hasIdentity()) 197 return false; 198 199 Long thisEntityId = getEntityId(); 200 Long thatEntityId = that.getEntityId(); 201 202 boolean objectsEqual = thisEntityId.equals(thatEntityId); 203 if(objectsEqual) 204 objectsEqual = isIdentical(that); 205 206 return objectsEqual; 207 } else { 208 return false; 209 } 210 } 211 212 public boolean isIdentical(Object other) { 213 if(other instanceof PostalAddressLineDetailValue that) { 214 boolean objectsEqual = true; 215 216 217 if(objectsEqual) { 218 PostalAddressLinePK thisPostalAddressLinePK = getPostalAddressLinePK(); 219 PostalAddressLinePK thatPostalAddressLinePK = that.getPostalAddressLinePK(); 220 221 if(thisPostalAddressLinePK == null) { 222 objectsEqual = objectsEqual && (thatPostalAddressLinePK == null); 223 } else { 224 objectsEqual = objectsEqual && thisPostalAddressLinePK.equals(thatPostalAddressLinePK); 225 } 226 } 227 228 if(objectsEqual) { 229 PostalAddressFormatPK thisPostalAddressFormatPK = getPostalAddressFormatPK(); 230 PostalAddressFormatPK thatPostalAddressFormatPK = that.getPostalAddressFormatPK(); 231 232 if(thisPostalAddressFormatPK == null) { 233 objectsEqual = objectsEqual && (thatPostalAddressFormatPK == null); 234 } else { 235 objectsEqual = objectsEqual && thisPostalAddressFormatPK.equals(thatPostalAddressFormatPK); 236 } 237 } 238 239 if(objectsEqual) { 240 Integer thisPostalAddressLineSortOrder = getPostalAddressLineSortOrder(); 241 Integer thatPostalAddressLineSortOrder = that.getPostalAddressLineSortOrder(); 242 243 if(thisPostalAddressLineSortOrder == null) { 244 objectsEqual = objectsEqual && (thatPostalAddressLineSortOrder == null); 245 } else { 246 objectsEqual = objectsEqual && thisPostalAddressLineSortOrder.equals(thatPostalAddressLineSortOrder); 247 } 248 } 249 250 if(objectsEqual) { 251 String thisPrefix = getPrefix(); 252 String thatPrefix = that.getPrefix(); 253 254 if(thisPrefix == null) { 255 objectsEqual = objectsEqual && (thatPrefix == null); 256 } else { 257 objectsEqual = objectsEqual && thisPrefix.equals(thatPrefix); 258 } 259 } 260 261 if(objectsEqual) { 262 Boolean thisAlwaysIncludePrefix = getAlwaysIncludePrefix(); 263 Boolean thatAlwaysIncludePrefix = that.getAlwaysIncludePrefix(); 264 265 if(thisAlwaysIncludePrefix == null) { 266 objectsEqual = objectsEqual && (thatAlwaysIncludePrefix == null); 267 } else { 268 objectsEqual = objectsEqual && thisAlwaysIncludePrefix.equals(thatAlwaysIncludePrefix); 269 } 270 } 271 272 if(objectsEqual) { 273 String thisSuffix = getSuffix(); 274 String thatSuffix = that.getSuffix(); 275 276 if(thisSuffix == null) { 277 objectsEqual = objectsEqual && (thatSuffix == null); 278 } else { 279 objectsEqual = objectsEqual && thisSuffix.equals(thatSuffix); 280 } 281 } 282 283 if(objectsEqual) { 284 Boolean thisAlwaysIncludeSuffix = getAlwaysIncludeSuffix(); 285 Boolean thatAlwaysIncludeSuffix = that.getAlwaysIncludeSuffix(); 286 287 if(thisAlwaysIncludeSuffix == null) { 288 objectsEqual = objectsEqual && (thatAlwaysIncludeSuffix == null); 289 } else { 290 objectsEqual = objectsEqual && thisAlwaysIncludeSuffix.equals(thatAlwaysIncludeSuffix); 291 } 292 } 293 294 if(objectsEqual) { 295 Boolean thisCollapseIfEmpty = getCollapseIfEmpty(); 296 Boolean thatCollapseIfEmpty = that.getCollapseIfEmpty(); 297 298 if(thisCollapseIfEmpty == null) { 299 objectsEqual = objectsEqual && (thatCollapseIfEmpty == null); 300 } else { 301 objectsEqual = objectsEqual && thisCollapseIfEmpty.equals(thatCollapseIfEmpty); 302 } 303 } 304 305 if(objectsEqual) { 306 Long thisFromTime = getFromTime(); 307 Long thatFromTime = that.getFromTime(); 308 309 if(thisFromTime == null) { 310 objectsEqual = objectsEqual && (thatFromTime == null); 311 } else { 312 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 313 } 314 } 315 316 if(objectsEqual) { 317 Long thisThruTime = getThruTime(); 318 Long thatThruTime = that.getThruTime(); 319 320 if(thisThruTime == null) { 321 objectsEqual = objectsEqual && (thatThruTime == null); 322 } else { 323 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 324 } 325 } 326 327 return objectsEqual; 328 } else { 329 return false; 330 } 331 } 332 333 @Override 334 public boolean hasBeenModified() { 335 return postalAddressLinePKHasBeenModified || postalAddressFormatPKHasBeenModified || postalAddressLineSortOrderHasBeenModified || prefixHasBeenModified || alwaysIncludePrefixHasBeenModified || suffixHasBeenModified || alwaysIncludeSuffixHasBeenModified || collapseIfEmptyHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 336 } 337 338 @Override 339 public void clearHasBeenModified() { 340 postalAddressLinePKHasBeenModified = false; 341 postalAddressFormatPKHasBeenModified = false; 342 postalAddressLineSortOrderHasBeenModified = false; 343 prefixHasBeenModified = false; 344 alwaysIncludePrefixHasBeenModified = false; 345 suffixHasBeenModified = false; 346 alwaysIncludeSuffixHasBeenModified = false; 347 collapseIfEmptyHasBeenModified = false; 348 fromTimeHasBeenModified = false; 349 thruTimeHasBeenModified = false; 350 } 351 352 @Nonnull 353 public PostalAddressLinePK getPostalAddressLinePK() { 354 return postalAddressLinePK; 355 } 356 357 public void setPostalAddressLinePK(@Nonnull PostalAddressLinePK postalAddressLinePK) 358 throws PersistenceNotNullException { 359 checkForNull(postalAddressLinePK); 360 361 boolean update = true; 362 363 if(this.postalAddressLinePK != null) { 364 if(this.postalAddressLinePK.equals(postalAddressLinePK)) { 365 update = false; 366 } 367 } else if(postalAddressLinePK == null) { 368 update = false; 369 } 370 371 if(update) { 372 this.postalAddressLinePK = postalAddressLinePK; 373 postalAddressLinePKHasBeenModified = true; 374 clearHashAndString(); 375 } 376 } 377 378 public boolean getPostalAddressLinePKHasBeenModified() { 379 return postalAddressLinePKHasBeenModified; 380 } 381 382 @Nonnull 383 public PostalAddressFormatPK getPostalAddressFormatPK() { 384 return postalAddressFormatPK; 385 } 386 387 public void setPostalAddressFormatPK(@Nonnull PostalAddressFormatPK postalAddressFormatPK) 388 throws PersistenceNotNullException { 389 checkForNull(postalAddressFormatPK); 390 391 boolean update = true; 392 393 if(this.postalAddressFormatPK != null) { 394 if(this.postalAddressFormatPK.equals(postalAddressFormatPK)) { 395 update = false; 396 } 397 } else if(postalAddressFormatPK == null) { 398 update = false; 399 } 400 401 if(update) { 402 this.postalAddressFormatPK = postalAddressFormatPK; 403 postalAddressFormatPKHasBeenModified = true; 404 clearHashAndString(); 405 } 406 } 407 408 public boolean getPostalAddressFormatPKHasBeenModified() { 409 return postalAddressFormatPKHasBeenModified; 410 } 411 412 @Nonnull 413 public Integer getPostalAddressLineSortOrder() { 414 return postalAddressLineSortOrder; 415 } 416 417 public void setPostalAddressLineSortOrder(@Nonnull Integer postalAddressLineSortOrder) 418 throws PersistenceNotNullException { 419 checkForNull(postalAddressLineSortOrder); 420 421 boolean update = true; 422 423 if(this.postalAddressLineSortOrder != null) { 424 if(this.postalAddressLineSortOrder.equals(postalAddressLineSortOrder)) { 425 update = false; 426 } 427 } else if(postalAddressLineSortOrder == null) { 428 update = false; 429 } 430 431 if(update) { 432 this.postalAddressLineSortOrder = postalAddressLineSortOrder; 433 postalAddressLineSortOrderHasBeenModified = true; 434 clearHashAndString(); 435 } 436 } 437 438 public boolean getPostalAddressLineSortOrderHasBeenModified() { 439 return postalAddressLineSortOrderHasBeenModified; 440 } 441 442 @Nullable 443 public String getPrefix() { 444 return prefix; 445 } 446 447 public void setPrefix(@Nullable String prefix) { 448 boolean update = true; 449 450 if(this.prefix != null) { 451 if(this.prefix.equals(prefix)) { 452 update = false; 453 } 454 } else if(prefix == null) { 455 update = false; 456 } 457 458 if(update) { 459 this.prefix = prefix; 460 prefixHasBeenModified = true; 461 clearHashAndString(); 462 } 463 } 464 465 public boolean getPrefixHasBeenModified() { 466 return prefixHasBeenModified; 467 } 468 469 @Nonnull 470 public Boolean getAlwaysIncludePrefix() { 471 return alwaysIncludePrefix; 472 } 473 474 public void setAlwaysIncludePrefix(@Nonnull Boolean alwaysIncludePrefix) 475 throws PersistenceNotNullException { 476 checkForNull(alwaysIncludePrefix); 477 478 boolean update = true; 479 480 if(this.alwaysIncludePrefix != null) { 481 if(this.alwaysIncludePrefix.equals(alwaysIncludePrefix)) { 482 update = false; 483 } 484 } else if(alwaysIncludePrefix == null) { 485 update = false; 486 } 487 488 if(update) { 489 this.alwaysIncludePrefix = alwaysIncludePrefix; 490 alwaysIncludePrefixHasBeenModified = true; 491 clearHashAndString(); 492 } 493 } 494 495 public boolean getAlwaysIncludePrefixHasBeenModified() { 496 return alwaysIncludePrefixHasBeenModified; 497 } 498 499 @Nullable 500 public String getSuffix() { 501 return suffix; 502 } 503 504 public void setSuffix(@Nullable String suffix) { 505 boolean update = true; 506 507 if(this.suffix != null) { 508 if(this.suffix.equals(suffix)) { 509 update = false; 510 } 511 } else if(suffix == null) { 512 update = false; 513 } 514 515 if(update) { 516 this.suffix = suffix; 517 suffixHasBeenModified = true; 518 clearHashAndString(); 519 } 520 } 521 522 public boolean getSuffixHasBeenModified() { 523 return suffixHasBeenModified; 524 } 525 526 @Nonnull 527 public Boolean getAlwaysIncludeSuffix() { 528 return alwaysIncludeSuffix; 529 } 530 531 public void setAlwaysIncludeSuffix(@Nonnull Boolean alwaysIncludeSuffix) 532 throws PersistenceNotNullException { 533 checkForNull(alwaysIncludeSuffix); 534 535 boolean update = true; 536 537 if(this.alwaysIncludeSuffix != null) { 538 if(this.alwaysIncludeSuffix.equals(alwaysIncludeSuffix)) { 539 update = false; 540 } 541 } else if(alwaysIncludeSuffix == null) { 542 update = false; 543 } 544 545 if(update) { 546 this.alwaysIncludeSuffix = alwaysIncludeSuffix; 547 alwaysIncludeSuffixHasBeenModified = true; 548 clearHashAndString(); 549 } 550 } 551 552 public boolean getAlwaysIncludeSuffixHasBeenModified() { 553 return alwaysIncludeSuffixHasBeenModified; 554 } 555 556 @Nonnull 557 public Boolean getCollapseIfEmpty() { 558 return collapseIfEmpty; 559 } 560 561 public void setCollapseIfEmpty(@Nonnull Boolean collapseIfEmpty) 562 throws PersistenceNotNullException { 563 checkForNull(collapseIfEmpty); 564 565 boolean update = true; 566 567 if(this.collapseIfEmpty != null) { 568 if(this.collapseIfEmpty.equals(collapseIfEmpty)) { 569 update = false; 570 } 571 } else if(collapseIfEmpty == null) { 572 update = false; 573 } 574 575 if(update) { 576 this.collapseIfEmpty = collapseIfEmpty; 577 collapseIfEmptyHasBeenModified = true; 578 clearHashAndString(); 579 } 580 } 581 582 public boolean getCollapseIfEmptyHasBeenModified() { 583 return collapseIfEmptyHasBeenModified; 584 } 585 586 @Nonnull 587 public Long getFromTime() { 588 return fromTime; 589 } 590 591 public void setFromTime(@Nonnull Long fromTime) 592 throws PersistenceNotNullException { 593 checkForNull(fromTime); 594 595 boolean update = true; 596 597 if(this.fromTime != null) { 598 if(this.fromTime.equals(fromTime)) { 599 update = false; 600 } 601 } else if(fromTime == null) { 602 update = false; 603 } 604 605 if(update) { 606 this.fromTime = fromTime; 607 fromTimeHasBeenModified = true; 608 clearHashAndString(); 609 } 610 } 611 612 public boolean getFromTimeHasBeenModified() { 613 return fromTimeHasBeenModified; 614 } 615 616 @Nonnull 617 public Long getThruTime() { 618 return thruTime; 619 } 620 621 public void setThruTime(@Nonnull Long thruTime) 622 throws PersistenceNotNullException { 623 checkForNull(thruTime); 624 625 boolean update = true; 626 627 if(this.thruTime != null) { 628 if(this.thruTime.equals(thruTime)) { 629 update = false; 630 } 631 } else if(thruTime == null) { 632 update = false; 633 } 634 635 if(update) { 636 this.thruTime = thruTime; 637 thruTimeHasBeenModified = true; 638 clearHashAndString(); 639 } 640 } 641 642 public boolean getThruTimeHasBeenModified() { 643 return thruTimeHasBeenModified; 644 } 645 646}