code: private <T> T get(Class<T> clazz) {
      try {
        return clazz.cast(get());
      } catch (ClassCastException e) {
        return null;
      }
    }
docs: Returns enclosed object casted on given class, if enclosed object is not
  instance of given class returns null.
  @param clazz class to cast on
  @return casted object or null