protected void validateProperties ( final Object entity , final EntityDataModel edm ) throws ODataException { final Type type = edm . getType ( entity . getClass ( ) ) ; // No validation needed if it is not a structured type if ( ! ( type instanceof StructuredType ) ) { return ; } visitProperties ( edm , ( StructuredType ) type , property -> { Object value = getPropertyValue ( property , entity ) ; if ( value == null ) { if ( ! property . isNullable ( ) ) { throw new ODataBadRequestException ( "The property '" + property . getName ( ) + "' is required to be non-empty in an entity of type: " + type . getFullyQualifiedName ( ) ) ; } } else if ( ! ( property instanceof NavigationProperty ) ) { // Validate contained properties, but not if the property is a navigation property. // Navigation properties in a request are only links, they don't contain the entity that the // navigation property points to itself. validateProperties ( value , edm ) ; } } ) ; }
Checks if all non - nullable properties of an entity are non - empty .