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; return metaAttributeContext;
} }
@Override
public int getValuesSpan() {
if ( value == null ) {
return 0;
}
else if ( value instanceof Tuple ) {
return ( ( Tuple ) value ).valuesSpan();
}
else {
return 1;
}
}
@Override @Override
public Iterable<SimpleValue> getValues() { public Iterable<SimpleValue> getValues() {
return value == null return value == null

View File

@ -71,6 +71,17 @@ public interface AttributeBinding {
*/ */
public MetaAttributeContext getMetaAttributeContext(); 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 * @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}, * 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; return table;
} }
public int valuesSpan() {
return values.size();
}
@Override @Override
public Iterable<SimpleValue> values() { public Iterable<SimpleValue> values() {
return values; return values;