Titan supports a number of classes for attribute values on properties. Titan efficiently serializes primitives, primitive arrays, Date
, ArrayList
and HashMap
. By default, Titan allows arbitrary objects as attribute values on properties, but those use default serializer which have significant overhead and may not be as efficient.
Option | Description | Value | Default | Modifiable |
---|---|---|---|---|
attributes.allow-all | If enabled, arbitrary objects can be used as attributes on properties otherwise only pre-configured and configured attributes are allowed | true or false | true | No |
To configure a custom attribute class with a custom serializer, follow these steps:
AttributeSerializer
for the custom attribute classattributes.attribute[X] = [Full attribute class name]
attributes.serializer[X] = [Full serializer class name]
For example, suppose we want to register a special integer attribute class called SpecialInt
and have implemented a custom serializer SpecialIntSerializer
that implements AttributeSerializer
. We already have 9 custom attributes configured in the configuration file, so we would add the following lines
attributes.attribute10 = com.example.SpecialInt
attributes.serializer10 = com.example.SpecialIntSerializer
Titan supports arbitrary objects as property attributes and uses Kryo’s default serializers to serialize such objects to disk. For this default serializer to work for a custom class, the following two conditions must be fulfilled:
equals(Object)
methodThe second requirement is Titan specific because Titan will test bot serialization and deserialization of a custom class before persisting data to disk.