net.groboclown.util.jplugin.v2
Class ClassAttributes

java.lang.Object
  |
  +--net.groboclown.util.jplugin.v2.ClassAttributes

public class ClassAttributes
extends Object

Maintains a list attributes and a collection of values that each attribute may contain. The attribute names are not case sensitive, and the values are optionally case sensitive.

Version:
0.9.0 Alpha
Author:
Matt Albrecht

Inner Class Summary
private static class ClassAttributes.NoCaseStr
          A Non-case sensitive string
private static class ClassAttributes.ValueSet
          A collection of values
 
Field Summary
private  Vector names
           
private  Hashtable nameStrToValStr
           
 
Constructor Summary
ClassAttributes()
          Default Constructor
 
Method Summary
 void addAttributes(ClassAttributes ca)
          Adds one set of attributes to the current list of attributes.
 boolean contains(String name)
          Checks if the attribute with the given name has an associated value.
 String get(String name)
          Returns the appended value string for the attribute of the given name.
 String[] getNames()
          Get all the names in the list.
 String[] getValues(String name)
          Returns the appended value string for the attribute of the given name.
 boolean hasAttribute(String attrib)
          Check if this class has a matching attribute name defined.
 boolean hasAttribute(String attrib, String val)
          Check if this class has a matching attribute with a matching value, ignoring the case of the value.
 boolean hasAttribute(String attrib, String val, boolean isCaseSensitive)
          Check if this class has a matching attribute with a matching value.
 void put(String name, String value)
          Adds the value to the attribute with the given name.
 String toString()
          Converts the attribute listing into a MANIFEST.MF compatible listing.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

nameStrToValStr

private Hashtable nameStrToValStr

names

private Vector names
Constructor Detail

ClassAttributes

public ClassAttributes()
Default Constructor
Method Detail

getNames

public String[] getNames()
Get all the names in the list.

addAttributes

public void addAttributes(ClassAttributes ca)
Adds one set of attributes to the current list of attributes. If attributes overlap, then they are joined with a "; ".

contains

public boolean contains(String name)
Checks if the attribute with the given name has an associated value.

put

public void put(String name,
                String value)
Adds the value to the attribute with the given name. If the name already has an attribute with a value, then the given value is appended to the attribute.

get

public String get(String name)
Returns the appended value string for the attribute of the given name.

getValues

public String[] getValues(String name)
Returns the appended value string for the attribute of the given name.

hasAttribute

public boolean hasAttribute(String attrib)
Check if this class has a matching attribute name defined.

hasAttribute

public boolean hasAttribute(String attrib,
                            String val)
Check if this class has a matching attribute with a matching value, ignoring the case of the value.
Parameters:
val - the value which the attribute must contain, or null if you want to check if the attribute is not defined.

hasAttribute

public boolean hasAttribute(String attrib,
                            String val,
                            boolean isCaseSensitive)
Check if this class has a matching attribute with a matching value.
Parameters:
val - the value which the attribute must contain, or null if you want to check if the attribute is not defined.
isCaseSensitive - true if the values must match their cases exactly.

toString

public String toString()
Converts the attribute listing into a MANIFEST.MF compatible listing.
Overrides:
toString in class Object


Written under the LGPL