net.sourceforge.pbeans
Class Index

java.lang.Object
  extended by net.sourceforge.pbeans.Index

public class Index
extends java.lang.Object

Represents a database index. An array of instances of Index may be used in a StoreInfo implementation to indicate which table indexes should be created.

See Also:
StoreInfo.getIndexes(net.sourceforge.pbeans.Store)

Constructor Summary
Index(boolean unique, java.lang.String propertyName)
          Construcst an instance of Index.
Index(boolean unique, java.lang.String[] propertyNames, int keyLength)
          Construcst an instance of Index.
Index(java.lang.String[] propertyNames)
          Construcst an instance of Index.
 
Method Summary
 void addPropertyName(java.lang.String name)
          Adds a property name to the index.
 boolean equals(java.lang.Object other)
          Compares this Index with another.
 int getKeyLength()
           
 java.util.Collection getPropertyNames()
           
 int hashCode()
           
 boolean isUnique()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Index

public Index(java.lang.String[] propertyNames)
Construcst an instance of Index.

Parameters:
propertyNames - The names of JavaBean properties belonging to this index.

Index

public Index(boolean unique,
             java.lang.String propertyName)
Construcst an instance of Index.

Parameters:
unique - If true, the underlying table may not have two rows with the same property value for the property name given.
propertyName - The name of a JavaBean property belonging to this index.

Index

public Index(boolean unique,
             java.lang.String[] propertyNames,
             int keyLength)
Construcst an instance of Index.

Parameters:
unique - If true, the underlying table may not have two rows with the same set of property values for the property names given.
propertyNames - The names of JavaBean properties belonging to this index.
keyLength - Index length for string fields. If it's zero, it isn't used.
Method Detail

getKeyLength

public int getKeyLength()

getPropertyNames

public java.util.Collection getPropertyNames()

isUnique

public boolean isUnique()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Compares this Index with another.

Overrides:
equals in class java.lang.Object
Returns:
True if their uniqueness is the same and the sets of property names are equivalent.

addPropertyName

public void addPropertyName(java.lang.String name)
Adds a property name to the index. Note that this will change the identity of the index, and will thus affect the equals method.

Parameters:
name -