org.hibernate.transform
public class: AliasToEntityMapResultTransformer [javadoc |
source]
java.lang.Object
org.hibernate.transform.BasicTransformerAdapter
org.hibernate.transform.AliasToEntityMapResultTransformer
All Implemented Interfaces:
Serializable, ResultTransformer
ResultTransformer implementation which builds a map for each "row", made up of each aliased value
where the alias is the map key.
Since this transformer is stateless, all instances would be considered equal. So for optimization purposes
we limit it to a single, singleton
instance (this is not quite true yet, see deprecation notice
on
constructor ).
- author:
Gavin - King
- author:
Steve - Ebersole
| Field Summary |
|---|
| public static final AliasToEntityMapResultTransformer | INSTANCE | |
| Method from org.hibernate.transform.AliasToEntityMapResultTransformer Detail: |
public boolean equals(Object other) {
// todo : we can remove this once the deprecated ctor can be made private...
return other != null && AliasToEntityMapResultTransformer.class.isInstance( other );
}
All AliasToEntityMapResultTransformer are considered equal |
public int hashCode() {
// todo : we can remove this once the deprecated ctor can be made private...
return getClass().getName().hashCode();
}
All AliasToEntityMapResultTransformer are considered equal |
public Object transformTuple(Object[] tuple,
String[] aliases) {
Map result = new HashMap(tuple.length);
for ( int i=0; i< tuple.length; i++ ) {
String alias = aliases[i];
if ( alias!=null ) {
result.put( alias, tuple[i] );
}
}
return result;
}
|