code: protected static <T extends Serializable> T asT(final Object service, final Class<T> type) {
      return type.cast(service);
    }
docs: Cast the object to the original one with the type. The object must extend Serializable.