View Javadoc
1   package com.ljs.ootp.extract.html.rating;
2   
3   import com.fasterxml.jackson.annotation.JsonSubTypes;
4   import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
5   import com.fasterxml.jackson.annotation.JsonTypeInfo;
6   import com.ljs.ootp.extract.html.ootp5.rating.PotentialRating;
7   import com.ljs.ootp.extract.html.ootp5.rating.ZeroToTen;
8   import com.ljs.ootp.extract.html.ootp6.rating.OneToTen;
9   import com.ljs.ootp.extract.html.ootp6.rating.OneToTwenty;
10  import com.ljs.ootp.extract.html.ootp6.rating.TwoToEight;
11  
12  /**
13   *
14   * @author lstephen
15   */
16  @JsonTypeInfo(use = JsonTypeInfo.Id.NAME)
17  @JsonSubTypes({
18      @Type(ZeroToTen.class),
19      @Type(OneToTen.class),
20      @Type(PotentialRating.RatingScale.class),
21      @Type(OneToOneHundred.class),
22      @Type(OneToTwenty.class),
23      @Type(TwoToEight.class)
24  })
25  public interface Scale<T> {
26  
27      Rating<T, ? extends Scale<T>> parse(String s);
28  
29      Rating<Integer, OneToOneHundred> normalize(T value);
30  
31  }