private void removeDefinedFields ( Context context , List < Term > undefinedFields ) throws ValidationException { // Loop through all of the required and optional fields removing each // from the list of undefined fields. for ( Term term : reqKeys ) { undefinedFields . remove ( term ) ; } for ( Term term : optKeys ) { undefinedFields . remove ( term ) ; } // Now we must apply this method to any included types as well. for ( String s : includes ) { try { // Pull out the type and base type of the included type. // Ensure that the base type is a record definition. FullType fullType = context . getFullType ( s ) ; BaseType baseType = fullType . getBaseType ( ) ; RecordType recordType = ( RecordType ) baseType ; recordType . removeDefinedFields ( context , undefinedFields ) ; } catch ( ClassCastException cce ) { // Should have been checked when the type was defined. throw CompilerError . create ( MSG_NONRECORD_TYPE_REF , s ) ; } catch ( NullPointerException npe ) { // Should have been checked when the type was defined. throw CompilerError . create ( MSG_NONEXISTANT_REFERENCED_TYPE , s ) ; } } }
This method will loop through all of the fields defined in this record and remove them from the given list . This is used in the validation of the fields .