Annotation Type AdaptToScalar


  • @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.")
    public @interface 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:
     public class Profile {
         //  Map a Scalar to another existing Scalar
         @AdaptToScalar(Scalar.Int.class)
         private Long id;
     
         // Map a POJO to another existing Scalar
         @AdaptToScalar(Scalar.String.class)
         private IdNumber idNumber;
    
         // Map a List of POJOs to a list of existing Scalars
         @AdaptToScalar(Scalar.String.class)
         private List<Website> bookmarks;
    
         // other getters/setters...
     }
     
    Author:
    Phillip Kruger ([email protected])
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      Class<? extends Scalar> value  
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      String deserializeMethod  
    • Element Detail

      • value

        Class<? extends Scalar> value
        Returns:
        the scalar to use.
      • deserializeMethod

        String deserializeMethod
        Default:
        ""