/** * Gets the type of this {@link ZFSObject}. */ public ZFSType getType() { return ZFSType.fromCode(LIBZFS.zfs_get_type(handle)); }
/** * Opens a ZFS dataset of the given name and type. */ public <T extends ZFSObject> T open(String dataSetName, Class<T> type) { return type.cast(open(dataSetName,ZFSType.fromType(type).code)); }
/** * Create a ZFS Data Set of a given name and zfs type. * * @param dataSetName * name of the dataset to create. * @param type * the zfs type of dataset to create. * @return * Never null. Created dataset. */ public <T extends ZFSObject> T create(String dataSetName, Class<T> type) { return type.cast(create(dataSetName, ZFSType.fromType(type), null)); }
/** * Gets the type of this {@link ZFSObject}. */ public ZFSType getType() { return ZFSType.fromCode(LIBZFS.zfs_get_type(handle)); }
/** * Opens a ZFS dataset of the given name and type. */ public <T extends ZFSObject> T open(String dataSetName, Class<T> type) { return type.cast(open(dataSetName,ZFSType.fromType(type).code)); }
/** * Instantiate the right subtype. */ /*package*/ static ZFSObject create(LibZFS parent, zfs_handle_t handle) { switch (ZFSType.fromCode(LIBZFS.zfs_get_type(handle))) { case FILESYSTEM: return new ZFSFileSystem(parent,handle); case SNAPSHOT: return new ZFSSnapshot(parent,handle); case VOLUME: return new ZFSVolume(parent,handle); default: throw new AssertionError(); } }
/** * Create a ZFS Data Set of a given name and zfs type. * * @param dataSetName * name of the dataset to create. * @param type * the zfs type of dataset to create. * @return * Never null. Created dataset. */ public <T extends ZFSObject> T create(String dataSetName, Class<T> type) { return type.cast(create(dataSetName, ZFSType.fromType(type), null)); }
/** * Instantiate the right subtype. */ /*package*/ static ZFSObject create(LibZFS parent, zfs_handle_t handle) { switch (ZFSType.fromCode(LIBZFS.zfs_get_type(handle))) { case FILESYSTEM: return new ZFSFileSystem(parent,handle); case SNAPSHOT: return new ZFSSnapshot(parent,handle); case VOLUME: return new ZFSVolume(parent,handle); default: throw new AssertionError(); } }