Methods Summary |
---|
public java.lang.String | getAlias()
throw new UnsupportedOperationException("constructor may not be aliased");
|
public java.lang.String[] | getAliases()
SelectExpression[] selectExpressions = collectSelectExpressions();
String[] aliases = new String[selectExpressions.length] ;
for ( int i=0; i<selectExpressions.length; i++ ) {
String alias = selectExpressions[i].getAlias();
aliases[i] = alias==null ? Integer.toString(i) : alias;
}
return aliases;
|
public java.lang.reflect.Constructor | getConstructor()
return constructor;
|
public java.util.List | getConstructorArgumentTypeList()
return Arrays.asList( constructorArgumentTypes );
|
public org.hibernate.type.Type | getDataType()
/*
// Return the type of the object created by the constructor.
AST firstChild = getFirstChild();
String text = firstChild.getText();
if ( firstChild.getType() == SqlTokenTypes.DOT ) {
DotNode dot = ( DotNode ) firstChild;
text = dot.getPath();
}
return getSessionFactoryHelper().requireEntityType( text );
*/
throw new UnsupportedOperationException( "getDataType() is not supported by ConstructorNode!" );
|
protected antlr.collections.AST | getFirstSelectExpression()
// Collect the select expressions, skip the first child because it is the class name.
return getFirstChild().getNextSibling();
|
public FromElement | getFromElement()
return null;
|
public boolean | isConstructor()
return true;
|
public boolean | isList()
return isList;
|
public boolean | isMap()
return isMap;
|
public boolean | isReturnableEntity()
return false;
|
public boolean | isScalar()
// Constructors are always considered scalar results.
return true;
|
public void | prepare()
constructorArgumentTypes = resolveConstructorArgumentTypes();
String path = ( ( PathNode ) getFirstChild() ).getPath();
if ( "map".equals( path.toLowerCase() ) ) {
isMap = true;
}
else if ( "list".equals( path.toLowerCase() ) ) {
isList = true;
}
else {
constructor = resolveConstructor(path);
}
|
private java.lang.reflect.Constructor | resolveConstructor(java.lang.String path)
String importedClassName = getSessionFactoryHelper().getImportedClassName( path );
String className = StringHelper.isEmpty( importedClassName ) ? path : importedClassName;
if ( className == null ) {
throw new SemanticException( "Unable to locate class [" + path + "]" );
}
try {
Class holderClass = ReflectHelper.classForName( className );
return ReflectHelper.getConstructor( holderClass, constructorArgumentTypes );
}
catch ( ClassNotFoundException e ) {
throw new DetailedSemanticException( "Unable to locate class [" + className + "]", e );
}
catch ( PropertyNotFoundException e ) {
// this is the exception returned by ReflectHelper.getConstructor() if it cannot
// locate an appropriate constructor
throw new DetailedSemanticException( "Unable to locate appropriate constructor on class [" + className + "]", e );
}
|
private org.hibernate.type.Type[] | resolveConstructorArgumentTypes()
SelectExpression[] argumentExpressions = collectSelectExpressions();
if ( argumentExpressions == null ) {
// return an empty Type array
return new Type[]{};
}
Type[] types = new Type[argumentExpressions.length];
for ( int x = 0; x < argumentExpressions.length; x++ ) {
types[x] = argumentExpressions[x].getDataType();
}
return types;
|
public void | setAlias(java.lang.String alias)
throw new UnsupportedOperationException("constructor may not be aliased");
|
public void | setScalarColumnText(int i)
SelectExpression[] selectExpressions = collectSelectExpressions();
// Invoke setScalarColumnText on each constructor argument.
for ( int j = 0; j < selectExpressions.length; j++ ) {
SelectExpression selectExpression = selectExpressions[j];
selectExpression.setScalarColumnText( j );
}
|