static void checkProperties ( Map < String , Object > properties , String [ ] disallowedProperties ) { if ( properties == null || properties . isEmpty ( ) ) { return ; } HashSet < String > disallowed = new HashSet <> ( properties . keySet ( ) ) ; disallowed . retainAll ( Arrays . asList ( disallowedProperties ) ) ; if ( ! disallowed . isEmpty ( ) ) { throw new IllegalArgumentException ( "The following properties are reserved for this type of entity: " + Arrays . asList ( disallowedProperties ) ) ; } }
If the properties map contains a key from the disallowed properties throw an exception .