Class Manifest.Section

  • All Implemented Interfaces:
    java.lang.Iterable<java.lang.String>
    Enclosing class:
    Manifest

    public static class Manifest.Section
    extends java.lang.Object
    implements java.lang.Iterable<java.lang.String>
    A manifest section - you can nest attribute elements into sections. A section consists of a set of attribute values, separated from other sections by a blank line.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Vector<java.lang.String> attributeIndex
      Index used to retain the attribute ordering
      private java.util.Hashtable<java.lang.String,​Manifest.Attribute> attributes
      The section's attributes.
      private java.lang.String name
      The section's name if any.
      private java.util.Vector<java.lang.String> warnings
      Warnings for this section
    • Constructor Summary

      Constructors 
      Constructor Description
      Section()  
    • Field Detail

      • warnings

        private java.util.Vector<java.lang.String> warnings
        Warnings for this section
      • name

        private java.lang.String name
        The section's name if any. The main section in a manifest is unnamed.
      • attributes

        private java.util.Hashtable<java.lang.String,​Manifest.Attribute> attributes
        The section's attributes.
      • attributeIndex

        private java.util.Vector<java.lang.String> attributeIndex
        Index used to retain the attribute ordering
    • Constructor Detail

      • Section

        public Section()
    • Method Detail

      • setName

        public void setName​(java.lang.String name)
        The name of the section; optional -default is the main section.
        Parameters:
        name - the section's name
      • getName

        public java.lang.String getName()
        Get the Section's name.
        Returns:
        the section's name.
      • iterator

        public java.util.Iterator<java.lang.String> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.String>
      • getAttribute

        public Manifest.Attribute getAttribute​(java.lang.String attributeName)
        Get a attribute of the section
        Parameters:
        attributeName - the name of the attribute
        Returns:
        a Manifest.Attribute instance if the attribute is single-valued, otherwise a Vector of Manifest.Attribute instances.
      • addConfiguredAttribute

        public void addConfiguredAttribute​(Manifest.Attribute attribute)
                                    throws ManifestException
        Add an attribute to the section.
        Parameters:
        attribute - the attribute to be added to the section
        Throws:
        ManifestException - if the attribute is not valid.
      • addAttributeAndCheck

        public java.lang.String addAttributeAndCheck​(Manifest.Attribute attribute)
                                              throws ManifestException
        Add an attribute to the section
        Parameters:
        attribute - the attribute to be added.
        Returns:
        the value of the attribute if it is a name attribute - null other wise
        Throws:
        ManifestException - if the attribute already exists in this section.
      • storeAttribute

        protected void storeAttribute​(Manifest.Attribute attribute)
        Store an attribute and update the index.
        Parameters:
        attribute - the attribute to be stored
      • getWarnings

        public java.util.Enumeration<java.lang.String> getWarnings()
        Get the warnings for this section.
        Returns:
        an Enumeration of warning strings.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()
      • equals

        public boolean equals​(java.lang.Object rhs)
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)