@Override public String[] getAggregatedAliases() { if ( aggregatedAliases == null ) { aggregatedAliases = buildAggregatedAliases(); } return aggregatedAliases; }
private String[] buildAggregatedAliases() { 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; }
@Override public List getAggregatedSelectionTypeList() { return getConstructorArgumentTypeList(); }
public void prepare() throws SemanticException { constructorArgumentTypes = resolveConstructorArgumentTypes(); String path = ( (PathNode) getFirstChild() ).getPath(); if ( "map".equals( path.toLowerCase(Locale.ROOT) ) ) { isMap = true; resultType = Map.class; } else if ( "list".equals( path.toLowerCase(Locale.ROOT) ) ) { isList = true; resultType = List.class; } else { constructor = resolveConstructor( path ); resultType = constructor.getDeclaringClass(); } }
private Constructor resolveConstructor(String path) throws SemanticException { String importedClassName = getSessionFactoryHelper().getImportedClassName( path ); String className = StringHelper.isEmpty( importedClassName ) ? path : importedClassName; if ( className == null ) { throw new SemanticException( "Unable to locate class [" + path + "]" ); } try { final Class holderClass = getSessionFactoryHelper().getFactory() .getServiceRegistry() .getService( ClassLoaderService.class ) .classForName( className ); return ReflectHelper.getConstructor( holderClass, constructorArgumentTypes ); } catch (ClassLoadingException 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( formatMissingContructorExceptionMessage( className ), e ); } }
@Override protected void processConstructor(AST constructor) throws SemanticException { ConstructorNode constructorNode = (ConstructorNode) constructor; constructorNode.prepare(); }
@Override protected AST getFirstSelectExpression() { // Collect the select expressions, skip the first child because it is the class name. return getFirstChild().getNextSibling(); }
private Constructor resolveConstructor(String path) throws SemanticException { 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 ); } }
public void prepare() throws SemanticException { constructorArgumentTypes = resolveConstructorArgumentTypes(); String path = ( ( PathNode ) getFirstChild() ).getPath(); if ( "map".equals( path.toLowerCase() ) ) { isMap = true; resultType = Map.class; } else if ( "list".equals( path.toLowerCase() ) ) { isList = true; resultType = List.class; } else { constructor = resolveConstructor( path ); resultType = constructor.getDeclaringClass(); } }
@Override protected void processConstructor(AST constructor) throws SemanticException { ConstructorNode constructorNode = ( ConstructorNode ) constructor; constructorNode.prepare(); }
@Override protected AST getFirstSelectExpression() { // Collect the select expressions, skip the first child because it is the class name. return getFirstChild().getNextSibling(); }
private Constructor resolveConstructor(String path) throws SemanticException { 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 ); } }
public void prepare() throws SemanticException { constructorArgumentTypes = resolveConstructorArgumentTypes(); String path = ( ( PathNode ) getFirstChild() ).getPath(); if ( "map".equals( path.toLowerCase() ) ) { isMap = true; resultType = Map.class; } else if ( "list".equals( path.toLowerCase() ) ) { isList = true; resultType = List.class; } else { constructor = resolveConstructor( path ); resultType = constructor.getDeclaringClass(); } }
private Type[] resolveConstructorArgumentTypes() throws SemanticException { 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 List getAggregatedSelectionTypeList() { return getConstructorArgumentTypeList(); }
@Override protected void processConstructor(AST constructor) throws SemanticException { ConstructorNode constructorNode = ( ConstructorNode ) constructor; constructorNode.prepare(); }
public String[] getAggregatedAliases() { if ( aggregatedAliases == null ) { aggregatedAliases = buildAggregatedAliases(); } return aggregatedAliases; }
@Override protected AST getFirstSelectExpression() { // Collect the select expressions, skip the first child because it is the class name. return getFirstChild().getNextSibling(); }
@Override public void setScalarColumn(int i) throws SemanticException { SelectExpression[] selectExpressions = collectSelectExpressions(); // Invoke setScalarColumnText on each constructor argument. for ( int j = 0; j < selectExpressions.length; j++ ) { SelectExpression selectExpression = selectExpressions[j]; selectExpression.setScalarColumn( j ); } }
public List getAggregatedSelectionTypeList() { return getConstructorArgumentTypeList(); }