Permalink
Browse files

Replace HashCodeBuilder with HashCodeHelper

Replace import org.apache.commons.lang.builder.HashCodeBuilder with  import org.codehaus.groovy.util.HashCodeHelper
  • Loading branch information...
sdelamo committed Apr 6, 2017
1 parent b4e0ac0 commit 3a04ff5e35b8357674cbe2b8b086debe09ad2172
@@ -2,7 +2,7 @@ package com.testapp
import grails.gorm.DetachedCriteria
import groovy.transform.ToString
import org.apache.commons.lang.builder.HashCodeBuilder
import org.codehaus.groovy.util.HashCodeHelper
@ToString(cache=true, includeNames=true, includePackage=false)
class TestUserTestRole implements Serializable {
@@ -20,10 +20,14 @@ class TestUserTestRole implements Serializable {
@Override
int hashCode() {
def builder = new HashCodeBuilder()
if (testUser) builder.append(testUser.id)
if (testRole) builder.append(testRole.id)
builder.toHashCode()
int hashCode = HashCodeHelper.initHash()
if (testUser) {
hashCode = HashCodeHelper.updateHash(hashCode, testUser.id)
}
if (testRole) {
hashCode = HashCodeHelper.updateHash(hashCode, testRole.id)
}
hashCode
}
static TestUserTestRole get(long testUserId, long testRoleId) {
@@ -3,7 +3,7 @@ package test
import grails.gorm.DetachedCriteria
import groovy.transform.ToString
import org.apache.commons.lang.builder.HashCodeBuilder
import org.codehaus.groovy.util.HashCodeHelper
@ToString(cache=true, includeNames=true, includePackage=false)
class TestRoleGroupRoles implements Serializable {
@@ -22,10 +22,14 @@ class TestRoleGroupRoles implements Serializable {
@Override
int hashCode() {
def builder = new HashCodeBuilder()
if (roleGroup) builder.append(roleGroup.id)
if (role) builder.append(role.id)
builder.toHashCode()
int hashCode = HashCodeHelper.initHash()
if (roleGroup) {
hashCode = HashCodeHelper.updateHash(hashCode, roleGroup.id)
}
if (role) {
hashCode = HashCodeHelper.updateHash(hashCode, role.id)
}
hashCode
}
static TestRoleGroupRoles get(long roleGroupId, long roleId) {
@@ -17,7 +17,7 @@ package test
import grails.gorm.DetachedCriteria
import groovy.transform.ToString
import org.apache.commons.lang.builder.HashCodeBuilder
import org.codehaus.groovy.util.HashCodeHelper
/**
* @author <a href='mailto:burt@burtbeckwith.com'>Burt Beckwith</a>
@@ -39,10 +39,14 @@ class TestUserRole implements Serializable {
@Override
int hashCode() {
def builder = new HashCodeBuilder()
if (user) builder.append(user.id)
if (role) builder.append(role.id)
builder.toHashCode()
int hashCode = HashCodeHelper.initHash()
if (user) {
hashCode = HashCodeHelper.updateHash(hashCode, user.id)
}
if (role) {
hashCode = HashCodeHelper.updateHash(hashCode, role.id)
}
hashCode
}
static TestUserRole get(long userId, long roleId) {
@@ -2,7 +2,7 @@ package test
import grails.gorm.DetachedCriteria
import groovy.transform.ToString
import org.apache.commons.lang.builder.HashCodeBuilder
import org.codehaus.groovy.util.HashCodeHelper
@ToString(cache=true, includeNames=true, includePackage=false)
class TestUserRoleGroup implements Serializable {
@@ -21,10 +21,14 @@ class TestUserRoleGroup implements Serializable {
@Override
int hashCode() {
def builder = new HashCodeBuilder()
if (user) builder.append(user.id)
if (roleGroup) builder.append(roleGroup.id)
builder.toHashCode()
int hashCode = HashCodeHelper.initHash()
if (user) {
hashCode = HashCodeHelper.updateHash(hashCode, user.id)
}
if (roleGroup) {
hashCode = HashCodeHelper.updateHash(hashCode, roleGroup.id)
}
hashCode
}
static TestUserRoleGroup get(long userId, long roleGroupId) {
@@ -3,7 +3,7 @@ package test
import grails.gorm.DetachedCriteria
import groovy.transform.ToString
import org.apache.commons.lang.builder.HashCodeBuilder
import org.codehaus.groovy.util.HashCodeHelper
@ToString(cache=true, includeNames=true, includePackage=false)
class UserRole implements Serializable {
@@ -22,10 +22,14 @@ class UserRole implements Serializable {
@Override
int hashCode() {
def builder = new HashCodeBuilder()
if (user) builder.append(user.id)
if (role) builder.append(role.id)
builder.toHashCode()
int hashCode = HashCodeHelper.initHash()
if (user) {
hashCode = HashCodeHelper.updateHash(hashCode, user.id)
}
if (role) {
hashCode = HashCodeHelper.updateHash(hashCode, role.id)
}
hashCode
}
static UserRole get(long userId, long roleId) {
@@ -13,7 +13,7 @@ package com.mycompany.myapp
import grails.gorm.DetachedCriteria
import groovy.transform.ToString
import org.apache.commons.lang.builder.HashCodeBuilder
import org.codehaus.groovy.util.HashCodeHelper
@ToString(cache=true, includeNames=true, includePackage=false)
class RoleGroupRole implements Serializable {
@@ -32,10 +32,14 @@ class RoleGroupRole implements Serializable {
@Override
int hashCode() {
def builder = new HashCodeBuilder()
if (roleGroup) builder.append(roleGroup.id)
if (role) builder.append(role.id)
builder.toHashCode()
int hashCode = HashCodeHelper.initHash()
if (roleGroup) {
hashCode = HashCodeHelper.updateHash(hashCode, roleGroup.id)
}
if (role) {
hashCode = HashCodeHelper.updateHash(hashCode, role.id)
}
hashCode
}
static RoleGroupRole get(long roleGroupId, long roleId) {
@@ -13,7 +13,7 @@ package com.mycompany.myapp
import grails.gorm.DetachedCriteria
import groovy.transform.ToString
import org.apache.commons.lang.builder.HashCodeBuilder
import org.codehaus.groovy.util.HashCodeHelper
@ToString(cache=true, includeNames=true, includePackage=false)
class UserRole implements Serializable {
@@ -32,10 +32,14 @@ class UserRole implements Serializable {
@Override
int hashCode() {
def builder = new HashCodeBuilder()
if (user) builder.append(user.id)
if (role) builder.append(role.id)
builder.toHashCode()
int hashCode = HashCodeHelper.initHash()
if (user) {
hashCode = HashCodeHelper.updateHash(hashCode, user.id)
}
if (role) {
hashCode = HashCodeHelper.updateHash(hashCode, role.id)
}
hashCode
}
static UserRole get(long userId, long roleId) {
@@ -13,7 +13,7 @@ package com.mycompany.myapp
import grails.gorm.DetachedCriteria
import groovy.transform.ToString
import org.apache.commons.lang.builder.HashCodeBuilder
import org.codehaus.groovy.util.HashCodeHelper
@ToString(cache=true, includeNames=true, includePackage=false)
class UserRoleGroup implements Serializable {
@@ -32,10 +32,14 @@ class UserRoleGroup implements Serializable {
@Override
int hashCode() {
def builder = new HashCodeBuilder()
if (user) builder.append(user.id)
if (roleGroup) builder.append(roleGroup.id)
builder.toHashCode()
int hashCode = HashCodeHelper.initHash()
if (user) {
hashCode = HashCodeHelper.updateHash(hashCode, user.id)
}
if (roleGroup) {
hashCode = HashCodeHelper.updateHash(hashCode, roleGroup.id)
}
hashCode
}
static UserRoleGroup get(long userId, long roleGroupId) {
@@ -147,7 +147,7 @@ package com.testapp
import grails.gorm.DetachedCriteria
import groovy.transform.ToString
import org.apache.commons.lang.builder.HashCodeBuilder
import org.codehaus.groovy.util.HashCodeHelper
@ToString(cache=true, includeNames=true, includePackage=false)
class UserRole implements Serializable {
@@ -166,10 +166,14 @@ class UserRole implements Serializable {
@Override
int hashCode() {
def builder = new HashCodeBuilder()
if (user) builder.append(user.id)
if (role) builder.append(role.id)
builder.toHashCode()
int hashCode = HashCodeHelper.initHash()
if (user) {
hashCode = HashCodeHelper.updateHash(hashCode, user.id)
}
if (role) {
hashCode = HashCodeHelper.updateHash(hashCode, role.id)
}
hashCode
}
static UserRole get(long userId, long roleId) {
@@ -3,7 +3,7 @@ package ${packageName}
import grails.gorm.DetachedCriteria
import groovy.transform.ToString
import org.apache.commons.lang.builder.HashCodeBuilder
import org.codehaus.groovy.util.HashCodeHelper
@ToString(cache=true, includeNames=true, includePackage=false)
class ${groupClassName}${roleClassName} implements Serializable {
@@ -22,10 +22,14 @@ class ${groupClassName}${roleClassName} implements Serializable {
@Override
int hashCode() {
def builder = new HashCodeBuilder()
if (${groupClassProperty}) builder.append(${groupClassProperty}.id)
if (${roleClassProperty}) builder.append(${roleClassProperty}.id)
builder.toHashCode()
int hashCode = HashCodeHelper.initHash()
if (${groupClassProperty}) {
hashCode = HashCodeHelper.updateHash(hashCode, ${groupClassProperty}.id)
}
if (${roleClassProperty}) {
hashCode = HashCodeHelper.updateHash(hashCode, ${roleClassProperty}.id)
}
hashCode
}
static ${groupClassName}${roleClassName} get(long ${groupClassProperty}Id, long ${roleClassProperty}Id) {
@@ -3,7 +3,7 @@ package ${packageName}
import grails.gorm.DetachedCriteria
import groovy.transform.ToString
import org.apache.commons.lang.builder.HashCodeBuilder
import org.codehaus.groovy.util.HashCodeHelper
@ToString(cache=true, includeNames=true, includePackage=false)
class ${userClassName}${roleClassName} implements Serializable {
@@ -20,12 +20,16 @@ class ${userClassName}${roleClassName} implements Serializable {
}
}
@Override
@Override
int hashCode() {
def builder = new HashCodeBuilder()
if (${userClassProperty}) builder.append(${userClassProperty}.id)
if (${roleClassProperty}) builder.append(${roleClassProperty}.id)
builder.toHashCode()
int hashCode = HashCodeHelper.initHash()
if (${userClassProperty}) {
hashCode = HashCodeHelper.updateHash(hashCode, ${userClassProperty}.id)
}
if (${roleClassProperty}) {
hashCode = HashCodeHelper.updateHash(hashCode, ${roleClassProperty}.id)
}
hashCode
}
static ${userClassName}${roleClassName} get(long ${userClassProperty}Id, long ${roleClassProperty}Id) {
@@ -3,7 +3,7 @@ package ${packageName}
import grails.gorm.DetachedCriteria
import groovy.transform.ToString
import org.apache.commons.lang.builder.HashCodeBuilder
import org.codehaus.groovy.util.HashCodeHelper
@ToString(cache=true, includeNames=true, includePackage=false)
class ${userClassName}${groupClassName} implements Serializable {
@@ -20,14 +20,18 @@ class ${userClassName}${groupClassName} implements Serializable {
}
}
@Override
@Override
int hashCode() {
def builder = new HashCodeBuilder()
if (${userClassProperty}) builder.append(${userClassProperty}.id)
if (${groupClassProperty}) builder.append(${groupClassProperty}.id)
builder.toHashCode()
int hashCode = HashCodeHelper.initHash()
if (${userClassProperty}) {
hashCode = HashCodeHelper.updateHash(hashCode, ${userClassProperty}.id)
}
if (${groupClassProperty}) {
hashCode = HashCodeHelper.updateHash(hashCode, ${groupClassProperty}.id)
}
hashCode
}
static ${userClassName}${groupClassName} get(long ${userClassProperty}Id, long ${groupClassProperty}Id) {
criteriaFor(${userClassProperty}Id, ${groupClassProperty}Id).get()
}

0 comments on commit 3a04ff5

Please sign in to comment.