public static ResourceFieldSchema createResourceFieldSchema ( RequiredField field ) throws IOException { ResourceFieldSchema schema = new ResourceFieldSchema ( ) . setName ( field . getAlias ( ) ) . setType ( field . getType ( ) ) ; List < RequiredField > subFields = field . getSubFields ( ) ; if ( subFields != null && ! subFields . isEmpty ( ) ) { ResourceFieldSchema [ ] subSchemaFields = new ResourceFieldSchema [ subFields . size ( ) ] ; int i = 0 ; for ( RequiredField subField : subFields ) { subSchemaFields [ i ++ ] = createResourceFieldSchema ( subField ) ; } ResourceSchema subSchema = new ResourceSchema ( ) ; subSchema . setFields ( subSchemaFields ) ; schema . setSchema ( subSchema ) ; } return schema ; }
Creates a new ResourceFieldSchema which reflects data from an input RequiredField .