minor improvements and corrections

This commit is contained in:
jomu
2016-02-14 15:38:14 +00:00
parent b1fbabdfcf
commit 78c29b140f

View File

@ -7,7 +7,6 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import org.hibernate.HibernateException;
import org.hibernate.usertype.UserType;
/**
@ -41,28 +40,27 @@ public abstract class GenericEnumType<T, E extends Enum<E>> implements UserType,
}
@Override
public Object assemble(Serializable cached, Object owner)
throws HibernateException {
public Object assemble(Serializable cached, Object owner) {
return cached;
}
@Override
public Object deepCopy(Object obj) throws
HibernateException {
public Object deepCopy(Object obj) {
return obj;
}
@Override
public Serializable disassemble(Object obj) throws
HibernateException {
public Serializable disassemble(Object obj) {
return (Serializable) obj;
}
@Override
public boolean equals(Object obj1, Object obj2) throws HibernateException {
public boolean equals(Object obj1, Object obj2) {
if (obj1 == null && obj2 == null) {
return true;
} else if (obj1 != null && obj2 == null) {
} else if (obj1 == null) {
return false;
} else if (obj2 == null) {
return false;
} else {
return obj1.equals(obj2);
@ -70,7 +68,7 @@ public abstract class GenericEnumType<T, E extends Enum<E>> implements UserType,
}
@Override
public int hashCode(Object obj) throws HibernateException {
public int hashCode(Object obj) {
return obj.hashCode();
}
@ -79,7 +77,7 @@ public abstract class GenericEnumType<T, E extends Enum<E>> implements UserType,
return false;
}
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws SQLException {
String value = rs.getString(names[0]);
if (!rs.wasNull()) {
return enumMap.get(value);
@ -87,7 +85,7 @@ public abstract class GenericEnumType<T, E extends Enum<E>> implements UserType,
return null;
}
public void nullSafeSet(PreparedStatement ps, Object obj, int index) throws HibernateException, SQLException {
public void nullSafeSet(PreparedStatement ps, Object obj, int index) throws SQLException {
if (obj == null) {
ps.setNull(index, sqlType);
} else {
@ -96,8 +94,7 @@ public abstract class GenericEnumType<T, E extends Enum<E>> implements UserType,
}
@Override
public Object replace(Object original, Object target, Object owner)
throws HibernateException {
public Object replace(Object original, Object target, Object owner) {
return original;
}