use of com.blazebit.persistence.view.MapEntityViewBuilderListener in project blaze-persistence by Blazebit.
the class EntityViewBuilderBaseImpl method withBuilder.
@Override
public <K, V> EntityViewNestedBuilder<V, ? extends BuilderType, ?> withBuilder(MapAttribute<ViewType, K, V> attribute, K key) {
if (key == null) {
throw new IllegalArgumentException("Illegal null key!");
}
AbstractAttribute<?, ?> attr = getAttribute(attribute);
checkAttribute(attr, MapAttribute.class, "Map");
Type<?> keyType = ((MapAttribute<?, ?, ?>) attr).getKeyType();
checkType(attr.getElementType(), "element", attr);
key = getValue(keyType, key);
Map<ManagedViewType<? extends V>, String> inheritanceSubtypeMappings = ((PluralAttribute<?, ?, V>) attr).getElementInheritanceSubtypeMappings();
return new EntityViewNestedBuilderImpl<>(evm, (ManagedViewTypeImplementor<V>) attr.getElementType(), inheritanceSubtypeMappings, optionalParameters, (BuilderType) this, new MapEntityViewBuilderListener(getMap(attr), key));
}
use of com.blazebit.persistence.view.MapEntityViewBuilderListener in project blaze-persistence by Blazebit.
the class EntityViewBuilderBaseImpl method withMapBuilder.
private <V> EntityViewNestedBuilder<V, ? extends BuilderType, ?> withMapBuilder(AbstractAttribute<?, ?> attr, Object key) {
if (key == null) {
throw new IllegalArgumentException("Illegal null key!");
}
checkAttribute(attr, MapAttribute.class, "Map");
Type<?> keyType = ((MapAttribute<?, ?, ?>) attr).getKeyType();
checkType(attr.getElementType(), "element", attr);
key = getValue(keyType, key);
Map<ManagedViewType<? extends V>, String> inheritanceSubtypeMappings = ((PluralAttribute<?, ?, V>) attr).getElementInheritanceSubtypeMappings();
return new EntityViewNestedBuilderImpl<>(evm, (ManagedViewTypeImplementor<V>) attr.getElementType(), inheritanceSubtypeMappings, optionalParameters, (BuilderType) this, new MapEntityViewBuilderListener(getMap(attr), key));
}
Aggregations