org.eclipse.jgit.storage.dht.spi.util
Class ColumnMatcher

java.lang.Object
  extended by org.eclipse.jgit.storage.dht.spi.util.ColumnMatcher

public class ColumnMatcher
extends java.lang.Object

Utility to deal with columns named as byte arrays.


Constructor Summary
ColumnMatcher(java.lang.String nameStr)
          Create a new column matcher for the given named string.
 
Method Summary
 byte[] append(byte[] suffix)
          Append a suffix onto this column name.
 byte[] append(RowKey suffix)
          Append a suffix onto this column name.
 byte[] name()
           
 boolean sameFamily(byte[] col)
          Check if the column is a member of this family.
 boolean sameName(byte[] col)
          Check if the column is an exact match.
 byte[] suffix(byte[] col)
          Extract the portion of the column name that comes after the family.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColumnMatcher

public ColumnMatcher(java.lang.String nameStr)
Create a new column matcher for the given named string.

Parameters:
nameStr - the column name, as a string.
Method Detail

name

public byte[] name()
Returns:
the column name, encoded in UTF-8.

sameName

public boolean sameName(byte[] col)
Check if the column is an exact match.

Parameters:
col - the column as read from the database.
Returns:
true only if col is exactly the same as this column.

sameFamily

public boolean sameFamily(byte[] col)
Check if the column is a member of this family.

This method checks that name() (the string supplied to the constructor) is a prefix of col.

Parameters:
col - the column as read from the database.
Returns:
true if col is a member of this column family.

suffix

public byte[] suffix(byte[] col)
Extract the portion of the column name that comes after the family.

Parameters:
col - the column as read from the database.
Returns:
everything after the family name.

append

public byte[] append(RowKey suffix)
Append a suffix onto this column name.

Parameters:
suffix - name component to appear after the family name.
Returns:
the joined name, ready for storage in the database.

append

public byte[] append(byte[] suffix)
Append a suffix onto this column name.

Parameters:
suffix - name component to appear after the family name.
Returns:
the joined name, ready for storage in the database.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2011. All Rights Reserved.