private Optional < SoyType > soyTypeForProtoOrEnum ( Class < ? > type , Method method ) { // Message isn't supported because we can't get a descriptor from it. if ( type == Message . class ) { reporter . invalidReturnType ( Message . class , method ) ; return Optional . absent ( ) ; } Optional < String > fullName = nameFromDescriptor ( type ) ; if ( ! fullName . isPresent ( ) ) { reporter . incompatibleReturnType ( type , method ) ; return Optional . absent ( ) ; } SoyType returnType = registry . getType ( fullName . get ( ) ) ; if ( returnType == null ) { reporter . incompatibleReturnType ( type , method ) ; return Optional . absent ( ) ; } return Optional . of ( returnType ) ; }
Attempts to discover the SoyType for a proto or proto enum reporting an error if unable to .