/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#addAsDirectories(org.jboss.shrinkwrap.api.ArchivePath[]) */ @Override public T addAsDirectories(final ArchivePath... paths) throws IllegalArgumentException { // Precondition check Validate.notNull(paths, "paths must be specified"); // Add for (final ArchivePath path : paths) { this.addAsDirectory(path); } // Return return covariantReturn(); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#addAsDirectories(org.jboss.shrinkwrap.api.ArchivePath[]) */ @Override public T addAsDirectories(final ArchivePath... paths) throws IllegalArgumentException { // Precondition check Validate.notNull(paths, "paths must be specified"); // Add for (final ArchivePath path : paths) { this.addAsDirectory(path); } // Return return covariantReturn(); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#move(org.jboss.shrinkwrap.api.ArchivePath, org.jboss.shrinkwrap.api.ArchivePath) */ @Override public T move(ArchivePath source, ArchivePath target) throws IllegalArgumentException, IllegalArchivePathException { Validate.notNull(source, "The source path was not specified"); Validate.notNull(target, "The target path was not specified"); final Node nodeToMove = get(source); if (null == nodeToMove) { throw new IllegalArchivePathException(source.get() + " doesn't specify any node in the archive to move"); } final Asset asset = nodeToMove.getAsset(); // Directory? if (asset == null) { this.addAsDirectory(target); } else { add(asset, target); } // move children final Set<Node> nodeToMoveChildren = nodeToMove.getChildren(); for (final Node child : nodeToMoveChildren) { final String childName = child.getPath().get().replaceFirst(child.getPath().getParent().get(), ""); final ArchivePath childTargetPath = ArchivePaths.create(target, childName); move(child.getPath(), childTargetPath); } delete(source); return covariantReturn(); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#move(org.jboss.shrinkwrap.api.ArchivePath, org.jboss.shrinkwrap.api.ArchivePath) */ @Override public T move(ArchivePath source, ArchivePath target) throws IllegalArgumentException, IllegalArchivePathException { Validate.notNull(source, "The source path was not specified"); Validate.notNull(target, "The target path was not specified"); final Node nodeToMove = get(source); if (null == nodeToMove) { throw new IllegalArchivePathException(source.get() + " doesn't specify any node in the archive to move"); } final Asset asset = nodeToMove.getAsset(); // Directory? if (asset == null) { this.addAsDirectory(target); } else { add(asset, target); } // move children final Set<Node> nodeToMoveChildren = nodeToMove.getChildren(); for (final Node child : nodeToMoveChildren) { final String childName = child.getPath().get().replaceFirst(child.getPath().getParent().get(), ""); final ArchivePath childTargetPath = ArchivePaths.create(target, childName); move(child.getPath(), childTargetPath); } delete(source); return covariantReturn(); }