Created
February 11, 2014 09:29
-
-
Save nyilmaz/8931766 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Object dayObj = FieldUtils.readField(value, birthdayFieldName, true); | |
Object monthObj = FieldUtils.readField(value, birthmonthFieldName, true); | |
Object yearObj = FieldUtils.readField(value, birthyearFieldName, true); | |
Boolean allNull = dayObj == null && monthObj == null && yearObj == null; | |
Boolean anyNull = dayObj == null || monthObj == null || yearObj == null; | |
if(required) { | |
if(anyNull) { | |
return false; | |
} else { | |
new DateTime((Integer)yearObj, (Integer)monthObj, (Integer)dayObj, 0, 0); | |
} | |
} else { | |
if(allNull) { | |
return true; | |
} else if(anyNull) { | |
return false; | |
} else { | |
new DateTime((Integer)yearObj, (Integer)monthObj, (Integer)dayObj, 0, 0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
3.
if(anyNull) {
return false;
} else {
new DateTime((Integer)yearObj, (Integer)monthObj, (Integer)dayObj, 0, 0);
}