private static List < String > resolveMemberShapes ( MemberModel member ) { if ( member == null ) return new LinkedList < String > ( ) ; if ( member . getEnumType ( ) != null ) { return Collections . singletonList ( member . getEnumType ( ) ) ; } else if ( member . isList ( ) ) { return resolveMemberShapes ( member . getListModel ( ) . getListMemberModel ( ) ) ; } else if ( member . isMap ( ) ) { List < String > memberShapes = new LinkedList < String > ( ) ; memberShapes . addAll ( resolveMemberShapes ( member . getMapModel ( ) . getKeyModel ( ) ) ) ; memberShapes . addAll ( resolveMemberShapes ( member . getMapModel ( ) . getValueModel ( ) ) ) ; return memberShapes ; } else if ( member . isSimple ( ) ) { // member is scalar, do nothing return new LinkedList < String > ( ) ; } else { // member is a structure. return Collections . singletonList ( member . getVariable ( ) . getSimpleType ( ) ) ; } }
Recursively resolves the shapes represented by the member . When the member is a map both the key shape and the value shape of the map will be resolved so that the returning list could have more than one elements .