/** * Same as {@link #setManifest(Manifest)} except finds and loads the manifest file of the jar file that the * specified class is contained within. * * @param c The class whose jar file contains the manifest to use for this microservice. * @return This object (for method chaining). * @throws IOException If a problem occurred while trying to read the manifest file. */ public Microservice setManifest(Class<?> c) throws IOException { return setManifest(new ManifestFile(c)); }
/** * Same as {@link #setManifest(Manifest)} except specified through a {@link File} object. * * @param f The manifest file of this microservice. * @return This object (for method chaining). * @throws IOException If a problem occurred while trying to read the manifest file. */ public Microservice setManifest(File f) throws IOException { return setManifest(new ManifestFile(f)); }
/** * Shortcut for calling <code>setManifest(<jk>new</jk> ManifestFile(mf))</code>. * * @param mf The manifest file of this microservice. * @return This object (for method chaining). */ public Microservice setManifest(Manifest mf) { return setManifest(new ManifestFile(mf)); }
/** * Convenience method for specifying the manifest contents directly. * * @param contents The lines in the manifest file. * @return This object (for method chaining). * @throws IOException */ public Microservice setManifestContents(String...contents) throws IOException { String s = StringUtils.join(contents, "\n") + "\n"; return setManifest(new ManifestFile(new Manifest(new ByteArrayInputStream(s.getBytes("UTF-8"))))); }
this.manifest = (ManifestFile)value; else if (value instanceof Manifest) this.manifest = new ManifestFile((Manifest)value); else if (value instanceof Reader) this.manifest = new ManifestFile((Reader)value); else if (value instanceof InputStream) this.manifest = new ManifestFile((InputStream)value); else if (value instanceof File) this.manifest = new ManifestFile((File)value); else if (value instanceof String) this.manifest = new ManifestFile(new File((String)value)); else if (value instanceof Class) this.manifest = new ManifestFile((Class<?>)value); else throw new RuntimeException("Invalid type passed to MicroserviceBuilder.manifest(Object). Type=["+value.getClass().getName()+"]");
manifest = new ManifestFile(m);