Package io.smallrye.graphql.api
Annotation Interface ToScalar
@Retention(RUNTIME)
@Target({TYPE,FIELD,PARAMETER,METHOD})
@Documented
@Experimental("Allow you to map to a certain scalar class. Not covered by the specification. Subject to change.")
@Deprecated
public @interface ToScalar
Deprecated.
Use AdaptToScalar
Allows users to map a certain field or class to a scalar type
This is an experimental feature that might move to the spec.
Example:
This is an experimental feature that might move to the spec.
Example:
public class Profile {
// Map a Scalar to another existing Scalar
@ToScalar(Scalar.Int.class)
private Long id;
// Map a POJO to another existing Scalar
@ToScalar(Scalar.String.class)
private IdNumber idNumber;
// Map a List of POJOs to a list of existing Scalars
@ToScalar(Scalar.String.class)
private List<Website> bookmarks;
// other getters/setters...
}
- Author:
- Phillip Kruger (phillip.kruger@redhat.com)
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional Elements
-
Element Details
-
value
Deprecated.- Returns:
- the scalar to use.
-
deserializeMethod
String deserializeMethodDeprecated.- Default:
""
-