private static void assertShapeAndMembersAreInModel ( IntermediateModel model , Map < String , List < String > > shapeAndMembers ) { shapeAndMembers . forEach ( ( shapeName , members ) -> { if ( Utils . findShapeModelByC2jNameIfExists ( model , shapeName ) == null ) { throw new IllegalStateException ( String . format ( "Cannot find shape [%s] in the model when processing " + "customization config emitLegacyEnumSetterFor. %s" , shapeName , shapeName ) ) ; } members . forEach ( memberName -> { if ( model . getShapeByC2jName ( shapeName ) . getMemberByC2jName ( memberName ) == null ) { throw new IllegalStateException ( String . format ( "Cannot find member [%s] in the model when processing " + "customization config emitLegacyEnumSetterFor. %s" , memberName , shapeName ) ) ; } } ) ; } ) ; }
Checks that all shapes and members in a given customization are actually in the model . Good to fail fast for things like typos instead of silently not applying that customization .