/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#getAsType(java.lang.Class, java.lang.String) */ @Override public <X extends Archive<X>> X getAsType(Class<X> type, String path) { Validate.notNull(path, "Path must be specified"); return getAsType(type, ArchivePaths.create(path)); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#getAsType(java.lang.Class, java.lang.String, * org.jboss.shrinkwrap.api.ArchiveFormat) */ @Override public <X extends Archive<X>> X getAsType(final Class<X> type, final String path, final ArchiveFormat archiveFormat) { Validate.notNull(path, "ArchiveFormat must be specified"); return getAsType(type, ArchivePaths.create(path), archiveFormat); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#getAsType(java.lang.Class, java.lang.String, * org.jboss.shrinkwrap.api.ArchiveFormat) */ @Override public <X extends Archive<X>> X getAsType(final Class<X> type, final String path, final ArchiveFormat archiveFormat) { Validate.notNull(path, "ArchiveFormat must be specified"); return getAsType(type, ArchivePaths.create(path), archiveFormat); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#getAsType(java.lang.Class, java.lang.String) */ @Override public <X extends Archive<X>> X getAsType(Class<X> type, String path) { Validate.notNull(path, "Path must be specified"); return getAsType(type, ArchivePaths.create(path)); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#getAsType(java.lang.Class, org.jboss.shrinkwrap.api.Filter) */ @Override public <X extends Archive<X>> Collection<X> getAsType(Class<X> type, Filter<ArchivePath> filter) { Validate.notNull(type, "Type must be specified"); Validate.notNull(filter, "Filter must be specified"); Collection<X> archives = new ArrayList<X>(); Map<ArchivePath, Node> matches = getContent(filter); for (ArchivePath path : matches.keySet()) { archives.add(getAsType(type, path)); } return archives; }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#getAsType(java.lang.Class, org.jboss.shrinkwrap.api.Filter) */ @Override public <X extends Archive<X>> Collection<X> getAsType(Class<X> type, Filter<ArchivePath> filter) { Validate.notNull(type, "Type must be specified"); Validate.notNull(filter, "Filter must be specified"); Collection<X> archives = new ArrayList<X>(); Map<ArchivePath, Node> matches = getContent(filter); for (ArchivePath path : matches.keySet()) { archives.add(getAsType(type, path)); } return archives; }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#getAsType(java.lang.Class, org.jboss.shrinkwrap.api.Filter, * org.jboss.shrinkwrap.api.ArchiveFormat) */ @Override public <X extends Archive<X>> Collection<X> getAsType(Class<X> type, Filter<ArchivePath> filter, final ArchiveFormat archiveFormat) { Validate.notNull(type, "Type must be specified"); Validate.notNull(filter, "Filter must be specified"); Validate.notNull(archiveFormat, "ArchiveFormat must be specified"); Collection<X> archives = new ArrayList<X>(); Map<ArchivePath, Node> matches = getContent(filter); for (ArchivePath path : matches.keySet()) { archives.add(getAsType(type, path, archiveFormat)); } return archives; }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#getAsType(java.lang.Class, org.jboss.shrinkwrap.api.Filter, * org.jboss.shrinkwrap.api.ArchiveFormat) */ @Override public <X extends Archive<X>> Collection<X> getAsType(Class<X> type, Filter<ArchivePath> filter, final ArchiveFormat archiveFormat) { Validate.notNull(type, "Type must be specified"); Validate.notNull(filter, "Filter must be specified"); Validate.notNull(archiveFormat, "ArchiveFormat must be specified"); Collection<X> archives = new ArrayList<X>(); Map<ArchivePath, Node> matches = getContent(filter); for (ArchivePath path : matches.keySet()) { archives.add(getAsType(type, path, archiveFormat)); } return archives; }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#getAsType(java.lang.Class, org.jboss.shrinkwrap.api.ArchivePath) */ @Override public <X extends Archive<X>> X getAsType(Class<X> type, ArchivePath path) { Validate.notNull(type, "Type must be specified"); Validate.notNull(path, "ArchivePath must be specified"); Node content = get(path); if (content == null) { return null; } Asset asset = content.getAsset(); if (asset == null) { return null; } if (asset instanceof ArchiveAsset) { ArchiveAsset archiveAsset = (ArchiveAsset) asset; return archiveAsset.getArchive().as(type); } ArchiveFormat archiveFormat = this.configuration.getExtensionLoader() .getArchiveFormatFromExtensionMapping(type); return getAsType(type, path, archiveFormat); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#getAsType(java.lang.Class, org.jboss.shrinkwrap.api.ArchivePath) */ @Override public <X extends Archive<X>> X getAsType(Class<X> type, ArchivePath path) { Validate.notNull(type, "Type must be specified"); Validate.notNull(path, "ArchivePath must be specified"); Node content = get(path); if (content == null) { return null; } Asset asset = content.getAsset(); if (asset == null) { return null; } if (asset instanceof ArchiveAsset) { ArchiveAsset archiveAsset = (ArchiveAsset) asset; return archiveAsset.getArchive().as(type); } ArchiveFormat archiveFormat = this.configuration.getExtensionLoader() .getArchiveFormatFromExtensionMapping(type); return getAsType(type, path, archiveFormat); }