001/*- 002 * #%L 003 * Smile CDR - CDR 004 * %% 005 * Copyright (C) 2016 - 2024 Smile CDR, Inc. 006 * %% 007 * All rights reserved. 008 * #L% 009 */ 010package ca.cdr.api.model.json; 011 012import com.fasterxml.jackson.annotation.JsonAutoDetect; 013import org.apache.commons.lang3.builder.EqualsBuilder; 014import org.apache.commons.lang3.builder.HashCodeBuilder; 015import org.apache.commons.lang3.builder.ToStringBuilder; 016// TODO: move this to hapi, in the same package as IModelJson 017 018@JsonAutoDetect( 019 creatorVisibility = JsonAutoDetect.Visibility.ANY, 020 fieldVisibility = JsonAutoDetect.Visibility.ANY, 021 getterVisibility = JsonAutoDetect.Visibility.ANY, 022 isGetterVisibility = JsonAutoDetect.Visibility.ANY, 023 setterVisibility = JsonAutoDetect.Visibility.ANY) 024public abstract class AbstractModelJson implements IModelJson { 025 @Override 026 public boolean equals(Object object) { 027 if (this == object) { 028 return true; 029 } 030 if (object == null || getClass() != object.getClass()) { 031 return false; 032 } 033 return EqualsBuilder.reflectionEquals(this, object); 034 } 035 036 @Override 037 public int hashCode() { 038 return HashCodeBuilder.reflectionHashCode(this); 039 } 040 041 @Override 042 public String toString() { 043 return ToStringBuilder.reflectionToString(this); 044 } 045}