org.hibernate.jpamodelgen.util.FileTimeStampChecker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-jpamodelgen Show documentation
Show all versions of hibernate-jpamodelgen Show documentation
Annotation Processor to generate JPA 2 static metamodel classes
/*
* 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.jpamodelgen.util;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* @author Hardy Ferentschik
*/
public class FileTimeStampChecker implements Serializable {
private Map lastModifiedCache;
public FileTimeStampChecker() {
lastModifiedCache = new HashMap();
}
public void add(String fileName, Long lastModified) {
lastModifiedCache.put( fileName, lastModified );
}
@Override
public boolean equals(Object o) {
if ( this == o ) {
return true;
}
if ( o == null || getClass() != o.getClass() ) {
return false;
}
FileTimeStampChecker that = (FileTimeStampChecker) o;
if ( !lastModifiedCache.equals( that.lastModifiedCache ) ) {
return false;
}
return true;
}
@Override
public int hashCode() {
return lastModifiedCache.hashCode();
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append( "FileTimeStampChecker" );
sb.append( "{lastModifiedCache=" ).append( lastModifiedCache );
sb.append( '}' );
return sb.toString();
}
}