HHH-6364 : Add AttributeBinding.getValuesSpan() and Tuple.valuesSpan()
This commit is contained in:
parent
b174d78358
commit
83ba7be3a3
|
@ -165,6 +165,20 @@ public abstract class AbstractAttributeBinding implements AttributeBinding {
|
|||
return metaAttributeContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValuesSpan() {
|
||||
if ( value == null ) {
|
||||
return 0;
|
||||
}
|
||||
else if ( value instanceof Tuple ) {
|
||||
return ( ( Tuple ) value ).valuesSpan();
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Iterable<SimpleValue> getValues() {
|
||||
return value == null
|
||||
|
|
|
@ -71,6 +71,17 @@ public interface AttributeBinding {
|
|||
*/
|
||||
public MetaAttributeContext getMetaAttributeContext();
|
||||
|
||||
/**
|
||||
* Returns the number of {@link org.hibernate.metamodel.relational.SimpleValue}
|
||||
* objects that will be returned by {@link #getValues()}
|
||||
*
|
||||
* @return the number of objects that will be returned by {@link #getValues()}.
|
||||
*
|
||||
* @see {@link org.hibernate.metamodel.relational.SimpleValue}
|
||||
* @see {@link #getValues()}
|
||||
*/
|
||||
public int getValuesSpan();
|
||||
|
||||
/**
|
||||
* @return In the case that {@link #getValue()} represents a {@link org.hibernate.metamodel.relational.Tuple} this method
|
||||
* gives access to its compound values. In the case of {@link org.hibernate.metamodel.relational.SimpleValue},
|
||||
|
|
|
@ -56,6 +56,10 @@ public class Tuple implements Value, ValueContainer, Loggable {
|
|||
return table;
|
||||
}
|
||||
|
||||
public int valuesSpan() {
|
||||
return values.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<SimpleValue> values() {
|
||||
return values;
|
||||
|
|
Loading…
Reference in New Issue