org.apache.geronimo.kernel.config
Class Manifest.Attribute

java.lang.Object
  extended by org.apache.geronimo.kernel.config.Manifest.Attribute
All Implemented Interfaces:
Serializable
Enclosing class:
Manifest

public static class Manifest.Attribute
extends Object
implements Serializable

An attribute for the manifest. Those attributes that are not nested into a section will be added to the "Main" section.

See Also:
Serialized Form

Nested Class Summary
static class Manifest.Attribute.Separator
           
 
Constructor Summary
Manifest.Attribute()
          Construct an empty attribute
Manifest.Attribute(Manifest.Attribute.Separator separator)
           
Manifest.Attribute(Manifest.Attribute.Separator separator, String name, Collection<String> values)
           
Manifest.Attribute(Manifest.Attribute.Separator separator, String name, String value)
           
Manifest.Attribute(String line)
          Construct an attribute by parsing a line from the Manifest
Manifest.Attribute(String name, String value)
          Construct a manifest by specifying its name and value
 
Method Summary
 void addContinuation(String line)
          Add a continuation line from the Manifest file.
 void addValue(String value)
          Add a new value to this attribute - making it multivalued.
 boolean equals(Object rhs)
           
 String getKey()
          Get the attribute's Key - its name in lower case.
 String getName()
          Get the Attribute's name
 String getValue()
          Get the Attribute's value.
 List<String> getValues()
          Get all the attribute's values.
 int hashCode()
           
 void parse(String line)
          Parse a line into name and value pairs
 void setName(String name)
          Set the Attribute's name; required
 void setValue(String value)
          Set the Attribute's value; required
 void write(PrintWriter writer)
          Write the attribute out to a print writer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Manifest.Attribute

public Manifest.Attribute()
Construct an empty attribute


Manifest.Attribute

public Manifest.Attribute(Manifest.Attribute.Separator separator)

Manifest.Attribute

public Manifest.Attribute(String line)
                   throws ManifestException
Construct an attribute by parsing a line from the Manifest

Parameters:
line - the line containing the attribute name and value
Throws:
ManifestException - if the line is not valid

Manifest.Attribute

public Manifest.Attribute(String name,
                          String value)
Construct a manifest by specifying its name and value

Parameters:
name - the attribute's name
value - the Attribute's value

Manifest.Attribute

public Manifest.Attribute(Manifest.Attribute.Separator separator,
                          String name,
                          String value)

Manifest.Attribute

public Manifest.Attribute(Manifest.Attribute.Separator separator,
                          String name,
                          Collection<String> values)
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Returns:
a hashcode based on the key and values.
See Also:
Object.hashCode()

equals

public boolean equals(Object rhs)
Overrides:
equals in class Object
Parameters:
rhs - the object to check for equality.
Returns:
true if the key and values are the same.
See Also:
Object.equals(java.lang.Object)

parse

public void parse(String line)
           throws ManifestException
Parse a line into name and value pairs

Parameters:
line - the line to be parsed
Throws:
ManifestException - if the line does not contain a colon separating the name and value

setName

public void setName(String name)
Set the Attribute's name; required

Parameters:
name - the attribute's name

getName

public String getName()
Get the Attribute's name

Returns:
the attribute's name.

getKey

public String getKey()
Get the attribute's Key - its name in lower case.

Returns:
the attribute's key.

setValue

public void setValue(String value)
Set the Attribute's value; required

Parameters:
value - the attribute's value

getValue

public String getValue()
Get the Attribute's value.

Returns:
the attribute's value.

addValue

public void addValue(String value)
Add a new value to this attribute - making it multivalued.

Parameters:
value - the attribute's additional value

getValues

public List<String> getValues()
Get all the attribute's values.

Returns:
an enumeration of the attributes values

addContinuation

public void addContinuation(String line)
Add a continuation line from the Manifest file. When lines are too long in a manifest, they are continued on the next line by starting with a space. This method adds the continuation data to the attribute value by skipping the first character.

Parameters:
line - the continuation line.

write

public void write(PrintWriter writer)
           throws IOException
Write the attribute out to a print writer.

Parameters:
writer - the Writer to which the attribute is written
Throws:
IOException - if the attribute value cannot be written


Copyright © 2003-2013 The Apache Geronimo development community. All Rights Reserved.