R - The type of key/value association rows supported by this factory.public abstract class StructureOptimizerAssociationRowFactory<R> extends Object implements AssociationRowFactory
AssociationRowFactory implementations which support association rows stored as key/value
tuples as well as rows stored as collections of single values.
Also removes top property from embedded id references.
This is opening the way to optimise the storage and remove the column name from the structure for collections of
single values.
The single value form may be used to persist association rows with exactly one column (which is the case for collections of
simple values such as ints, String s etc. as well as associations based on non-composite keys). In
this case a row object of type R will be created using the column value and the single row key column which
is not part of the association key.
For rows with more than one column it is assumed that they are already of type R and they are thus passed
through as is.
If the referenced entity uses composite keys, the embedded id property name is removed from the reference.
'games': [ { 'id.id1': 'foo', 'id.id2': 'bar' } ]
or
'games': [ { 'id': { 'id1': 'foo', 'id2': 'bar' } } ]
are replaced by
'games': [ { 'id1': 'foo', 'id2': 'bar' } ]
| Modifier | Constructor and Description |
|---|---|
protected |
StructureOptimizerAssociationRowFactory(Class<?> associationRowType) |
| Modifier and Type | Method and Description |
|---|---|
AssociationRow<?> |
createAssociationRow(AssociationKey associationKey,
Object row)
Creates an association row.
|
protected abstract AssociationRow.AssociationRowAccessor<R> |
getAssociationRowAccessor(String[] prefixedColumns,
String prefix)
Returns the
AssociationRow.AssociationRowAccessor to be used to obtain values from the AssociationRow
created by this factory. |
protected abstract R |
getSingleColumnRow(String columnName,
Object value)
Creates a row object with the given column name and value.
|
protected StructureOptimizerAssociationRowFactory(Class<?> associationRowType)
public AssociationRow<?> createAssociationRow(AssociationKey associationKey, Object row)
AssociationRowFactorycreateAssociationRow in interface AssociationRowFactoryassociationKey - The key of the association owning the given row. Will be used as source for values present
in the key.row - The association row in a store-specific representationprotected abstract R getSingleColumnRow(String columnName, Object value)
protected abstract AssociationRow.AssociationRowAccessor<R> getAssociationRowAccessor(String[] prefixedColumns, String prefix)
AssociationRow.AssociationRowAccessor to be used to obtain values from the AssociationRow
created by this factory.
If some columns lost their prefix in the persisted representation, pass the prefixedColumns
and the prefix. Otherwise the prefix is null.Copyright © 2010-2018 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.