Skip to content

Instantly share code, notes, and snippets.

@nyilmaz
Created February 11, 2014 09:29
Show Gist options
  • Save nyilmaz/8931766 to your computer and use it in GitHub Desktop.
Save nyilmaz/8931766 to your computer and use it in GitHub Desktop.
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);
}
}
@cemo
Copy link

cemo commented Feb 11, 2014

  1. castleri yukarida yap
  2. allNull ilk kullanildigin yerin hemen ustunde tanimlansa daha temiz olur
    3.

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