org.hypergraphdb.type.javaprimitive
Class StringType
java.lang.Object
org.hypergraphdb.type.javaprimitive.PrimitiveTypeBase<java.lang.String>
org.hypergraphdb.type.javaprimitive.StringType
- All Implemented Interfaces:
- java.util.Comparator<byte[]>, HGGraphHolder, HGOrderedSearchable<java.lang.String,HGPersistentHandle>, HGSearchable<java.lang.String,HGPersistentHandle>, ByteArrayConverter<java.lang.String>, HGAtomType, HGPrimitiveType<java.lang.String>
public final class StringType
- extends PrimitiveTypeBase<java.lang.String>
The implementation of the primitive String type.
This implementation should be used only for relatively small strings, things like
names or titles, since they are indexed and reference counted for lookup.
If you want to store larger text data, including big documents, use the
TextType instead.
A java.lang.String object is translated to a byte [] as
follows:
- The first 4 bytes consitute an unsigned integer - the reference count
for the string. The reference count is managed by the superclass
- The fifth byte is a descriptor tag that indicates whether the string is
null, empty or it has actual content: 0 means null, 1 means empty
and 2 means we have something. In the future this might be extended to support
various encodings.
- The rest of the bytes constitute the actual string with the default 8-bit
Java encoding.
- Author:
- Borislav Iordanov
|
Method Summary |
java.util.Comparator<byte[]> |
getComparator()
Return a java.util.Comparator instance that provides
an order relation of the values of the primitive type. |
| Methods inherited from class org.hypergraphdb.type.javaprimitive.PrimitiveTypeBase |
compare, find, findGT, findGTE, findLT, findLTE, fromByteArray, getRefCountFor, make, release, setHyperGraph, store, subsumes, toByteArray |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Comparator |
equals |
INDEX_NAME
public static final java.lang.String INDEX_NAME
- See Also:
- Constant Field Values
StringType
public StringType()
getComparator
public java.util.Comparator<byte[]> getComparator()
- Description copied from interface:
HGPrimitiveType
- Return a
java.util.Comparator instance that provides
an order relation of the values of the primitive type. An implementation
is allowed to return null in which case it is assumed
that the type does not offer an ordering relation. However, if a
non-null value is returned, it is must be of a publicly available
and default constructible class.