Search in sources :

Example 1 with MapKeyEntityViewBuilderListener

use of com.blazebit.persistence.view.MapKeyEntityViewBuilderListener in project blaze-persistence by Blazebit.

the class EntityViewBuilderBaseImpl method withBuilder.

@Override
public <K, V> EntityViewNestedBuilder<K, ? extends EntityViewNestedBuilder<V, ? extends BuilderType, ?>, ?> withBuilder(MapAttribute<ViewType, K, V> attribute) {
    AbstractAttribute<?, ?> attr = getAttribute(attribute);
    checkType(((MapAttribute<?, ?, ?>) attr).getKeyType(), "key", attr);
    checkType(attr.getElementType(), "element", attr);
    MapKeyEntityViewBuilderListener listener = new MapKeyEntityViewBuilderListener(getMap(attr));
    Map<ManagedViewType<? extends V>, String> inheritanceSubtypeMappings = ((PluralAttribute<?, ?, V>) attr).getElementInheritanceSubtypeMappings();
    EntityViewNestedBuilder<V, ? extends BuilderType, ?> valueBuilder = new EntityViewNestedBuilderImpl<>(evm, (ManagedViewTypeImplementor<V>) attr.getElementType(), inheritanceSubtypeMappings, optionalParameters, (BuilderType) this, listener);
    Map<ManagedViewType<? extends K>, String> keyInheritanceSubtypeMappings = ((MapAttribute<?, K, ?>) attr).getKeyInheritanceSubtypeMappings();
    return new EntityViewNestedBuilderImpl<>(evm, (ManagedViewTypeImplementor<K>) attr.getElementType(), keyInheritanceSubtypeMappings, optionalParameters, valueBuilder, listener);
}
Also used : ManagedViewType(com.blazebit.persistence.view.metamodel.ManagedViewType) MapAttribute(com.blazebit.persistence.view.metamodel.MapAttribute) PluralAttribute(com.blazebit.persistence.view.metamodel.PluralAttribute) MapKeyEntityViewBuilderListener(com.blazebit.persistence.view.MapKeyEntityViewBuilderListener)

Example 2 with MapKeyEntityViewBuilderListener

use of com.blazebit.persistence.view.MapKeyEntityViewBuilderListener in project blaze-persistence by Blazebit.

the class EntityViewBuilderBaseImpl method withMapBuilder.

private <K, V> EntityViewNestedBuilder<K, ? extends EntityViewNestedBuilder<V, ? extends BuilderType, ?>, ?> withMapBuilder(AbstractAttribute<?, ?> attr) {
    checkAttribute(attr, MapAttribute.class, "Map");
    checkType(((MapAttribute<?, ?, ?>) attr).getKeyType(), "key", attr);
    checkType(attr.getElementType(), "element", attr);
    MapKeyEntityViewBuilderListener listener = new MapKeyEntityViewBuilderListener(getMap(attr));
    Map<ManagedViewType<? extends V>, String> inheritanceSubtypeMappings = ((PluralAttribute<?, ?, V>) attr).getElementInheritanceSubtypeMappings();
    EntityViewNestedBuilder<V, ? extends BuilderType, ?> valueBuilder = new EntityViewNestedBuilderImpl<>(evm, (ManagedViewTypeImplementor<V>) attr.getElementType(), inheritanceSubtypeMappings, optionalParameters, (BuilderType) this, listener);
    Map<ManagedViewType<? extends K>, String> keyInheritanceSubtypeMappings = ((MapAttribute<?, K, ?>) attr).getKeyInheritanceSubtypeMappings();
    return new EntityViewNestedBuilderImpl<>(evm, (ManagedViewTypeImplementor<K>) attr.getElementType(), keyInheritanceSubtypeMappings, optionalParameters, valueBuilder, listener);
}
Also used : ManagedViewType(com.blazebit.persistence.view.metamodel.ManagedViewType) MapAttribute(com.blazebit.persistence.view.metamodel.MapAttribute) PluralAttribute(com.blazebit.persistence.view.metamodel.PluralAttribute) MapKeyEntityViewBuilderListener(com.blazebit.persistence.view.MapKeyEntityViewBuilderListener)

Aggregations

MapKeyEntityViewBuilderListener (com.blazebit.persistence.view.MapKeyEntityViewBuilderListener)2 ManagedViewType (com.blazebit.persistence.view.metamodel.ManagedViewType)2 MapAttribute (com.blazebit.persistence.view.metamodel.MapAttribute)2 PluralAttribute (com.blazebit.persistence.view.metamodel.PluralAttribute)2