This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new EqualsBuilder().append(obj1, obj2).isEquals() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
*/ | |
package com.mypackage.utilities; | |
import java.lang.reflect.Method; | |
import java.util.ArrayList; | |
import java.util.List; | |
import org.apache.commons.lang.builder.EqualsBuilder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@InitBinder | |
public void initBinder(WebDataBinder binder) { | |
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy", Locale.getDefault()); | |
dateFormat.setLenient(false); | |
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); | |
// bind empty strings as null | |
binder.registerCustomEditor(String.class, new StringTrimmerEditor(true)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* checks through a bunch of objects for a null value | |
* | |
* @param o1 | |
* @param objects | |
* @return true if any object is null, false otherwise | |
*/ | |
public static boolean hasNullValue(Object o1, Object... objects) { | |
if(o1 == null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
*/ | |
package com.bmchild.spring; | |
import java.beans.PropertyEditorSupport; | |
import java.text.DateFormat; | |
import java.text.ParseException; | |
import java.util.ArrayList; | |
import java.util.Date; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
*http://docs.jboss.org/hibernate/annotations/3.5/reference/en/html_single/#d0e2177 | |
*/ | |
@Entity | |
public class Parent implements Serializable { | |
@Id | |
public ParentPk id; | |
public int age; | |
@OneToMany(cascade=CascadeType.ALL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Controller | |
public class SimpleController { | |
// other controller method omitted | |
@ExceptionHandler(IOException.class) | |
public String handleIOException(IOException ex, HttpServletRequest request) { | |
return ClassUtils.getShortName(ex.getClass()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE UNIQUE NONCLUSTERED INDEX my_index_name ON my_table (my_column) where my_column = 'Y'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ElementCollection | |
@CollectionTable(name = "my_other_table", joinColumns = @JoinColumn(name = "fk_column")) | |
@Column(name = "my_column") | |
private List<String> strings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
*/ | |
package com.bmchild.validation.constraints; | |
import static java.lang.annotation.ElementType.ANNOTATION_TYPE; | |
import static java.lang.annotation.ElementType.CONSTRUCTOR; | |
import static java.lang.annotation.ElementType.FIELD; | |
import static java.lang.annotation.ElementType.METHOD; | |
import static java.lang.annotation.ElementType.PARAMETER; |