001// -------------------------------------------------------------------------------- 002// Copyright 2002-2025 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 * ContactInet6AddressValue.java 021 */ 022 023package com.echothree.model.data.contact.server.value; 024 025import com.echothree.model.data.contact.common.pk.ContactInet6AddressPK; 026 027import com.echothree.model.data.contact.server.factory.ContactInet6AddressFactory; 028 029import com.echothree.model.data.contact.common.pk.ContactMechanismPK; 030 031import com.echothree.util.common.exception.PersistenceCloneException; 032import com.echothree.util.common.exception.PersistenceNotNullException; 033 034import com.echothree.util.server.persistence.BaseValue; 035 036import java.io.Serializable; 037 038public class ContactInet6AddressValue 039 extends BaseValue<ContactInet6AddressPK> 040 implements Cloneable, Serializable { 041 042 private ContactMechanismPK contactMechanismPK; 043 private boolean contactMechanismPKHasBeenModified = false; 044 private Long inet6AddressLow; 045 private boolean inet6AddressLowHasBeenModified = false; 046 private Long inet6AddressHigh; 047 private boolean inet6AddressHighHasBeenModified = false; 048 private Long fromTime; 049 private boolean fromTimeHasBeenModified = false; 050 private Long thruTime; 051 private boolean thruTimeHasBeenModified = false; 052 053 private transient Integer _hashCode = null; 054 private transient String _stringValue = null; 055 056 private void constructFields(ContactMechanismPK contactMechanismPK, Long inet6AddressLow, Long inet6AddressHigh, Long fromTime, Long thruTime) 057 throws PersistenceNotNullException { 058 checkForNull(contactMechanismPK); 059 this.contactMechanismPK = contactMechanismPK; 060 checkForNull(inet6AddressLow); 061 this.inet6AddressLow = inet6AddressLow; 062 checkForNull(inet6AddressHigh); 063 this.inet6AddressHigh = inet6AddressHigh; 064 checkForNull(fromTime); 065 this.fromTime = fromTime; 066 checkForNull(thruTime); 067 this.thruTime = thruTime; 068 } 069 070 /** Creates a new instance of ContactInet6AddressValue */ 071 public ContactInet6AddressValue(ContactInet6AddressPK contactInet6AddressPK, ContactMechanismPK contactMechanismPK, Long inet6AddressLow, Long inet6AddressHigh, Long fromTime, Long thruTime) 072 throws PersistenceNotNullException { 073 super(contactInet6AddressPK); 074 constructFields(contactMechanismPK, inet6AddressLow, inet6AddressHigh, fromTime, thruTime); 075 } 076 077 /** Creates a new instance of ContactInet6AddressValue */ 078 public ContactInet6AddressValue(ContactMechanismPK contactMechanismPK, Long inet6AddressLow, Long inet6AddressHigh, Long fromTime, Long thruTime) 079 throws PersistenceNotNullException { 080 super(); 081 constructFields(contactMechanismPK, inet6AddressLow, inet6AddressHigh, fromTime, thruTime); 082 } 083 084 @Override 085 public ContactInet6AddressFactory getBaseFactoryInstance() { 086 return ContactInet6AddressFactory.getInstance(); 087 } 088 089 @Override 090 public ContactInet6AddressValue clone() { 091 Object result; 092 093 try { 094 result = super.clone(); 095 } catch (CloneNotSupportedException cnse) { 096 // This shouldn't happen, fail when it does. 097 throw new PersistenceCloneException(cnse); 098 } 099 100 return (ContactInet6AddressValue)result; 101 } 102 103 @Override 104 public ContactInet6AddressPK getPrimaryKey() { 105 if(_primaryKey == null) { 106 _primaryKey = new ContactInet6AddressPK(entityId); 107 } 108 109 return _primaryKey; 110 } 111 112 private void clearHashAndString() { 113 _hashCode = null; 114 _stringValue = null; 115 } 116 117 @Override 118 public int hashCode() { 119 if(_hashCode == null) { 120 int hashCode = 17; 121 122 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 123 124 hashCode = 37 * hashCode + ((contactMechanismPK != null) ? contactMechanismPK.hashCode() : 0); 125 hashCode = 37 * hashCode + ((inet6AddressLow != null) ? inet6AddressLow.hashCode() : 0); 126 hashCode = 37 * hashCode + ((inet6AddressHigh != null) ? inet6AddressHigh.hashCode() : 0); 127 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 128 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 129 130 _hashCode = hashCode; 131 } 132 133 return _hashCode; 134 } 135 136 @Override 137 public String toString() { 138 if(_stringValue == null) { 139 _stringValue = "{" + 140 "entityId=" + getEntityId() + 141 ", contactMechanismPK=" + getContactMechanismPK() + 142 ", inet6AddressLow=" + getInet6AddressLow() + 143 ", inet6AddressHigh=" + getInet6AddressHigh() + 144 ", fromTime=" + getFromTime() + 145 ", thruTime=" + getThruTime() + 146 "}"; 147 } 148 return _stringValue; 149 } 150 151 @Override 152 public boolean equals(Object other) { 153 if(this == other) 154 return true; 155 156 if(!hasIdentity()) 157 return false; 158 159 if(other instanceof ContactInet6AddressValue that) { 160 if(!that.hasIdentity()) 161 return false; 162 163 Long thisEntityId = getEntityId(); 164 Long thatEntityId = that.getEntityId(); 165 166 boolean objectsEqual = thisEntityId.equals(thatEntityId); 167 if(objectsEqual) 168 objectsEqual = isIdentical(that); 169 170 return objectsEqual; 171 } else { 172 return false; 173 } 174 } 175 176 public boolean isIdentical(Object other) { 177 if(other instanceof ContactInet6AddressValue that) { 178 boolean objectsEqual = true; 179 180 181 if(objectsEqual) { 182 ContactMechanismPK thisContactMechanismPK = getContactMechanismPK(); 183 ContactMechanismPK thatContactMechanismPK = that.getContactMechanismPK(); 184 185 if(thisContactMechanismPK == null) { 186 objectsEqual = objectsEqual && (thatContactMechanismPK == null); 187 } else { 188 objectsEqual = objectsEqual && thisContactMechanismPK.equals(thatContactMechanismPK); 189 } 190 } 191 192 if(objectsEqual) { 193 Long thisInet6AddressLow = getInet6AddressLow(); 194 Long thatInet6AddressLow = that.getInet6AddressLow(); 195 196 if(thisInet6AddressLow == null) { 197 objectsEqual = objectsEqual && (thatInet6AddressLow == null); 198 } else { 199 objectsEqual = objectsEqual && thisInet6AddressLow.equals(thatInet6AddressLow); 200 } 201 } 202 203 if(objectsEqual) { 204 Long thisInet6AddressHigh = getInet6AddressHigh(); 205 Long thatInet6AddressHigh = that.getInet6AddressHigh(); 206 207 if(thisInet6AddressHigh == null) { 208 objectsEqual = objectsEqual && (thatInet6AddressHigh == null); 209 } else { 210 objectsEqual = objectsEqual && thisInet6AddressHigh.equals(thatInet6AddressHigh); 211 } 212 } 213 214 if(objectsEqual) { 215 Long thisFromTime = getFromTime(); 216 Long thatFromTime = that.getFromTime(); 217 218 if(thisFromTime == null) { 219 objectsEqual = objectsEqual && (thatFromTime == null); 220 } else { 221 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 222 } 223 } 224 225 if(objectsEqual) { 226 Long thisThruTime = getThruTime(); 227 Long thatThruTime = that.getThruTime(); 228 229 if(thisThruTime == null) { 230 objectsEqual = objectsEqual && (thatThruTime == null); 231 } else { 232 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 233 } 234 } 235 236 return objectsEqual; 237 } else { 238 return false; 239 } 240 } 241 242 @Override 243 public boolean hasBeenModified() { 244 return contactMechanismPKHasBeenModified || inet6AddressLowHasBeenModified || inet6AddressHighHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 245 } 246 247 @Override 248 public void clearHasBeenModified() { 249 contactMechanismPKHasBeenModified = false; 250 inet6AddressLowHasBeenModified = false; 251 inet6AddressHighHasBeenModified = false; 252 fromTimeHasBeenModified = false; 253 thruTimeHasBeenModified = false; 254 } 255 256 public ContactMechanismPK getContactMechanismPK() { 257 return contactMechanismPK; 258 } 259 260 public void setContactMechanismPK(ContactMechanismPK contactMechanismPK) 261 throws PersistenceNotNullException { 262 checkForNull(contactMechanismPK); 263 264 boolean update = true; 265 266 if(this.contactMechanismPK != null) { 267 if(this.contactMechanismPK.equals(contactMechanismPK)) { 268 update = false; 269 } 270 } else if(contactMechanismPK == null) { 271 update = false; 272 } 273 274 if(update) { 275 this.contactMechanismPK = contactMechanismPK; 276 contactMechanismPKHasBeenModified = true; 277 clearHashAndString(); 278 } 279 } 280 281 public boolean getContactMechanismPKHasBeenModified() { 282 return contactMechanismPKHasBeenModified; 283 } 284 285 public Long getInet6AddressLow() { 286 return inet6AddressLow; 287 } 288 289 public void setInet6AddressLow(Long inet6AddressLow) 290 throws PersistenceNotNullException { 291 checkForNull(inet6AddressLow); 292 293 boolean update = true; 294 295 if(this.inet6AddressLow != null) { 296 if(this.inet6AddressLow.equals(inet6AddressLow)) { 297 update = false; 298 } 299 } else if(inet6AddressLow == null) { 300 update = false; 301 } 302 303 if(update) { 304 this.inet6AddressLow = inet6AddressLow; 305 inet6AddressLowHasBeenModified = true; 306 clearHashAndString(); 307 } 308 } 309 310 public boolean getInet6AddressLowHasBeenModified() { 311 return inet6AddressLowHasBeenModified; 312 } 313 314 public Long getInet6AddressHigh() { 315 return inet6AddressHigh; 316 } 317 318 public void setInet6AddressHigh(Long inet6AddressHigh) 319 throws PersistenceNotNullException { 320 checkForNull(inet6AddressHigh); 321 322 boolean update = true; 323 324 if(this.inet6AddressHigh != null) { 325 if(this.inet6AddressHigh.equals(inet6AddressHigh)) { 326 update = false; 327 } 328 } else if(inet6AddressHigh == null) { 329 update = false; 330 } 331 332 if(update) { 333 this.inet6AddressHigh = inet6AddressHigh; 334 inet6AddressHighHasBeenModified = true; 335 clearHashAndString(); 336 } 337 } 338 339 public boolean getInet6AddressHighHasBeenModified() { 340 return inet6AddressHighHasBeenModified; 341 } 342 343 public Long getFromTime() { 344 return fromTime; 345 } 346 347 public void setFromTime(Long fromTime) 348 throws PersistenceNotNullException { 349 checkForNull(fromTime); 350 351 boolean update = true; 352 353 if(this.fromTime != null) { 354 if(this.fromTime.equals(fromTime)) { 355 update = false; 356 } 357 } else if(fromTime == null) { 358 update = false; 359 } 360 361 if(update) { 362 this.fromTime = fromTime; 363 fromTimeHasBeenModified = true; 364 clearHashAndString(); 365 } 366 } 367 368 public boolean getFromTimeHasBeenModified() { 369 return fromTimeHasBeenModified; 370 } 371 372 public Long getThruTime() { 373 return thruTime; 374 } 375 376 public void setThruTime(Long thruTime) 377 throws PersistenceNotNullException { 378 checkForNull(thruTime); 379 380 boolean update = true; 381 382 if(this.thruTime != null) { 383 if(this.thruTime.equals(thruTime)) { 384 update = false; 385 } 386 } else if(thruTime == null) { 387 update = false; 388 } 389 390 if(update) { 391 this.thruTime = thruTime; 392 thruTimeHasBeenModified = true; 393 clearHashAndString(); 394 } 395 } 396 397 public boolean getThruTimeHasBeenModified() { 398 return thruTimeHasBeenModified; 399 } 400 401}