public static Metadata fromManifest(Manifest mf) {
        Metadata metadata = new Metadata();
        final Attributes.Name[] attribs = { Attributes.Name.MANIFEST_VERSION,
                Attributes.Name.IMPLEMENTATION_TITLE,
                Attributes.Name.IMPLEMENTATION_URL,
                Attributes.Name.IMPLEMENTATION_VENDOR,
                Attributes.Name.IMPLEMENTATION_VENDOR_ID,
                Attributes.Name.IMPLEMENTATION_VERSION,
                Attributes.Name.MAIN_CLASS };
        for (Attributes.Name attrib : attribs) {
            Object o = mf.getMainAttributes().get(attrib);
            if (o != null) {
                metadata.put(attrib.toString(), o.toString());
            }
        }
        return metadata;
    }
public static Metadata fromManifest ( Manifest mf ) { Metadata metadata = new Metadata ( ) ; final Attributes . Name [ ] attribs = { Attributes . Name . MANIFEST_VERSION , Attributes . Name . IMPLEMENTATION_TITLE , Attributes . Name . IMPLEMENTATION_URL , Attributes . Name . IMPLEMENTATION_VENDOR , Attributes . Name . IMPLEMENTATION_VENDOR_ID , Attributes . Name . IMPLEMENTATION_VERSION , Attributes . Name . MAIN_CLASS } ; for ( Attributes . Name attrib : attribs ) { Object o = mf . getMainAttributes ( ) . get ( attrib ) ; if ( o != null ) { metadata . put ( attrib . toString ( ) , o . toString ( ) ) ; } } return metadata ; }
Extracts required attributes and their values from a {@link Manifest}
object.

@param mf
A Manifest file.
@return HashMap of the type {atribute name : attribute value}.