Produces class

Marks a controller or handler method with the media types that it can produce in the response.

For example:

@Produces([MediaType.JSON])
class MyController { ... }

@Produces([MediaType.TEXT_HTML])
ResponseBody<String> index() => ResponseBody.ok("<h1>Hello</h1>");

When both class and method are annotated, the method-level annotation takes precedence.

Annotations
  • @Target.new({TargetKind.classType, TargetKind.method})

Constructors

Produces(List<MediaType> mediaTypes)
Creates a Produces annotation with one or more mediaTypes.
const

Properties

annotationType Type
Returns the annotation _type of this annotation.
no setter
hashCode int
Returns a hash code consistent with equality definition.
no setterinherited
mediaTypes List<MediaType>
The list of media types this method or controller produces.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

equals(Object other) bool
Checks whether the given object is logically equivalent to this annotation.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Returns a string representation of this annotation.
inherited

Operators

operator ==(Object other) bool
Checks if this annotation is equal to another object.
inherited