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

pojo.PojoEqualsHashcode.ftl Maven / Gradle / Ivy

There is a newer version: 5.6.15.Final
Show newest version
<#if pojo.needsEqualsHashCode() && !clazz.superclass?exists>
<#assign classNameToCastTo><#if clazz.getProxyInterfaceName?exists>${clazz.getProxyInterfaceName()}<#else>${pojo.getDeclarationName()}
   public boolean equals(Object other) {
         if ( (this == other ) ) return true;
		 if ( (other == null ) ) return false;
		 if ( !(other instanceof ${classNameToCastTo}) ) return false;
		 ${classNameToCastTo} castOther = ( ${classNameToCastTo} ) other; 
         
		 return ${pojo.generateEquals("this", "castOther", jdk5)};
   }
   
   public int hashCode() {
         int result = 17;
         
<#foreach property in pojo.getAllPropertiesIterator()>         ${pojo.generateHashCode(property, "result", "this", jdk5)}
         return result;
   }   




© 2015 - 2024 Weber Informatics LLC | Privacy Policy