Search in sources :

Example 1 with ComparableSetBinding

use of jetbrains.exodus.bindings.ComparableSetBinding in project xodus by JetBrains.

the class PropertyTypes method clear.

public void clear() {
    typesById.clear();
    typesByClass.clear();
    for (final ComparableValueType predefinedType : ComparableValueType.PREDEFINED_COMPARABLE_VALUE_TYPES) {
        typesById.put(predefinedType.getTypeId(), predefinedType);
        typesByClass.put(predefinedType.getClazz(), predefinedType);
    }
    final ComparableValueType comparableSetType = typesByClass.get(ComparableSet.class);
    final ComparableSetBinding newBinding = new ComparableSetBinding() {

        @Override
        protected ComparableValueType getType(@NotNull Class<? extends Comparable> itemClass) {
            final ComparableValueType result = super.getType(itemClass);
            return result == null ? typesByClass.get(itemClass) : result;
        }

        @Override
        protected ComparableBinding getBinding(int valueTypeId) {
            final ComparableBinding result = super.getBinding(valueTypeId);
            return result == null ? typesById.get(valueTypeId).getBinding() : result;
        }
    };
    final int typeId = comparableSetType.getTypeId();
    final ComparableValueType newComparableSetType = new ComparableValueType(typeId, newBinding, comparableSetType.getClazz());
    typesByClass.put(ComparableSet.class, newComparableSetType);
    typesById.put(typeId, newComparableSetType);
}
Also used : ComparableSetBinding(jetbrains.exodus.bindings.ComparableSetBinding) ComparableBinding(jetbrains.exodus.bindings.ComparableBinding) NotNull(org.jetbrains.annotations.NotNull) ComparableValueType(jetbrains.exodus.bindings.ComparableValueType)

Aggregations

ComparableBinding (jetbrains.exodus.bindings.ComparableBinding)1 ComparableSetBinding (jetbrains.exodus.bindings.ComparableSetBinding)1 ComparableValueType (jetbrains.exodus.bindings.ComparableValueType)1 NotNull (org.jetbrains.annotations.NotNull)1