protected boolean isValidType ( Class < ? > type , Annotation [ ] classAnnotations ) { if ( type == null ) return false ; if ( annotated ) { return checkAnnotation ( type ) ; } else if ( scanpackages != null ) { String classPackage = type . getPackage ( ) . getName ( ) ; for ( String pkg : scanpackages ) { if ( classPackage . startsWith ( pkg ) ) { if ( annotated ) { return checkAnnotation ( type ) ; } else return true ; } } return false ; } else if ( clazzes != null ) { for ( Class < ? > cls : clazzes ) { // must strictly equal. Don't check // inheritance if ( cls == type ) return true ; } return false ; } return true ; }
Check whether a class can be serialized or deserialized . It can check based on packages annotations on entities or explicit classes .