Package antlr

Examples of antlr.SemanticException


   * @throws SemanticException if selectExpression or
   *         selectExpression.getAlias() is null.
   */
  public void setSelectExpression(SelectExpression selectExpression) throws SemanticException {
    if ( selectExpression == null || selectExpression.getAlias() == null ) {
      throw new SemanticException( "A ResultVariableRefNode must refer to a non-null alias." );
    }
    this.selectExpression = selectExpression;
  }
View Full Code Here


    SessionFactoryHelper sessionFactoryHelper = getSessionFactoryHelper();
    collectionNode.resolveIndex( this );        // Fully resolve the map reference, create implicit joins.

    Type type = collectionNode.getDataType();
    if ( !type.isCollectionType() ) {
      throw new SemanticException( "The [] operator cannot be applied to type " + type.toString() );
    }
    String collectionRole = ( (CollectionType) type ).getRole();
    QueryableCollection queryableCollection = sessionFactoryHelper.requireQueryableCollection( collectionRole );
    if ( !queryableCollection.hasIndex() ) {
      throw new QueryException( "unindexed fromElement before []: " + collectionNode.getPath() );
View Full Code Here

    }
  }

  private void checkForDuplicateClassAlias(String classAlias) throws SemanticException {
    if ( classAlias != null && fromElementByClassAlias.containsKey( classAlias ) ) {
      throw new SemanticException( "Duplicate definition of alias '" + classAlias + "'" );
    }
  }
View Full Code Here

  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 );
    }
View Full Code Here

    String text = queryableCollection.getTableName();
    AST ast = createFromElement( text );
    FromElement destination = (FromElement) ast;
    Type elementType = queryableCollection.getElementType();
    if ( elementType.isCollectionType() ) {
      throw new SemanticException( "Collections of collections are not supported!" );
    }
    destination.initializeCollection( fromClause, classAlias, tableAlias );
    destination.setType( JOIN_FRAGMENT );        // Tag this node as a JOIN.
    destination.setIncludeSubclasses( false );    // Don't include subclasses in the join.
    destination.setCollectionJoin( true );        // This is a clollection join.
View Full Code Here

  @Override
  public void initialize() throws SemanticException {
    final Node lhs = getLeftHandOperand();
    if ( lhs == null ) {
      throw new SemanticException( "left-hand operand of in operator was null" );
    }

    final Node inList = getInList();
    if ( inList == null ) {
      throw new SemanticException( "right-hand operand of in operator was null" );
    }

    // for expected parameter type injection, we expect that the lhs represents
    // some form of property ref and that the children of the in-list represent
    // one-or-more params.
View Full Code Here

   * nodes and setting their expected type, if possible.
   */
  public void initialize() throws SemanticException {
    Node lhs = getLeftHandOperand();
    if ( lhs == null ) {
      throw new SemanticException( "left-hand operand of a binary operator was null" );
    }
    Node rhs = getRightHandOperand();
    if ( rhs == null ) {
      throw new SemanticException( "right-hand operand of a binary operator was null" );
    }

    Type lhsType = extractDataType( lhs );
    Type rhsType = extractDataType( rhs );

View Full Code Here

    SessionFactoryHelper sessionFactoryHelper = getSessionFactoryHelper();
    collectionNode.resolveIndex( this );    // Fully resolve the map reference, create implicit joins.

    Type type = collectionNode.getDataType();
    if ( !type.isCollectionType() ) {
      throw new SemanticException( "The [] operator cannot be applied to type " + type.toString() );
    }
    String collectionRole = ( ( CollectionType ) type ).getRole();
    QueryableCollection queryableCollection = sessionFactoryHelper.requireQueryableCollection( collectionRole );
    if ( !queryableCollection.hasIndex() ) {
      throw new QueryException( "unindexed fromElement before []: " + collectionNode.getPath() );
View Full Code Here

*/
public class CollectionFunction extends MethodNode implements DisplayableNode {
  public void resolve(boolean inSelect) throws SemanticException {
    initializeMethodNode( this, inSelect );
    if ( !isCollectionPropertyMethod() ) {
      throw new SemanticException( this.getText() + " is not a collection property name!" );
    }
    AST expr = getFirstChild();
    if ( expr == null ) {
      throw new SemanticException( this.getText() + " requires a path!" );
    }
    resolveCollectionProperty( expr );
  }
View Full Code Here

          if (f_AST == null) {
            if (filter) {
              f_AST = (AST)astFactory.make( (new ASTArray(1)).add(astFactory.create(FROM,"{filter-implied FROM}")));
            }
            else
              throw new SemanticException("FROM expected (non-filter queries must contain a FROM clause)");
          }
           
          // Create an artificial token so the 'FROM' can be placed
          // before the SELECT in the tree to make tree processing
          // simpler.
View Full Code Here

TOP

Related Classes of antlr.SemanticException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.