src/main/java/com/googlecode/objectify/impl/QueryImpl.java
void addOrder(String condition) {
		condition = condition.trim();
		boolean descending = false;

		if (condition.startsWith("-")) {
			descending = true;
			condition = condition.substring(1).trim();
		}

		// Prevent ordering by @Id or @Parent fields, which are really part of the key
		if (this.classRestriction != null) {
			final KeyMetadata<?> meta = loader.ofy.factory().keys().getMetadataSafe(this.classRestriction);

			if (condition.equals(meta.getParentFieldName()))
				throw new IllegalArgumentException("You cannot order by @Parent field. Perhaps you wish to order by __key__ instead?");

			if (condition.equals(meta.getIdFieldName())) {
				throw new IllegalArgumentException("You cannot order by @Id field. Perhaps you wish to order by __key__ instead?");
			}
		}

		this.actual = actual.orderBy(descending ? OrderBy.desc(condition) : OrderBy.asc(condition));
	}
void addOrder(String condition) {
		condition = condition.trim();
		boolean descending = false;

		if (condition.startsWith("-")) {
			descending = true;
			condition = condition.substring(1).trim();
		}

		// Prevent ordering by @Id or @Parent fields, which are really part of the key
		if (this.classRestriction != null) {
			final KeyMetadata<?> meta = loader.ofy.factory().keys().getMetadataSafe(this.classRestriction);

			if (condition.equals(meta.getParentFieldName()))
				throw new IllegalArgumentException("You cannot order by @Parent field. Perhaps you wish to order by __key__ instead?");

			if (condition.equals(meta.getIdFieldName())) {
				throw new IllegalArgumentException("You cannot order by @Id field. Perhaps you wish to order by __key__ instead?");
			}
		}

		this.actual = actual.orderBy(descending ? OrderBy.desc(condition) : OrderBy.asc(condition));
	}
void addOrder ( String condition ) { condition = condition . trim ( ) ; boolean descending = false ; if ( condition . startsWith ( "-" ) ) { descending = true ; condition = condition . substring ( 1 ) . trim ( ) ; } // Prevent ordering by @Id or @Parent fields, which are really part of the key
 if ( this . classRestriction != null ) { final KeyMetadata < ? > meta = loader . ofy . factory ( ) . keys ( ) . getMetadataSafe ( this . classRestriction ) ; if ( condition . equals ( meta . getParentFieldName ( ) ) ) throw new IllegalArgumentException ( "You cannot order by @Parent field. Perhaps you wish to order by __key__ instead?" ) ; if ( condition . equals ( meta . getIdFieldName ( ) ) ) { throw new IllegalArgumentException ( "You cannot order by @Id field. Perhaps you wish to order by __key__ instead?" ) ; } } this . actual = actual . orderBy ( descending ? OrderBy . desc ( condition ) : OrderBy . asc ( condition ) ) ; }
Modifies the instance
Modifies the instance