class Token implements Writable {

  @SuppressWarnings("unchecked")
  public T decodeIdentifier() throws IOException {
    Class<? extends TokenIdentifier> cls = getClassForIdentifier(getKind());
    if (cls == null) {
      return null;
    }
    TokenIdentifier tokenIdentifier = ReflectionUtils.newInstance(cls, null);
    ByteArrayInputStream buf = new ByteArrayInputStream(identifier);
    DataInputStream in = new DataInputStream(buf);
    tokenIdentifier.readFields(in);
    in.close();
    return (T) tokenIdentifier;
  }

  public  Token(T id, SecretManager<T> mgr);
  public  Token(byte[] identifier, byte[] password, Text kind, Text service);
  public  Token();
  public  Token(Token<T> other);
  public  Token(TokenProto tokenPB);

}