private Type getType ( Map < String , Model > definitions , DocumentResolver definitionDocumentResolver ) { Validate . notNull ( parameter , "parameter must not be null!" ) ; Type type = null ; if ( parameter instanceof BodyParameter ) { BodyParameter bodyParameter = ( BodyParameter ) parameter ; Model model = bodyParameter . getSchema ( ) ; if ( model != null ) { type = ModelUtils . getType ( model , definitions , definitionDocumentResolver ) ; } else { type = new BasicType ( "string" , bodyParameter . getName ( ) ) ; } } else if ( parameter instanceof AbstractSerializableParameter ) { AbstractSerializableParameter serializableParameter = ( AbstractSerializableParameter ) parameter ; @ SuppressWarnings ( "unchecked" ) List < String > enums = serializableParameter . getEnum ( ) ; if ( CollectionUtils . isNotEmpty ( enums ) ) { type = new EnumType ( serializableParameter . getName ( ) , enums ) ; } else { type = new BasicType ( serializableParameter . getType ( ) , serializableParameter . getName ( ) , serializableParameter . getFormat ( ) ) ; } if ( serializableParameter . getType ( ) . equals ( "array" ) ) { String collectionFormat = serializableParameter . getCollectionFormat ( ) ; type = new ArrayType ( serializableParameter . getName ( ) , new PropertyAdapter ( serializableParameter . getItems ( ) ) . getType ( definitionDocumentResolver ) , collectionFormat ) ; } } else if ( parameter instanceof RefParameter ) { String refName = ( ( RefParameter ) parameter ) . getSimpleRef ( ) ; type = new RefType ( definitionDocumentResolver . apply ( refName ) , new ObjectType ( refName , null /* FIXME, not used for now */ ) ) ; } return type ; }
Retrieves the type of a parameter or otherwise null