db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an...@apache.org
Subject svn commit: r1679369 - /db/jdo/trunk/api/src/java/javax/jdo/query/
Date Thu, 14 May 2015 13:46:24 GMT
Author: andyj
Date: Thu May 14 13:46:24 2015
New Revision: 1679369

URL: http://svn.apache.org/r1679369
Log:
JDO-652 Initial snapshot of the expression classes needed to generate a "typed" JDOQL query.

Added:
    db/jdo/trunk/api/src/java/javax/jdo/query/
    db/jdo/trunk/api/src/java/javax/jdo/query/BooleanExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/ByteExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/CharacterExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/CollectionExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/ComparableExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/DateExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/DateTimeExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/EnumExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/Expression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/ListExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/MapExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/NumericExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/ObjectExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/OrderExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/PersistableExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/StringExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/SubqueryExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/TimeExpression.java
    db/jdo/trunk/api/src/java/javax/jdo/query/package.html

Added: db/jdo/trunk/api/src/java/javax/jdo/query/BooleanExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/BooleanExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/BooleanExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/BooleanExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+/**
+ * Representation of a boolean expression.
+ */
+public interface BooleanExpression extends ComparableExpression<Boolean>
+{
+    /**
+     * Method to return the AND of this expression and the other expression.
+     * @param expr The other expression
+     * @return The resultant (boolean) expression
+     */
+    BooleanExpression and(BooleanExpression expr);
+
+    /**
+     * Method to return the OR of this expression and the other expression.
+     * @param expr The other expression
+     * @return The resultant (boolean) expression
+     */
+    BooleanExpression or(BooleanExpression expr);
+
+    /**
+     * Method to negate this expression.
+     * @return The negated expression
+     */
+    BooleanExpression not();
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/ByteExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/ByteExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/ByteExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/ByteExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+/**
+ * Representation of a byte expression.
+ */
+public interface ByteExpression extends ComparableExpression<Byte>
+{
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/CharacterExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/CharacterExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/CharacterExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/CharacterExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+/**
+ * Representation of a character expression.
+ */
+public interface CharacterExpression extends ComparableExpression<Character>
+{
+    /**
+     * Method to return a CharacterExpression representing this CharacterExpression in lower case.
+     * @return The lower case expression
+     */
+    CharacterExpression toLowerCase();
+
+    /**
+     * Method to return a CharacterExpression representing this CharacterExpression in upper case.
+     * @return The upper case expression
+     */
+    CharacterExpression toUpperCase();
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/CollectionExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/CollectionExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/CollectionExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/CollectionExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+import java.util.Collection;
+
+/**
+ * Representation of a collection in a query.
+ * 
+ * @param <T> Java type being represented here
+ * @param <E> Element type of the collection being represented here
+ */
+public interface CollectionExpression<T extends Collection<E>, E> extends Expression<T>
+{
+    /**
+     * Method returning whether the specified element expression is contained in this collection.
+     * @param expr The element expression
+     * @return Whether it is contained here
+     */
+    BooleanExpression contains(Expression<E> expr);
+
+    /**
+     * Method returning whether the specified element is contained in this collection.
+     * @param elem The element
+     * @return Whether it is contained here
+     */
+    BooleanExpression contains(E elem);
+
+    /**
+     * Method returning whether the collection is empty.
+     * @return Whether it is empty
+     */
+    BooleanExpression isEmpty();
+
+    /**
+     * Method returning an expression for the size of the collection
+     * @return The size
+     */
+    NumericExpression<Integer> size();
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/ComparableExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/ComparableExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/ComparableExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/ComparableExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+/**
+ * Representation of an expression for a Java type that implements java.lang.Comparable.
+ * Nore that the methods taking Expression as an argument could have been defined to take
+ * ComparableExpression but that would then have prevented code like
+ * <pre>
+ * NumericExpression param = (NumericExpression)tq.parameter("criticalValue", Double.class);
+ * tq.filter(cand.value.lt(param));
+ * </pre>
+ * and we would have had to cast the parameter to NumericExpression
+ *
+ * @param <T> Java type being represented here
+ */
+public interface ComparableExpression<T> extends Expression<T>
+{
+    /**
+     * Method returning whether this expression is less than the other expression.
+     * @param expr Other expression
+     * @return Whether this is less than the other
+     */
+    BooleanExpression lt(ComparableExpression expr);
+
+    /**
+     * Method returning whether this expression is less than the literal.
+     * @param t literal
+     * @return Whether this is less than the other
+     */
+    BooleanExpression lt(T t);
+
+    /**
+     * Method returning whether this expression is less than or equal the other expression.
+     * @param expr Other expression
+     * @return Whether this is less than or equal the other
+     */
+    BooleanExpression lteq(ComparableExpression expr);
+
+    /**
+     * Method returning whether this expression is less than or equal the literal.
+     * @param t literal
+     * @return Whether this is less than or equal the other
+     */
+    BooleanExpression lteq(T t);
+
+    /**
+     * Method returning whether this expression is greater than the other expression.
+     * @param expr Other expression
+     * @return Whether this is greater than the other
+     */
+    BooleanExpression gt(ComparableExpression expr);
+
+    /**
+     * Method returning whether this expression is greater than the literal.
+     * @param t literal
+     * @return Whether this is greater than the other
+     */
+    BooleanExpression gt(T t);
+
+    /**
+     * Method returning whether this expression is greater than or equal the other expression.
+     * @param expr Other expression
+     * @return Whether this is greater than or equal to the other
+     */
+    BooleanExpression gteq(ComparableExpression expr);
+
+    /**
+     * Method returning whether this expression is greater than or equal the literal.
+     * @param t literal
+     * @return Whether this is greater than or equal to the other
+     */
+    BooleanExpression gteq(T t);
+
+    /**
+     * Method to return a numeric expression representing the aggregated minimum of this expression.
+     * @return Numeric expression for the minimum
+     */
+    NumericExpression min();
+
+    /**
+     * Method to return a numeric expression representing the aggregated maximum of this expression.
+     * @return Numeric expression for the maximum
+     */
+    NumericExpression max();
+
+    /**
+     * Method to return an order expression for this expression in ascending order.
+     * @return The order expression
+     */
+    OrderExpression asc();
+
+    /**
+     * Method to return an order expression for this expression in descending order.
+     * @return The order expression
+     */
+    OrderExpression desc();
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/DateExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/DateExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/DateExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/DateExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+/**
+ * Representation of a date in a query.
+ */
+public interface DateExpression extends ComparableExpression<java.sql.Date>
+{
+    /**
+     * Accessor for the year of this date.
+     * @return Expression for the year
+     */
+    NumericExpression<Integer> getYear();
+
+    /**
+     * Accessor for the month of this date.
+     * @return Expression for the month
+     */
+    NumericExpression<Integer> getMonth();
+
+    /**
+     * Accessor for the day (of the month) of this date.
+     * @return Expression for the day of the month
+     */
+    NumericExpression<Integer> getDay();
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/DateTimeExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/DateTimeExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/DateTimeExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/DateTimeExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+/**
+ * Representation of a date-time type in a query.
+ */
+public interface DateTimeExpression extends ComparableExpression<java.util.Date>
+{
+    /**
+     * Accessor for the year of this date-time.
+     * @return Expression for the year
+     */
+    NumericExpression<Integer> getYear();
+
+    /**
+     * Accessor for the month of this date-time.
+     * @return Expression for the month
+     */
+    NumericExpression<Integer> getMonth();
+
+    /**
+     * Accessor for the day (of the month) of this date-time.
+     * @return Expression for the day of the month
+     */
+    NumericExpression<Integer> getDay();
+
+    /**
+     * Accessor for the hour of this date-time.
+     * @return Expression for the hour
+     */
+    NumericExpression<Integer> getHour();
+
+    /**
+     * Accessor for the minute of this date-time.
+     * @return Expression for the minute
+     */
+    NumericExpression<Integer> getMinute();
+
+    /**
+     * Accessor for the second of this date-time.
+     * @return Expression for the second
+     */
+    NumericExpression<Integer> getSecond();
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/EnumExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/EnumExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/EnumExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/EnumExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+/**
+ * Representation of an Enum in a query.
+ * 
+ * @param <T> Enum type
+ */
+public interface EnumExpression<T> extends ComparableExpression<Enum>
+{
+    /**
+     * Method to return an expression for the ordinal of this enum.
+     * @return Expression for the ordinal of the passed enum
+     */
+    NumericExpression ordinal();
+}

Added: db/jdo/trunk/api/src/java/javax/jdo/query/Expression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/Expression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/Expression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/Expression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+/**
+ * Representation of an expression in a query.
+ * 
+ * @param <T> Java type being represented here
+ */
+public interface Expression<T>
+{
+    /**
+     * Method returning whether this expression equals the other expression.
+     * @param expr Other expression
+     * @return Whether they are equal
+     */
+    BooleanExpression eq(Expression expr);
+
+    /**
+     * Method returning whether this expression equals the literal.
+     * @param t Literal
+     * @return Whether they are equal
+     */
+    BooleanExpression eq(T t);
+
+    /**
+     * Method returning whether this expression doesn't equal the other expression.
+     * @param expr Other expression
+     * @return Whether they are not equal
+     */
+    BooleanExpression ne(Expression expr);
+
+    /**
+     * Method returning whether this expression doesn't equal the literal.
+     * @param t literal
+     * @return Whether they are not equal
+     */
+    BooleanExpression ne(T t);
+
+    /**
+     * Method to return a numeric expression representing the aggregated count of this expression.
+     * @return Numeric expression for the count
+     */
+    NumericExpression<Long> count();
+
+    /**
+     * Method to return a numeric expression representing the aggregated (distinct) count of this expression.
+     * @return Numeric expression for the distinct count
+     */
+    NumericExpression<Long> countDistinct();
+
+    /**
+     * Return an expression for whether this expression is an instanceof the supplied class.
+     * @param cls Class to check against
+     * @return Whether it is an instanceof
+     */
+    BooleanExpression instanceOf(Class cls);
+
+    /**
+     * Return an expression where this expression is cast to the specified type.
+     * @param cls Class to cast to
+     * @return The cast expression
+     */
+    Expression cast(Class cls);
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/ListExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/ListExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/ListExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/ListExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+import java.util.List;
+
+/**
+ * Representation of a List in a query.
+ * 
+ * @param <T> Java type being represented here
+ * @param <E> Element type of the List being represented here
+ */
+public interface ListExpression<T extends List<E>, E> extends CollectionExpression<T, E>
+{
+    /**
+     * Method returning the element at this position in the List.
+     * @param posExpr The position expression
+     * @return The element at this position in the List
+     */
+    Expression<E> get(NumericExpression<Integer> posExpr);
+
+    /**
+     * Method returning the element at this position in the List.
+     * @param pos The position
+     * @return The element at this position in the List
+     */
+    Expression<E> get(int pos);
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/MapExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/MapExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/MapExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/MapExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+import java.util.Map;
+
+/**
+ * Representation of a map in a query.
+ * 
+ * @param <T> Java type being represented here
+ * @param <K> Key type of the map being represented here
+ * @param <V> Value type of the map being represented here
+ */
+public interface MapExpression<T extends Map<K, V>, K, V> extends Expression<T>
+{
+    /**
+     * Method returning whether the specified key expression is contained in this map.
+     * @param expr The key expression
+     * @return Whether it is contained here
+     */
+    BooleanExpression containsKey(Expression<K> expr);
+
+    /**
+     * Method returning whether the specified key is contained in this map.
+     * @param key The key
+     * @return Whether it is contained here
+     */
+    BooleanExpression containsKey(K key);
+
+    /**
+     * Method returning whether the specified value expression is contained in this map.
+     * @param expr The value expression
+     * @return Whether it is contained here
+     */
+    BooleanExpression containsValue(Expression<V> expr);
+
+    /**
+     * Method returning whether the specified value is contained in this map.
+     * @param value The value
+     * @return Whether it is contained here
+     */
+    BooleanExpression containsValue(V value);
+
+    /**
+     * Method returning whether the specified entry expression is contained in this map.
+     * @param expr The entry expression
+     * @return Whether it is contained here
+     */
+    BooleanExpression containsEntry(Expression<Map.Entry<K, V>> expr);
+
+    /**
+     * Method returning whether the specified entry is contained in this map.
+     * @param entry The entry expression
+     * @return Whether it is contained here
+     */
+    BooleanExpression containsEntry(Map.Entry<K, V> entry);
+
+    /**
+     * Method returning whether the map is empty.
+     * @return Whether it is empty
+     */
+    BooleanExpression isEmpty();
+
+    /**
+     * Method returning an expression for the size of the map
+     * @return The size
+     */
+    NumericExpression<Integer> size();
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/NumericExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/NumericExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/NumericExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/NumericExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+/**
+ * Representation of a numeric expression.
+ * 
+ * @param <T> Number type
+ */
+public interface NumericExpression<T> extends ComparableExpression<Number>
+{
+    /**
+     * Method to return an expression for this expression added to the passed expression.
+     * @param expr The other expression
+     * @return The summation
+     */
+    NumericExpression add(Expression expr);
+
+    /**
+     * Method to return an expression for this expression added to the passed number.
+     * @param num Number to add
+     * @return The summation
+     */
+    NumericExpression add(Number num);
+
+    /**
+     * Method to return an expression for this expression subtracting the passed expression.
+     * @param expr The other expression
+     * @return The difference
+     */
+    NumericExpression sub(Expression expr);
+
+    /**
+     * Method to return an expression for this expression subtracting the passed number.
+     * @param num Number to subtract
+     * @return The difference
+     */
+    NumericExpression sub(Number num);
+
+    /**
+     * Method to return an expression for this expression multiplied by the passed expression.
+     * @param expr The other expression
+     * @return The multiplication
+     */
+    NumericExpression mul(Expression expr);
+
+    /**
+     * Method to return an expression for this expression multiplied by the passed number.
+     * @param num Number
+     * @return The multiplication
+     */
+    NumericExpression mul(Number num);
+
+    /**
+     * Method to return an expression for this expression divided by the passed expression.
+     * @param expr The other expression
+     * @return The division
+     */
+    NumericExpression div(Expression expr);
+
+    /**
+     * Method to return an expression for this expression divided by the passed number.
+     * @param num Number to divide by
+     * @return The division
+     */
+    NumericExpression div(Number num);
+
+    /**
+     * Method to return an expression for this expression modulus the passed expression (<pre>a % b</pre>).
+     * @param expr The other expression
+     * @return The modulus
+     */
+    NumericExpression mod(Expression expr);
+
+    /**
+     * Method to return an expression for this expression modulus the passed number.
+     * @param num Number
+     * @return The modulus
+     */
+    NumericExpression mod(Number num);
+
+    /**
+     * Method to return a numeric expression representing the aggregated average of this expression.
+     * @return Numeric expression for the average
+     */
+    NumericExpression avg();
+
+    /**
+     * Method to return a numeric expression representing the aggregated sum of this expression.
+     * @return Numeric expression for the sum
+     */
+    NumericExpression sum();
+
+    /**
+     * Method to return the absolute value expression of this expression.
+     * @return The absolute value expression
+     */
+    NumericExpression abs();
+
+    /**
+     * Method to return the square-root value expression of this expression.
+     * @return The square-root value expression
+     */
+    NumericExpression sqrt();
+
+    /**
+     * Method to return the arc cosine value expression of this expression.
+     * @return The arc cosine value expression
+     */
+    NumericExpression acos();
+
+    /**
+     * Method to return the arc sine value expression of this expression.
+     * @return The arc sine value expression
+     */
+    NumericExpression asin();
+
+    /**
+     * Method to return the arc tangent value expression of this expression.
+     * @return The arc tangent value expression
+     */
+    NumericExpression atan();
+
+    /**
+     * Method to return the sine value expression of this expression.
+     * @return The sine value expression
+     */
+    NumericExpression sin();
+
+    /**
+     * Method to return the cosine value expression of this expression.
+     * @return The cosine value expression
+     */
+    NumericExpression cos();
+
+    /**
+     * Method to return the tangent value expression of this expression.
+     * @return The tangent value expression
+     */
+    NumericExpression tan();
+
+    /**
+     * Method to return the exponential value expression of this expression.
+     * @return The exponential value expression
+     */
+    NumericExpression exp();
+
+    /**
+     * Method to return the logarithm value expression of this expression.
+     * @return The logarithm value expression
+     */
+    NumericExpression log();
+
+    /**
+     * Method to return the ceiling value expression of this expression.
+     * @return The ceiling value expression
+     */
+    NumericExpression ceil();
+
+    /**
+     * Method to return the floor value expression of this expression.
+     * @return The floor value expression
+     */
+    NumericExpression floor();
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/ObjectExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/ObjectExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/ObjectExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/ObjectExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+/**
+ * Representation of an Object as an expression.
+ * This handles all remaining Java types not handled by String, Numeric, Enum, Boolean, Collection, Map, etc.
+ * 
+ * @param <T> Java type
+ */
+public interface ObjectExpression<T> extends Expression<T>
+{
+
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/OrderExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/OrderExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/OrderExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/OrderExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+/**
+ * Expression representing the ordering using an expression and a direction.
+ * 
+ * @param <T> Java type of the expression being represented here
+ */
+public interface OrderExpression<T>
+{
+    public enum OrderDirection
+    {
+        ASC,
+        DESC
+    }
+
+    /**
+     * Accessor for the direction of the ordering with this expression.
+     * @return The direction
+     */
+    OrderDirection getDirection();
+
+    /**
+     * Accessor for the expression being used for ordering.
+     * @return Ordering expression
+     */
+    Expression<T> getExpression();
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/PersistableExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/PersistableExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/PersistableExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/PersistableExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+/**
+ * Expression representing a persistable object in a query (e.g alias.persistableField).
+ *
+ * @param <T> (Persistable) Java type being represented here
+ */
+public interface PersistableExpression<T> extends Expression<T>
+{
+    /**
+     * Method to return an expression for the (JDO) identity of this persistable object.
+     * @return The identity expression
+     */
+    Expression jdoObjectId();
+
+    /**
+     * Method to return an expression for the (JDO) version of this persistable object.
+     * @return The version expression
+     */
+    Expression jdoVersion();
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/StringExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/StringExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/StringExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/StringExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+/**
+ * Representation of a string in a query.
+ */
+public interface StringExpression extends ComparableExpression<String>
+{
+    /**
+     * Method to return an expression for this expression added to the passed expression (String concatenation).
+     * @param expr The other expression
+     * @return The summation
+     */
+    StringExpression add(Expression expr);
+
+    /**
+     * Method to return an expression for the character at a position of this string expression.
+     * @param pos The position
+     * @return Expression for the character
+     */
+    CharacterExpression charAt(int pos);
+
+    /**
+     * Method to return an expression for the character at a position of this string expression.
+     * @param pos The position
+     * @return Expression for the character
+     */
+    CharacterExpression charAt(NumericExpression<Integer> pos);
+
+    /**
+     * Method returning an expression for whether this string expression ends with the passed string expression.
+     * @param expr The expression that it ends with.
+     * @return Whether it ends with the other string
+     */
+    BooleanExpression endsWith(StringExpression expr);
+
+    /**
+     * Method returning an expression for whether this string expression ends with the passed string expression.
+     * @param str The string that it ends with.
+     * @return Whether it ends with the other string
+     */
+    BooleanExpression endsWith(String str);
+
+    /**
+     * Method returning an expression for whether this string expression is equal to (ignoring case) the 
+     * passed string expression.
+     * @param expr The expression
+     * @return Whether they are equal
+     */
+    BooleanExpression equalsIgnoreCase(StringExpression expr);
+
+    /**
+     * Method returning an expression for whether this string expression is equal to (ignoring case) the 
+     * passed string.
+     * @param str The string
+     * @return Whether they are equal
+     */
+    BooleanExpression equalsIgnoreCase(String str);
+
+    /**
+     * Method to return an expression for the position of the passed string in this string.
+     * @param expr The other string
+     * @return Expression for the position of the passed string
+     */
+    NumericExpression<Integer> indexOf(StringExpression expr);
+
+    /**
+     * Method to return an expression for the position of the passed string in this string.
+     * @param str The other string
+     * @return Expression for the position of the passed string
+     */
+    NumericExpression<Integer> indexOf(String str);
+
+    /**
+     * Method to return an expression for the position of the passed string in this string after a position.
+     * @param expr The other string
+     * @param pos Start point of the search
+     * @return Expression for the position of the passed string
+     */
+    NumericExpression<Integer> indexOf(StringExpression expr, NumericExpression<Integer> pos);
+
+    /**
+     * Method to return an expression for the position of the passed string in this string after a position.
+     * @param str The other string
+     * @param pos Start point of the search
+     * @return Expression for the position of the passed string
+     */
+    NumericExpression<Integer> indexOf(String str, NumericExpression<Integer> pos);
+
+    /**
+     * Method to return an expression for the position of the passed string in this string after a position.
+     * @param str The other string
+     * @param pos Start point of the search
+     * @return Expression for the position of the passed string
+     */
+    NumericExpression<Integer> indexOf(String str, int pos);
+
+    /**
+     * Method to return an expression for the position of the passed string in this string after a position.
+     * @param expr The other string
+     * @param pos Start point of the search
+     * @return Expression for the position of the passed string
+     */
+    NumericExpression<Integer> indexOf(StringExpression expr, int pos);
+
+    /**
+     * Method returning a expression for the length of this string.
+     * @return Expression for the length
+     */
+    NumericExpression<Integer> length();
+
+    /**
+     * Method returning an expression for whether this string expression starts with the passed string expression.
+     * @param expr The expression that it starts with.
+     * @return Whether it starts with the other string
+     */
+    BooleanExpression startsWith(StringExpression expr);
+
+    /**
+     * Method returning an expression for whether this string expression starts with the passed string.
+     * @param str The string that it starts with.
+     * @return Whether it starts with the other string
+     */
+    BooleanExpression startsWith(String str);
+
+    /**
+     * Method to return an expression for the substring of this string expression.
+     * @param pos The position of the start point of the substring
+     * @return Expression for the substring
+     */
+    StringExpression substring(NumericExpression<Integer> pos);
+
+    /**
+     * Method to return an expression for the substring of this string expression.
+     * @param pos The position of the start point of the substring
+     * @return Expression for the substring
+     */
+    StringExpression substring(int pos);
+
+    /**
+     * Method to return an expression for the substring of this string expression.
+     * @param startPos The position of the start point of the substring (inclusive, origin 0)
+     * @param endPos The position of the end point of the substring (exclusive, origin 0)
+     * @return Expression for the substring
+     */
+    StringExpression substring(NumericExpression<Integer> startPos, NumericExpression<Integer> endPos);
+
+    /**
+     * Method to return an expression for the substring of this string expression.
+     * @param startPos The position of the start point of the substring (inclusive, origin 0)
+     * @param endPos The position of the end point of the substring (exclusive, origin 0)
+     * @return Expression for the substring
+     */
+    StringExpression substring(int startPos, int endPos);
+
+    /**
+     * Method to return a StringExpression representing this string expression in lower case.
+     * @return The lower case expression
+     */
+    StringExpression toLowerCase();
+
+    /**
+     * Method to return a StringExpression representing this string expression in upper case.
+     * @return The upper case expression
+     */
+    StringExpression toUpperCase();
+
+    /**
+     * Method returning a string expression with whitespace trimmed from start and end.
+     * @return String expression with whitespace trimmed
+     */
+    StringExpression trim();
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/SubqueryExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/SubqueryExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/SubqueryExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/SubqueryExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+/**
+ * Representation of a subquery in a query.
+ */
+public interface SubqueryExpression
+{
+
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/TimeExpression.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/TimeExpression.java?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/TimeExpression.java (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/TimeExpression.java Thu May 14 13:46:24 2015
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package javax.jdo.query;
+
+/**
+ * Representation of a time in a query.
+ */
+public interface TimeExpression extends ComparableExpression<java.sql.Time>
+{
+    /**
+     * Accessor for the hour of this time.
+     * @return Expression for the hour
+     */
+    NumericExpression<Integer> getHour();
+
+    /**
+     * Accessor for the minute of this time.
+     * @return Expression for the minute
+     */
+    NumericExpression<Integer> getMinute();
+
+    /**
+     * Accessor for the second of this time.
+     * @return Expression for the second
+     */
+    NumericExpression<Integer> getSecond();
+}
\ No newline at end of file

Added: db/jdo/trunk/api/src/java/javax/jdo/query/package.html
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/query/package.html?rev=1679369&view=auto
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/query/package.html (added)
+++ db/jdo/trunk/api/src/java/javax/jdo/query/package.html Thu May 14 13:46:24 2015
@@ -0,0 +1,20 @@
+<BODY>
+    Package providing expressions for building a typed JDOQL query.
+    Fields/Params/Vars of a persistable type are represented as <i>Expression</i>. 
+    All generated "Q" classes extend "PersistableExpression", and provide the fields/properties 
+    of the persistable class as Expression types.
+    Fields/Params/Vars of a container type are represented as <i>CollectionExpression</i>, <i>MapExpression</i>.
+    Fields/Params/Vars of other types, or literals are represented by
+    <ul>
+        <li>StringExpression</li>
+        <li>EnumExpression</li>
+        <li>NumericExpression</li>
+        <li>BooleanExpression</li>
+        <li>ByteExpression</li>
+        <li>CharacterExpression</li>
+        <li>DateExpression</li>
+        <li>DateTimeExpression</li>
+        <li>TimeExpression</li>
+        <li>ObjectExpression</li>
+    </ul>
+</BODY>
\ No newline at end of file



Mime
View raw message