LeeKyoungIl opened a new pull request #759:
URL: https://github.com/apache/commons-lang/pull/759


   When we compare Object values, if it enters more than 2depth, it may become 
a bit annoying.
   
   For example
   
   ```java
   class Bar {
       String testBarString = "test";
   }
   
   class Foo {
       Bar bar = new Bar();
   }
   
   Foo foo = new Foo();
   
   if ( foo.getBar() != null && "test".equals(foo.getBar().getTestBarString()) 
) {
       // TODO
   }
   ```
   
   So I made a feature that can be compared at once and is null safe.
   
   ```java
   // AS-IS
   if ( foo.getBar() != null && "test".equals(foo.getBar().getTestBarString()) 
) {
       // TODO
   }
   
   // TO-BE
   if ( ObjectUtils.nullSafeEquals(foo, "bar.testBarString", "test') ) {
       // TODO
   }
   ```
   
   I made it because it didn't seem to have a similar function like this before.
   Do you have a similar method in ObjectUtils?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to