frompathexpressionparser.java

来自「用Java实现的23个常用设计模式源代码」· Java 代码 · 共 33 行

JAVA
33
字号
//$Id: FromPathExpressionParser.java,v 1.1.2.2 2003/08/04 01:42:11 oneovthafew Exp $
package net.sf.hibernate.hql;

import net.sf.hibernate.QueryException;
import net.sf.hibernate.collection.CollectionPropertyMapping;
import net.sf.hibernate.type.Type;

public class FromPathExpressionParser extends PathExpressionParser {

	public void end(QueryTranslator q) throws QueryException {
		if ( !isCollectionValued() ) {
			Type type = getPropertyType();
			if ( type.isEntityType() ) {
				// "finish off" the join
				token(".", q);
				token(null, q);
			}
			else if ( type.isPersistentCollectionType() ) {
				// default to element set if no elements() specified
				token(".", q);
				token(CollectionPropertyMapping.COLLECTION_ELEMENTS, q);
			}
		}
		super.end(q);
	}
	
	protected void setExpectingCollectionIndex() throws QueryException {
		throw new QueryException("expecting .elements or .indices after collection path expression in from");
	}
	

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?