Code example for TypeToken

Methods: getRawTypegetType

0
    this.contentType = contentType;
 
    TypeToken<O> typeToken = new TypeToken<O>(getClass()) {
    }; 
 
    if (typeToken.getType() instanceof Class) {
      @SuppressWarnings("unchecked") Class<O> rawType = (Class<O>) typeToken.getRawType();
      this.optsType = rawType;
    } else { 
      throw new IllegalArgumentException("Type parameter O of ParserSupport must be a Class");
    } 
  } 
 
  /** 
   * {@inheritDoc} 
   */ 
  @Override 
  public final String getContentType() {
    return contentType;
  }