@ SuppressWarnings ( "unchecked" ) public static boolean hasProperty ( Object obj , String name ) { if ( obj == null || name == null ) { return false ; } else if ( obj instanceof Map < ? , ? > ) { Map < Object , Object > map = ( Map < Object , Object > ) obj ; for ( Object key : map . keySet ( ) ) { if ( name . equalsIgnoreCase ( key . toString ( ) ) ) return true ; } return false ; } else if ( obj instanceof List < ? > ) { Integer index = IntegerConverter . toNullableInteger ( name ) ; List < Object > list = ( List < Object > ) obj ; return index != null && index . intValue ( ) >= 0 && index . intValue ( ) < list . size ( ) ; } else if ( obj . getClass ( ) . isArray ( ) ) { Integer index = IntegerConverter . toNullableInteger ( name ) ; int length = Array . getLength ( obj ) ; return index != null && index . intValue ( ) >= 0 && index . intValue ( ) < length ; } else { return PropertyReflector . hasProperty ( obj , name ) ; } }
Checks if object has a property with specified name .