All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.envers.internal.entities.RevisionTimestampData Maven / Gradle / Ivy

There is a newer version: 7.0.0.Beta2
Show newest version
/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
 * See the lgpl.txt file in the root directory or .
 */
package org.hibernate.envers.internal.entities;

import java.util.Objects;

/**
 * @author Chris Cranford
 * @author 6.0
 */
public class RevisionTimestampData extends PropertyData {

	private final String typeName;

	public RevisionTimestampData(String name, String beanName, String accessType, String typeName) {
		super( name, beanName, accessType );
		this.typeName = typeName;
	}

	public RevisionTimestampData(RevisionTimestampData old, String typeName) {
		this( old.getName(), old.getBeanName(), old.getAccessType(), typeName );
	}

	public String getTypeName() {
		return typeName;
	}

	public boolean isTimestampDate() {
		return "date".equals( typeName )
				|| "time".equals( typeName )
				|| "timestamp".equals( typeName );
	}

	public boolean isTimestampLocalDateTime() {
		return "LocalDateTime".equals( typeName );
	}

	public boolean isInstant() {
		return "instant".equals( typeName );
	}

	@Override
	public int hashCode() {
		int result = super.hashCode();
		result = 31 * result + ( typeName != null ? typeName.hashCode() : 0 );
		return result;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}
		if (!super.equals(o)) {
			return false;
		}
		RevisionTimestampData that = (RevisionTimestampData) o;
		return Objects.equals( typeName, that.typeName );
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy