HHH-6364 : Add AttributeBinding.getValuesSpan() and Tuple.valuesSpan()

This commit is contained in:
Gail Badner 2011-06-24 14:42:49 -07:00
parent b174d78358
commit 83ba7be3a3
3 changed files with 29 additions and 0 deletions

View File

@ -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

View File

@ -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},

View File

@ -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;