private static IPropertiesValidator getValidator ( GobblinPresets preset ) { Objects . requireNonNull ( preset ) ; switch ( preset ) { case MYSQL_TO_HDFS : return new MySqlToHdfsValidator ( ) ; case HDFS_TO_MYSQL : return new HdfsToMySqlValidator ( ) ; default : throw new UnsupportedOperationException ( "Preset " + preset + " is not supported" ) ; } }
Factory method that provides IPropertiesValidator based on preset in runtime . Using factory method pattern as it is expected to grow .