You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2015/10/19 15:12:37 UTC
[4/4] olingo-odata4 git commit: [OLINGO786] FIx edm annotation classes
[OLINGO786] FIx edm annotation classes
This also includes tests for all edm classes.
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/41210245
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/41210245
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/41210245
Branch: refs/heads/olingo786
Commit: 41210245d78beb596dde1b1440da357aa83367b4
Parents: 67ccbf9
Author: Christian Amend <ch...@sap.com>
Authored: Mon Oct 19 15:11:15 2015 +0200
Committer: Christian Amend <ch...@sap.com>
Committed: Mon Oct 19 15:11:15 2015 +0200
----------------------------------------------------------------------
.../xml/AbstractClientCsdlEdmDeserializer.java | 4 +-
.../olingo/commons/api/edm/EdmAnnotation.java | 4 +-
.../commons/api/edm/annotation/EdmAnd.java | 2 +-
.../edm/annotation/EdmAnnotationExpression.java | 50 ---
.../api/edm/annotation/EdmAnnotationPath.java | 2 +-
.../commons/api/edm/annotation/EdmApply.java | 4 +-
.../commons/api/edm/annotation/EdmCast.java | 4 +-
.../api/edm/annotation/EdmCollection.java | 4 +-
.../EdmConstantAnnotationExpression.java | 39 ---
.../edm/annotation/EdmConstantExpression.java | 40 +++
.../EdmDynamicAnnotationExpression.java | 313 -------------------
.../edm/annotation/EdmDynamicExpression.java | 313 +++++++++++++++++++
.../commons/api/edm/annotation/EdmEq.java | 2 +-
.../api/edm/annotation/EdmExpression.java | 56 ++++
.../commons/api/edm/annotation/EdmGe.java | 2 +-
.../commons/api/edm/annotation/EdmGt.java | 2 +-
.../commons/api/edm/annotation/EdmIf.java | 8 +-
.../commons/api/edm/annotation/EdmIsOf.java | 4 +-
.../api/edm/annotation/EdmLabeledElement.java | 4 +-
.../annotation/EdmLabeledElementReference.java | 2 +-
.../commons/api/edm/annotation/EdmLe.java | 2 +-
.../EdmLogicalOrComparisonExpression.java | 37 +++
.../commons/api/edm/annotation/EdmLt.java | 2 +-
.../annotation/EdmNavigationPropertyPath.java | 2 +-
.../commons/api/edm/annotation/EdmNe.java | 2 +-
.../commons/api/edm/annotation/EdmNot.java | 9 +-
.../commons/api/edm/annotation/EdmNull.java | 2 +-
.../commons/api/edm/annotation/EdmOr.java | 2 +-
.../commons/api/edm/annotation/EdmPath.java | 2 +-
.../api/edm/annotation/EdmPropertyPath.java | 2 +-
.../api/edm/annotation/EdmPropertyValue.java | 4 +-
.../commons/api/edm/annotation/EdmRecord.java | 2 +-
...mTwoParamsOpDynamicAnnotationExpression.java | 37 ---
.../commons/api/edm/annotation/EdmUrlRef.java | 4 +-
.../api/edm/provider/annotation/CsdlCast.java | 6 +-
.../annotation/CsdlConstantExpression.java | 16 +-
.../commons/core/edm/EdmAnnotationImpl.java | 182 +----------
...mAnnotatableDynamicAnnotationExpression.java | 53 ----
...AbstractEdmAnnotatableDynamicExpression.java | 56 ++++
.../AbstractEdmAnnotationExpression.java | 46 ---
.../AbstractEdmDynamicAnnotationExpression.java | 291 -----------------
.../AbstractEdmDynamicExpression.java | 295 +++++++++++++++++
.../AbstractEdmElementOrAttributeNotation.java | 35 ---
.../edm/annotation/AbstractEdmExpression.java | 154 +++++++++
...bstractEdmLogicalOrComparisonExpression.java | 70 +++++
...mTwoParamsOpDynamicAnnotationExpression.java | 48 ---
.../commons/core/edm/annotation/EdmAndImpl.java | 15 +-
.../edm/annotation/EdmAnnotationPathImpl.java | 19 +-
.../core/edm/annotation/EdmApplyImpl.java | 43 ++-
.../core/edm/annotation/EdmCastImpl.java | 29 +-
.../core/edm/annotation/EdmCollectionImpl.java | 33 +-
.../EdmConstantAnnotationExpressionImpl.java | 153 ---------
.../annotation/EdmConstantExpressionImpl.java | 148 +++++++++
.../commons/core/edm/annotation/EdmEqImpl.java | 10 +-
.../commons/core/edm/annotation/EdmGeImpl.java | 14 +-
.../commons/core/edm/annotation/EdmGtImpl.java | 10 +-
.../commons/core/edm/annotation/EdmIfImpl.java | 51 +--
.../core/edm/annotation/EdmIsOfImpl.java | 25 +-
.../edm/annotation/EdmLabeledElementImpl.java | 35 ++-
.../EdmLabeledElementReferenceImpl.java | 20 +-
.../commons/core/edm/annotation/EdmLeImpl.java | 11 +-
.../commons/core/edm/annotation/EdmLtImpl.java | 10 +-
.../EdmNavigationPropertyPathImpl.java | 20 +-
.../commons/core/edm/annotation/EdmNeImpl.java | 10 +-
.../commons/core/edm/annotation/EdmNotImpl.java | 18 +-
.../core/edm/annotation/EdmNullImpl.java | 9 +-
.../commons/core/edm/annotation/EdmOrImpl.java | 10 +-
.../core/edm/annotation/EdmPathImpl.java | 19 +-
.../edm/annotation/EdmPropertyPathImpl.java | 15 +-
.../edm/annotation/EdmPropertyValueImpl.java | 35 ++-
.../core/edm/annotation/EdmRecordImpl.java | 41 ++-
.../core/edm/annotation/EdmUrlRefImpl.java | 28 +-
.../edm/annotations/AbstractAnnotationTest.java | 127 ++++++++
.../edm/annotations/EdmAnnotationPathTest.java | 56 ++++
.../core/edm/annotations/EdmApplyImplTest.java | 115 +++++++
.../core/edm/annotations/EdmCastImplTest.java | 107 +++++++
.../edm/annotations/EdmCollectionImplTest.java | 82 +++++
.../EdmConstantExpressionImplTest.java | 167 ++++++++++
.../core/edm/annotations/EdmIfImplTest.java | 104 ++++++
.../core/edm/annotations/EdmIsOfImplTest.java | 107 +++++++
.../annotations/EdmLabeledElementImplTest.java | 93 ++++++
.../EdmLabledElementReferenceImplTest.java | 54 ++++
.../EdmLogicalOrComparisonImplTest.java | 97 ++++++
.../EdmNavigationPropertyPathImpTest.java | 56 ++++
.../core/edm/annotations/EdmPathImplTest.java | 55 ++++
.../annotations/EdmPropertyPathImplTest.java | 56 ++++
.../annotations/EdmPropertyValueImplTest.java | 92 ++++++
.../core/edm/annotations/EdmRecordImplTest.java | 158 ++++++++++
.../core/edm/annotations/EdmUrlRefImplTest.java | 89 ++++++
.../edm/provider/EdmAnnotationImplTest.java | 82 +++++
.../xml/MetadataDocumentXmlSerializer.java | 15 +-
91 files changed, 3273 insertions(+), 1490 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java
index a6943d1..9ab0dcd 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java
@@ -35,8 +35,8 @@ public abstract class AbstractClientCsdlEdmDeserializer<T> extends JsonDeseriali
protected CsdlConstantExpression parseAnnotationConstExprConstruct(final JsonParser jp)
throws IOException {
- final CsdlConstantExpression constExpr = new CsdlConstantExpression();
- constExpr.setType(CsdlConstantExpression.ConstantExpressionType.fromString(jp.getCurrentName()));
+ final CsdlConstantExpression constExpr =
+ new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.fromString(jp.getCurrentName()));
constExpr.setValue(jp.nextTextValue());
return constExpr;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotation.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotation.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotation.java
index c9556ec..7ebeeee 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotation.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotation.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.commons.api.edm;
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
/**
* This class models an OData Annotation which can be applied to a target.
@@ -35,5 +35,5 @@ public interface EdmAnnotation extends EdmAnnotatable {
*/
String getQualifier();
- EdmAnnotationExpression getExpression();
+ EdmExpression getExpression();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnd.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnd.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnd.java
index e043556..cfdfb49 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnd.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnd.java
@@ -21,6 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
/**
* Represents a logical and annotation
*/
-public interface EdmAnd extends EdmTwoParamsOpDynamicAnnotationExpression {
+public interface EdmAnd extends EdmLogicalOrComparisonExpression {
// No additional methods needed for now.
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationExpression.java
deleted file mode 100644
index 9da491d..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationExpression.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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 org.apache.olingo.commons.api.edm.annotation;
-
-/**
- * Super type of all annotation expressions
- * A expression is either constant or dynamic
- */
-public interface EdmAnnotationExpression {
-
- /**
- * Return true if the expression is constant
- * @return true if the expression is constant
- */
- boolean isConstant();
-
- /**
- * Casts the expression to {@link EdmConstantAnnotationExpression}
- * @return Constant Expression
- */
- EdmConstantAnnotationExpression asConstant();
-
- /**
- * Return true if the expression is dynamic
- * @return true if the expression is dynamic
- */
- boolean isDynamic();
-
- /**
- * Cast the expression to {@link EdmDynamicAnnotationExpression}
- * @return Dynamic Expression
- */
- EdmDynamicAnnotationExpression asDynamic();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationPath.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationPath.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationPath.java
index 440b760..a75b780 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationPath.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationPath.java
@@ -21,7 +21,7 @@ package org.apache.olingo.commons.api.edm.annotation;
/**
* Represents an annotation path
*/
-public interface EdmAnnotationPath extends EdmDynamicAnnotationExpression {
+public interface EdmAnnotationPath extends EdmDynamicExpression {
/**
* Value of the path
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmApply.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmApply.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmApply.java
index 4aa407d..d304fc3 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmApply.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmApply.java
@@ -25,7 +25,7 @@ import org.apache.olingo.commons.api.edm.EdmAnnotatable;
/**
* Represents an Edm:Apply expression
*/
-public interface EdmApply extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+public interface EdmApply extends EdmDynamicExpression, EdmAnnotatable {
/**
* A QualifiedName specifying the name of the client-side function to apply.
@@ -45,5 +45,5 @@ public interface EdmApply extends EdmDynamicAnnotationExpression, EdmAnnotatable
* Returns the expressions applied to the parameters of the function
* @return List of expression
*/
- List<EdmAnnotationExpression> getParameters();
+ List<EdmExpression> getParameters();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCast.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCast.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCast.java
index ca60746..7a1f109 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCast.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCast.java
@@ -26,7 +26,7 @@ import org.apache.olingo.commons.api.edm.geo.SRID;
* Represents an edm:Cast expression.
* Casts the value obtained from its single child expression to the specified type
*/
-public interface EdmCast extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+public interface EdmCast extends EdmDynamicExpression, EdmAnnotatable {
/**
* Returns the facet attribute MaxLength
* @return Returns the facet attribute MaxLength
@@ -61,5 +61,5 @@ public interface EdmCast extends EdmDynamicAnnotationExpression, EdmAnnotatable
* Cast value of the expression
* @return Cast value
*/
- EdmDynamicAnnotationExpression getValue();
+ EdmExpression getValue();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCollection.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCollection.java
index 884d26b..c464562 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCollection.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCollection.java
@@ -25,11 +25,11 @@ import java.util.List;
* The value calculated by the collection expression is the collection of the values calculated
* by each of the child expressions.
*/
-public interface EdmCollection extends EdmDynamicAnnotationExpression {
+public interface EdmCollection extends EdmDynamicExpression {
/**
* Returns a list of child expression
* @return List of child expression
*/
- List<EdmAnnotationExpression> getItems();
+ List<EdmExpression> getItems();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantAnnotationExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantAnnotationExpression.java
deleted file mode 100644
index 7609e35..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantAnnotationExpression.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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 org.apache.olingo.commons.api.edm.annotation;
-
-import org.apache.olingo.commons.api.data.Valuable;
-
-/**
- * Represents a constant expression
- */
-public interface EdmConstantAnnotationExpression extends EdmAnnotationExpression {
-
- /**
- * Value of the constant expression
- * @return value of the constant expression
- */
- Valuable getValue();
-
- /**
- * Returns the value of the expression as String
- * @return String representation of the expression
- */
- String getValueAsString();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantExpression.java
new file mode 100644
index 0000000..fd2031f
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantExpression.java
@@ -0,0 +1,40 @@
+/*
+ * 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 org.apache.olingo.commons.api.edm.annotation;
+
+import org.apache.olingo.commons.api.data.Valuable;
+
+/**
+ * Represents a constant expression
+ */
+public interface EdmConstantExpression extends EdmExpression {
+
+ /**
+ * Value of the constant expression
+ * @return value of the constant expression
+ */
+ //TODO: Delete data package dependency
+ Valuable getValue();
+
+ /**
+ * Returns the value of the expression as String
+ * @return String representation of the expression
+ */
+ String getValueAsString();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmDynamicAnnotationExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmDynamicAnnotationExpression.java
deleted file mode 100644
index 9905a80..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmDynamicAnnotationExpression.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * 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 org.apache.olingo.commons.api.edm.annotation;
-
-/**
- * Represents a dynamic expression
- */
-public interface EdmDynamicAnnotationExpression extends EdmAnnotationExpression {
-
- /**
- * Returns true if the expression is a logical edm:Not expression
- * @return true if the expression is a logical edm:Not expression
- */
- boolean isNot();
-
- /**
- * Casts the expression to a {@link EdmNot} expression
- * @return EdmNot expression
- */
- EdmNot asNot();
-
- /**
- * Returns true if the expression is a logical edm:And expression
- * @return true if the expression is a logical edm:And expression
- */
- boolean isAnd();
-
- /**
- * Casts the expression to a {@link EdmAnd} expression
- * @return EdmAnd expression
- */
- EdmAnd asAnd();
-
- /**
- * Returns true if the expression is a logical edm:Or expression
- * @return true if the expression is a logical edm:Or expression
- */
- boolean isOr();
-
- /**
- * Casts the expression to a {@link EdmOr} expression
- * @return EdmOr expression
- */
- EdmOr asOr();
-
- /**
- * Returns true if the expression is a edm:Eq expression
- * @return true if the expression is a edm:Eq expression
- */
- boolean isEq();
-
- /**
- * Casts the expression to a {@link EdmEq} expression
- * @return EdmEq expression
- */
- EdmEq asEq();
-
- /**
- * Returns true if the expression is a edm:Ne expression
- * @return true if the expression is a edm:Ne expression
- */
- boolean isNe();
-
- /**
- * Casts the expression to a {@link EdmNe} expression
- * @return EdmNe expression
- */
- EdmNe asNe();
-
- /**
- * Returns true if the expression is a edm:Gt expression
- * @return true if the expression is a edm:Gt expression
- */
- boolean isGt();
-
- /**
- * Casts the expression to a {@link EdmGt} expression
- * @return EdmGt expression
- */
- EdmGt asGt();
-
- /**
- * Returns true if the expression is a edm:Ge expression
- * @return true if the expression is a edm:Ge expression
- */
- boolean isGe();
-
- /**
- * Casts the expression to a {@link EdmGe} expression
- * @return EdmGe expression
- */
- EdmGe asGe();
-
- /**
- * Returns true if the expression is a edm:Lt expression
- * @return true if the expression is a edm:Lt expression
- */
- boolean isLt();
-
- /**
- * Casts the expression to a {@link EdmLt} expression
- * @return EdmLt expression
- */
- EdmLt asLt();
-
- /**
- * Returns true if the expression is a edm:Le expression
- * @return true if the expression is a edm:Le expression
- */
- boolean isLe();
-
- /**
- * Casts the expression to a {@link EdmLe} expression
- * @return EdmLe expression
- */
- EdmLe asLe();
-
- /**
- * Returns true if the expression is a edm:AnnotationPath expression
- * @return true if the expression is a edm:AnnotationPath expression
- */
- boolean isAnnotationPath();
-
- /**
- * Casts the expression to a {@link EdmAnnotationPath} expression
- * @return EdmAnnotationPath expression
- */
- EdmAnnotationPath asAnnotationPath();
-
- /**
- * Returns true if the expression is a edm:Apply expression
- * @return true if the expression is a edm:Apply expression
- */
- boolean isApply();
-
- /**
- * Casts the expression to a {@link EdmApply} expression
- * @return EdmApply expression
- */
- EdmApply asApply();
-
- /**
- * Returns true if the expression is a edm:Cast expression
- * @return true if the expression is a edm:Cast expression
- */
- boolean isCast();
-
- /**
- * Casts the expression to a {@link EdmCast} expression
- * @return EdmCast expression
- */
- EdmCast asCast();
-
- /**
- * Returns true if the expression is a edm:Collection expression
- * @return true if the expression is a edm:Collection expression
- */
- boolean isCollection();
-
- /**
- * Casts the expression to a {@link EdmCollection} expression
- * @return EdmCollection expression
- */
- EdmCollection asCollection();
-
- /**
- * Returns true if the expression is a edm:If expression
- * @return true if the expression is a edm:If expression
- */
- boolean isIf();
-
- /**
- * Casts the expression to a {@link EdmIf} expression
- * @return EdmIf expression
- */
- EdmIf asIf();
-
- /**
- * Returns true if the expression is a edm:IsOf expression
- * @return true if the expression is a edm:IsOf expression
- */
- boolean isIsOf();
-
- /**
- * Casts the expression to a {@link EdmIsOf} expression
- * @return EdmIsOf expression
- */
- EdmIsOf asIsOf();
-
- /**
- * Returns true if the expression is a edm:LabeledElement expression
- * @return true if the expression is a edm:LabeledElement expression
- */
- boolean isLabeledElement();
-
- /**
- * Casts the expression to a {@link EdmLabeledElement} expression
- * @return EdmLabeledElement expression
- */
- EdmLabeledElement asLabeledElement();
-
- /**
- * Returns true if the expression is a edm:LabeledElementReference expression
- * @return true if the expression is a edm:LabeledElementReference expression
- */
- boolean isLabeledElementReference();
-
- /**
- * Casts the expression to a {@link EdmLabeledElementReference} expression
- * @return EdmLabeledElementReference expression
- */
- EdmLabeledElementReference asLabeledElementReference();
-
- /**
- * Returns true if the expression is a edm:Null expression
- * @return true if the expression is a edm:Null expression
- */
- boolean isNull();
-
- /**
- * Casts the expression to a {@link EdmNull} expression
- * @return EdmNull expression
- */
- EdmNull asNull();
-
- /**
- * Returns true if the expression is a edm:NavigationPropertyPath expression
- * @return true if the expression is a edm:NavigationPropertyPath expression
- */
- boolean isNavigationPropertyPath();
-
- /**
- * Casts the expression to a {@link EdmNavigationPropertyPath} expression
- * @return EdmNavigationPropertyPath expression
- */
- EdmNavigationPropertyPath asNavigationPropertyPath();
-
- /**
- * Returns true if the expression is a edm:Path expression
- * @return true if the expression is a edm:Path expression
- */
- boolean isPath();
-
- /**
- * Casts the expression to a {@link EdmPath} expression
- * @return EdmPath expression
- */
- EdmPath asPath();
-
- /**
- * Returns true if the expression is a edm:PropertyPath expression
- * @return true if the expression is a edm:PropertyPath expression
- */
- boolean isPropertyPath();
-
- /**
- * Casts the expression to a {@link EdmPropertyPath} expression
- * @return EdmPropertyPath expression
- */
- EdmPropertyPath asPropertyPath();
-
- /**
- * Returns true if the expression is a edm:PropertyValue expression
- * @return true if the expression is a edm:PropertyValue expression
- */
- boolean isPropertyValue();
-
- /**
- * Casts the expression to a {@link EdmPropertyValue} expression
- * @return EdmPropertyValue expression
- */
- EdmPropertyValue asPropertyValue();
-
- /**
- * Returns true if the expression is a edm:Record expression
- * @return true if the expression is a edm:Record expression
- */
- boolean isRecord();
-
- /**
- * Casts the expression to a {@link EdmRecord} expression
- * @return EdmRecord expression
- */
- EdmRecord asRecord();
-
- /**
- * Returns true if the expression is a edm:UrlRef expression
- * @return true if the expression is a edm:UrlRef expression
- */
- boolean isUrlRef();
-
- /**
- * Casts the expression to a {@link EdmUrlRef} expression
- * @return EdmUrlRef expression
- */
- EdmUrlRef asUrlRef();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmDynamicExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmDynamicExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmDynamicExpression.java
new file mode 100644
index 0000000..8889029
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmDynamicExpression.java
@@ -0,0 +1,313 @@
+/*
+ * 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 org.apache.olingo.commons.api.edm.annotation;
+
+/**
+ * Represents a dynamic expression
+ */
+public interface EdmDynamicExpression extends EdmExpression {
+
+ /**
+ * Returns true if the expression is a logical edm:Not expression
+ * @return true if the expression is a logical edm:Not expression
+ */
+ boolean isNot();
+
+ /**
+ * Casts the expression to a {@link EdmNot} expression
+ * @return EdmNot expression
+ */
+ EdmNot asNot();
+
+ /**
+ * Returns true if the expression is a logical edm:And expression
+ * @return true if the expression is a logical edm:And expression
+ */
+ boolean isAnd();
+
+ /**
+ * Casts the expression to a {@link EdmAnd} expression
+ * @return EdmAnd expression
+ */
+ EdmAnd asAnd();
+
+ /**
+ * Returns true if the expression is a logical edm:Or expression
+ * @return true if the expression is a logical edm:Or expression
+ */
+ boolean isOr();
+
+ /**
+ * Casts the expression to a {@link EdmOr} expression
+ * @return EdmOr expression
+ */
+ EdmOr asOr();
+
+ /**
+ * Returns true if the expression is a edm:Eq expression
+ * @return true if the expression is a edm:Eq expression
+ */
+ boolean isEq();
+
+ /**
+ * Casts the expression to a {@link EdmEq} expression
+ * @return EdmEq expression
+ */
+ EdmEq asEq();
+
+ /**
+ * Returns true if the expression is a edm:Ne expression
+ * @return true if the expression is a edm:Ne expression
+ */
+ boolean isNe();
+
+ /**
+ * Casts the expression to a {@link EdmNe} expression
+ * @return EdmNe expression
+ */
+ EdmNe asNe();
+
+ /**
+ * Returns true if the expression is a edm:Gt expression
+ * @return true if the expression is a edm:Gt expression
+ */
+ boolean isGt();
+
+ /**
+ * Casts the expression to a {@link EdmGt} expression
+ * @return EdmGt expression
+ */
+ EdmGt asGt();
+
+ /**
+ * Returns true if the expression is a edm:Ge expression
+ * @return true if the expression is a edm:Ge expression
+ */
+ boolean isGe();
+
+ /**
+ * Casts the expression to a {@link EdmGe} expression
+ * @return EdmGe expression
+ */
+ EdmGe asGe();
+
+ /**
+ * Returns true if the expression is a edm:Lt expression
+ * @return true if the expression is a edm:Lt expression
+ */
+ boolean isLt();
+
+ /**
+ * Casts the expression to a {@link EdmLt} expression
+ * @return EdmLt expression
+ */
+ EdmLt asLt();
+
+ /**
+ * Returns true if the expression is a edm:Le expression
+ * @return true if the expression is a edm:Le expression
+ */
+ boolean isLe();
+
+ /**
+ * Casts the expression to a {@link EdmLe} expression
+ * @return EdmLe expression
+ */
+ EdmLe asLe();
+
+ /**
+ * Returns true if the expression is a edm:AnnotationPath expression
+ * @return true if the expression is a edm:AnnotationPath expression
+ */
+ boolean isAnnotationPath();
+
+ /**
+ * Casts the expression to a {@link EdmAnnotationPath} expression
+ * @return EdmAnnotationPath expression
+ */
+ EdmAnnotationPath asAnnotationPath();
+
+ /**
+ * Returns true if the expression is a edm:Apply expression
+ * @return true if the expression is a edm:Apply expression
+ */
+ boolean isApply();
+
+ /**
+ * Casts the expression to a {@link EdmApply} expression
+ * @return EdmApply expression
+ */
+ EdmApply asApply();
+
+ /**
+ * Returns true if the expression is a edm:Cast expression
+ * @return true if the expression is a edm:Cast expression
+ */
+ boolean isCast();
+
+ /**
+ * Casts the expression to a {@link EdmCast} expression
+ * @return EdmCast expression
+ */
+ EdmCast asCast();
+
+ /**
+ * Returns true if the expression is a edm:Collection expression
+ * @return true if the expression is a edm:Collection expression
+ */
+ boolean isCollection();
+
+ /**
+ * Casts the expression to a {@link EdmCollection} expression
+ * @return EdmCollection expression
+ */
+ EdmCollection asCollection();
+
+ /**
+ * Returns true if the expression is a edm:If expression
+ * @return true if the expression is a edm:If expression
+ */
+ boolean isIf();
+
+ /**
+ * Casts the expression to a {@link EdmIf} expression
+ * @return EdmIf expression
+ */
+ EdmIf asIf();
+
+ /**
+ * Returns true if the expression is a edm:IsOf expression
+ * @return true if the expression is a edm:IsOf expression
+ */
+ boolean isIsOf();
+
+ /**
+ * Casts the expression to a {@link EdmIsOf} expression
+ * @return EdmIsOf expression
+ */
+ EdmIsOf asIsOf();
+
+ /**
+ * Returns true if the expression is a edm:LabeledElement expression
+ * @return true if the expression is a edm:LabeledElement expression
+ */
+ boolean isLabeledElement();
+
+ /**
+ * Casts the expression to a {@link EdmLabeledElement} expression
+ * @return EdmLabeledElement expression
+ */
+ EdmLabeledElement asLabeledElement();
+
+ /**
+ * Returns true if the expression is a edm:LabeledElementReference expression
+ * @return true if the expression is a edm:LabeledElementReference expression
+ */
+ boolean isLabeledElementReference();
+
+ /**
+ * Casts the expression to a {@link EdmLabeledElementReference} expression
+ * @return EdmLabeledElementReference expression
+ */
+ EdmLabeledElementReference asLabeledElementReference();
+
+ /**
+ * Returns true if the expression is a edm:Null expression
+ * @return true if the expression is a edm:Null expression
+ */
+ boolean isNull();
+
+ /**
+ * Casts the expression to a {@link EdmNull} expression
+ * @return EdmNull expression
+ */
+ EdmNull asNull();
+
+ /**
+ * Returns true if the expression is a edm:NavigationPropertyPath expression
+ * @return true if the expression is a edm:NavigationPropertyPath expression
+ */
+ boolean isNavigationPropertyPath();
+
+ /**
+ * Casts the expression to a {@link EdmNavigationPropertyPath} expression
+ * @return EdmNavigationPropertyPath expression
+ */
+ EdmNavigationPropertyPath asNavigationPropertyPath();
+
+ /**
+ * Returns true if the expression is a edm:Path expression
+ * @return true if the expression is a edm:Path expression
+ */
+ boolean isPath();
+
+ /**
+ * Casts the expression to a {@link EdmPath} expression
+ * @return EdmPath expression
+ */
+ EdmPath asPath();
+
+ /**
+ * Returns true if the expression is a edm:PropertyPath expression
+ * @return true if the expression is a edm:PropertyPath expression
+ */
+ boolean isPropertyPath();
+
+ /**
+ * Casts the expression to a {@link EdmPropertyPath} expression
+ * @return EdmPropertyPath expression
+ */
+ EdmPropertyPath asPropertyPath();
+
+ /**
+ * Returns true if the expression is a edm:PropertyValue expression
+ * @return true if the expression is a edm:PropertyValue expression
+ */
+ boolean isPropertyValue();
+
+ /**
+ * Casts the expression to a {@link EdmPropertyValue} expression
+ * @return EdmPropertyValue expression
+ */
+ EdmPropertyValue asPropertyValue();
+
+ /**
+ * Returns true if the expression is a edm:Record expression
+ * @return true if the expression is a edm:Record expression
+ */
+ boolean isRecord();
+
+ /**
+ * Casts the expression to a {@link EdmRecord} expression
+ * @return EdmRecord expression
+ */
+ EdmRecord asRecord();
+
+ /**
+ * Returns true if the expression is a edm:UrlRef expression
+ * @return true if the expression is a edm:UrlRef expression
+ */
+ boolean isUrlRef();
+
+ /**
+ * Casts the expression to a {@link EdmUrlRef} expression
+ * @return EdmUrlRef expression
+ */
+ EdmUrlRef asUrlRef();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmEq.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmEq.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmEq.java
index bd95549..b36c852 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmEq.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmEq.java
@@ -21,6 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
/**
* Represents a edm:Eq expression
*/
-public interface EdmEq extends EdmTwoParamsOpDynamicAnnotationExpression {
+public interface EdmEq extends EdmLogicalOrComparisonExpression {
// No additional methods needed for now.
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmExpression.java
new file mode 100644
index 0000000..3f89b6f
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmExpression.java
@@ -0,0 +1,56 @@
+/*
+ * 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 org.apache.olingo.commons.api.edm.annotation;
+
+/**
+ * Super type of all annotation expressions
+ * A expression is either constant or dynamic
+ */
+public interface EdmExpression {
+
+ /**
+ * Will return the name of the expression e.g. Apply or Cast.
+ * @return the name of the expression
+ */
+ String getExpressionName();
+
+ /**
+ * Return true if the expression is constant
+ * @return true if the expression is constant
+ */
+ boolean isConstant();
+
+ /**
+ * Casts the expression to {@link EdmConstantExpression}
+ * @return Constant Expression
+ */
+ EdmConstantExpression asConstant();
+
+ /**
+ * Return true if the expression is dynamic
+ * @return true if the expression is dynamic
+ */
+ boolean isDynamic();
+
+ /**
+ * Cast the expression to {@link EdmDynamicExpression}
+ * @return Dynamic Expression
+ */
+ EdmDynamicExpression asDynamic();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGe.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGe.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGe.java
index dcdd2df..a15c6c3 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGe.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGe.java
@@ -21,6 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
/**
* Represents a edm:Ge expression
*/
-public interface EdmGe extends EdmTwoParamsOpDynamicAnnotationExpression {
+public interface EdmGe extends EdmLogicalOrComparisonExpression {
// No additional methods needed for now.
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGt.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGt.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGt.java
index 0f49444..76e68d5 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGt.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGt.java
@@ -21,6 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
/**
* Represents a edm:Gt expression
*/
-public interface EdmGt extends EdmTwoParamsOpDynamicAnnotationExpression {
+public interface EdmGt extends EdmLogicalOrComparisonExpression {
// No additional methods needed for now.
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIf.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIf.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIf.java
index 144397e..b7427f6 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIf.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIf.java
@@ -23,7 +23,7 @@ import org.apache.olingo.commons.api.edm.EdmAnnotatable;
/**
* Represents a edm:If expression
*/
-public interface EdmIf extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+public interface EdmIf extends EdmDynamicExpression, EdmAnnotatable {
/**
* Returns the first expression of the edm:If expression.
@@ -31,7 +31,7 @@ public interface EdmIf extends EdmDynamicAnnotationExpression, EdmAnnotatable {
*
* @return First expression of the if expression
*/
- EdmAnnotationExpression getGuard();
+ EdmExpression getGuard();
/**
* Return the second expression of the edm:If expression.
@@ -40,7 +40,7 @@ public interface EdmIf extends EdmDynamicAnnotationExpression, EdmAnnotatable {
*
* @return Second Expression of the edm:If expression
*/
- EdmAnnotationExpression getThen();
+ EdmExpression getThen();
/**
* Return the third expression of the edm:If expression.
@@ -49,5 +49,5 @@ public interface EdmIf extends EdmDynamicAnnotationExpression, EdmAnnotatable {
*
* @return Third Expression of the edm:If expression
*/
- EdmAnnotationExpression getElse();
+ EdmExpression getElse();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIsOf.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIsOf.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIsOf.java
index 54b600d..4df8f9f 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIsOf.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIsOf.java
@@ -26,7 +26,7 @@ import org.apache.olingo.commons.api.edm.geo.SRID;
* The edm:IsOf expression evaluates a child expression and returns a Boolean value indicating whether
* the child expression returns the specified type
*/
-public interface EdmIsOf extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+public interface EdmIsOf extends EdmDynamicExpression, EdmAnnotatable {
/**
* Facet MaxLength
@@ -62,5 +62,5 @@ public interface EdmIsOf extends EdmDynamicAnnotationExpression, EdmAnnotatable
* Returns true if the child expression returns the specified typed
* @return Returns true if the child expression returns the specified typed
*/
- EdmDynamicAnnotationExpression getValue();
+ EdmExpression getValue();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElement.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElement.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElement.java
index 9173b13..e772581 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElement.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElement.java
@@ -24,7 +24,7 @@ import org.apache.olingo.commons.api.edm.EdmAnnotatable;
* The edm:LabeledElement expression assigns a name to a child expression. The value of the child expression can
* then be reused elsewhere with an edm:LabeledElementReference (See {@link EdmLabeledElementReference}) expression.
*/
-public interface EdmLabeledElement extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+public interface EdmLabeledElement extends EdmDynamicExpression, EdmAnnotatable {
/**
* Returns the assigned name
@@ -37,5 +37,5 @@ public interface EdmLabeledElement extends EdmDynamicAnnotationExpression, EdmAn
*
* @return child expression
*/
- EdmDynamicAnnotationExpression getValue();
+ EdmExpression getValue();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElementReference.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElementReference.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElementReference.java
index 0bddf23..9358aed 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElementReference.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElementReference.java
@@ -22,7 +22,7 @@ package org.apache.olingo.commons.api.edm.annotation;
* The edm:LabeledElementReference expression returns the value of an
* edm:LabeledElement (see {@link EdmLabeledElement}) expression.
*/
-public interface EdmLabeledElementReference extends EdmDynamicAnnotationExpression {
+public interface EdmLabeledElementReference extends EdmDynamicExpression {
/**
* Returns the value of the edm:LabeledElement expression
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLe.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLe.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLe.java
index 18e8b4f..b258e23 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLe.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLe.java
@@ -21,6 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
/**
* Represents a edm:Le expression
*/
-public interface EdmLe extends EdmTwoParamsOpDynamicAnnotationExpression {
+public interface EdmLe extends EdmLogicalOrComparisonExpression {
// No additional methods needed for now.
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLogicalOrComparisonExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLogicalOrComparisonExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLogicalOrComparisonExpression.java
new file mode 100644
index 0000000..4db2eab
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLogicalOrComparisonExpression.java
@@ -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 org.apache.olingo.commons.api.edm.annotation;
+
+/**
+ * Represents a generic expression with two child exprssions
+ */
+public interface EdmLogicalOrComparisonExpression extends EdmDynamicExpression {
+
+ /**
+ * Returns the first expression (left child)
+ * @return Child expression
+ */
+ EdmExpression getLeftExpression();
+
+ /**
+ * Returns the second expression (right child)
+ * @return Child expression
+ */
+ EdmExpression getRightExpression();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLt.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLt.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLt.java
index 392adc8..e59875f 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLt.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLt.java
@@ -21,6 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
/**
* Represents a edm:Lt expression
*/
-public interface EdmLt extends EdmTwoParamsOpDynamicAnnotationExpression {
+public interface EdmLt extends EdmLogicalOrComparisonExpression {
// No additional methods needed for now.
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNavigationPropertyPath.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNavigationPropertyPath.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNavigationPropertyPath.java
index e1d335f..cd3a2df 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNavigationPropertyPath.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNavigationPropertyPath.java
@@ -22,7 +22,7 @@ package org.apache.olingo.commons.api.edm.annotation;
* The edm:NavigationPropertyPath expression provides a value for terms or term properties that specify the
* built-in abstract type Edm.NavigationPropertyPath
*/
-public interface EdmNavigationPropertyPath extends EdmDynamicAnnotationExpression {
+public interface EdmNavigationPropertyPath extends EdmDynamicExpression {
/**
* Returns the navigation property path itself.
*
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNe.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNe.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNe.java
index b7848c8..73252f3 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNe.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNe.java
@@ -21,6 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
/**
* Represents a edm:Ne expression
*/
-public interface EdmNe extends EdmTwoParamsOpDynamicAnnotationExpression {
+public interface EdmNe extends EdmLogicalOrComparisonExpression {
// No additional methods needed for now.
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNot.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNot.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNot.java
index 7c302f4..f56b1cd 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNot.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNot.java
@@ -21,11 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
/**
* Represents a logical edm:Le expression
*/
-public interface EdmNot extends EdmDynamicAnnotationExpression {
-
- /**
- * Returns an expression which should be inverted
- * @return the expression which must be inverted
- */
- EdmAnnotationExpression getExpression();
+public interface EdmNot extends EdmLogicalOrComparisonExpression {
+//No additional methods needed.
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNull.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNull.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNull.java
index a94c3f4..62749e8 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNull.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNull.java
@@ -23,6 +23,6 @@ import org.apache.olingo.commons.api.edm.EdmAnnotatable;
/**
* The edm:Null expression returns an untyped null value.
*/
-public interface EdmNull extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+public interface EdmNull extends EdmDynamicExpression, EdmAnnotatable {
// No additional methods needed for now.
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmOr.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmOr.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmOr.java
index 75b4639..1b0668f 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmOr.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmOr.java
@@ -21,6 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
/**
* Represents a logical edm:And expression
*/
-public interface EdmOr extends EdmTwoParamsOpDynamicAnnotationExpression {
+public interface EdmOr extends EdmLogicalOrComparisonExpression {
// No additional methods needed for now.
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPath.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPath.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPath.java
index f41dc04..847b5bd 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPath.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPath.java
@@ -23,7 +23,7 @@ package org.apache.olingo.commons.api.edm.annotation;
* It can be used in annotations that target entity containers, entity sets, entity types, complex types,
* navigation properties of structured types, and properties of structured types.
*/
-public interface EdmPath extends EdmDynamicAnnotationExpression {
+public interface EdmPath extends EdmDynamicExpression {
/**
* Returns the target value of the expression
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyPath.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyPath.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyPath.java
index f0c5efe..a683823 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyPath.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyPath.java
@@ -22,7 +22,7 @@ package org.apache.olingo.commons.api.edm.annotation;
* The edm:PropertyPath expression provides a value for terms or term properties that specify the built-in
* abstract type Edm.PropertyPath.
*/
-public interface EdmPropertyPath extends EdmDynamicAnnotationExpression {
+public interface EdmPropertyPath extends EdmDynamicExpression {
/**
* Returns the property path itself.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyValue.java
index 240370a..667f849 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyValue.java
@@ -24,7 +24,7 @@ import org.apache.olingo.commons.api.edm.EdmAnnotatable;
* The edm:PropertyValue element supplies a value to a property on the type instantiated by an
* edm:Record expression (See {@link EdmRecord}). The value is obtained by evaluating an expression.
*/
-public interface EdmPropertyValue extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+public interface EdmPropertyValue extends EdmDynamicExpression, EdmAnnotatable {
/**
* Property name
* @return Property name
@@ -35,6 +35,6 @@ public interface EdmPropertyValue extends EdmDynamicAnnotationExpression, EdmAnn
* Evaluated value of the expression (property value)
* @return evaluated value of the expression
*/
- EdmAnnotationExpression getValue();
+ EdmExpression getValue();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmRecord.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmRecord.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmRecord.java
index 4389a07..7abd08a 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmRecord.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmRecord.java
@@ -27,7 +27,7 @@ import org.apache.olingo.commons.api.edm.EdmStructuredType;
* The edm:Record expression enables a new entity type or complex type instance to be constructed.
* A record expression contains zero or more edm:PropertyValue (See {@link EdmPropertyValue} )elements.
*/
-public interface EdmRecord extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+public interface EdmRecord extends EdmDynamicExpression, EdmAnnotatable {
/**
* List of edm:PropertyValues (See {@link EdmPropertyValue}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmTwoParamsOpDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmTwoParamsOpDynamicAnnotationExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmTwoParamsOpDynamicAnnotationExpression.java
deleted file mode 100644
index 5fc5edf..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmTwoParamsOpDynamicAnnotationExpression.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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 org.apache.olingo.commons.api.edm.annotation;
-
-/**
- * Represents a generic expression with two child exprssions
- */
-public interface EdmTwoParamsOpDynamicAnnotationExpression extends EdmDynamicAnnotationExpression {
-
- /**
- * Returns the first expression (left child)
- * @return Child expression
- */
- EdmAnnotationExpression getLeftExpression();
-
- /**
- * Returns the second expression (right child)
- * @return Child expression
- */
- EdmAnnotationExpression getRightExpression();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmUrlRef.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmUrlRef.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmUrlRef.java
index 613c2e1..1fbc63a 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmUrlRef.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmUrlRef.java
@@ -22,11 +22,11 @@ package org.apache.olingo.commons.api.edm.annotation;
* The edm:UrlRef expression enables a value to be obtained by sending a GET request to the value of
* the UrlRef expression.
*/
-public interface EdmUrlRef extends EdmDynamicAnnotationExpression {
+public interface EdmUrlRef extends EdmDynamicExpression {
/**
* Returns a expression of type Edm.String
* @return expression of type Edm.String
*/
- EdmAnnotationExpression getValue();
+ EdmExpression getValue();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlCast.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlCast.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlCast.java
index a2dc7e7..2545f3f 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlCast.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlCast.java
@@ -37,7 +37,7 @@ public class CsdlCast extends CsdlDynamicExpression implements CsdlAnnotatable{
private Integer precision;
private Integer scale;
private SRID srid;
- private CsdlDynamicExpression value;
+ private CsdlExpression value;
private List<CsdlAnnotation> annotations = new ArrayList<CsdlAnnotation>();
@Override
@@ -114,11 +114,11 @@ public class CsdlCast extends CsdlDynamicExpression implements CsdlAnnotatable{
* Cast value of the expression
* @return Cast value
*/
- public CsdlDynamicExpression getValue() {
+ public CsdlExpression getValue() {
return value;
}
- public void setValue(final CsdlDynamicExpression value) {
+ public void setValue(final CsdlExpression value) {
this.value = value;
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlConstantExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlConstantExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlConstantExpression.java
index 8e8d5cd..c860598 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlConstantExpression.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlConstantExpression.java
@@ -23,7 +23,7 @@ public class CsdlConstantExpression extends CsdlExpression {
private static final long serialVersionUID = 5618680702707972904L;
- private ConstantExpressionType type;
+ private final ConstantExpressionType type;
private String value;
/**
@@ -96,7 +96,9 @@ public class CsdlConstantExpression extends CsdlExpression {
}
}
- public CsdlConstantExpression() {}
+ public CsdlConstantExpression(ConstantExpressionType type) {
+ this.type = type;
+ }
public CsdlConstantExpression(ConstantExpressionType type, String value) {
this.type = type;
@@ -112,16 +114,6 @@ public class CsdlConstantExpression extends CsdlExpression {
}
/**
- * Sets the type of the constant expression
- * @param type type of the constant expression
- * @return this for method chaining
- */
- public CsdlConstantExpression setType(final ConstantExpressionType type) {
- this.type = type;
- return this;
- }
-
- /**
* Value of the constant expression
* @return value of the constant expression as String
*/
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmAnnotationImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmAnnotationImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmAnnotationImpl.java
index 53fbfde..09bfefd 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmAnnotationImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmAnnotationImpl.java
@@ -18,53 +18,20 @@
*/
package org.apache.olingo.commons.core.edm;
-import java.util.ArrayList;
-import java.util.List;
-
import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotatable;
import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmTerm;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
-import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
-import org.apache.olingo.commons.api.edm.annotation.EdmPropertyValue;
-import org.apache.olingo.commons.api.edm.provider.CsdlAnnotatable;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
-import org.apache.olingo.commons.api.edm.provider.annotation.CsdlDynamicExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.CsdlExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.CsdlPropertyValue;
-import org.apache.olingo.commons.core.edm.annotation.EdmAndImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmAnnotationPathImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmApplyImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmCastImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmCollectionImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmConstantAnnotationExpressionImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmEqImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmGeImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmGtImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmIfImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmIsOfImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmLabeledElementImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmLabeledElementReferenceImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmLeImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmLtImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmNavigationPropertyPathImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmNeImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmNotImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmNullImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmOrImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmPathImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmPropertyPathImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmPropertyValueImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmRecordImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmUrlRefImpl;
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
public class EdmAnnotationImpl extends AbstractEdmAnnotatable implements EdmAnnotation {
private final CsdlAnnotation annotation;
private EdmTerm term;
- private EdmAnnotationExpression expression;
+ private EdmExpression expression;
public EdmAnnotationImpl(final Edm edm, final CsdlAnnotation annotation) {
super(edm, annotation);
@@ -74,6 +41,9 @@ public class EdmAnnotationImpl extends AbstractEdmAnnotatable implements EdmAnno
@Override
public EdmTerm getTerm() {
if (term == null) {
+ if (annotation.getTerm() == null) {
+ throw new EdmException("Term must not be null for an annotation.");
+ }
term = edm.getTerm(new FullQualifiedName(annotation.getTerm()));
}
return term;
@@ -84,142 +54,14 @@ public class EdmAnnotationImpl extends AbstractEdmAnnotatable implements EdmAnno
return annotation.getQualifier();
}
- private EdmAnnotationExpression getExpression(final CsdlExpression exp) {
- EdmAnnotationExpression _expression = null;
-
- if (exp.isConstant()) {
- _expression = new EdmConstantAnnotationExpressionImpl(exp.asConstant());
- } else if (annotation.getExpression().isDynamic()) {
- _expression = getDynamicExpression(exp.asDynamic());
- }
-
- return _expression;
- }
-
- private EdmDynamicAnnotationExpression getDynamicExpression(final CsdlDynamicExpression exp) {
- EdmDynamicAnnotationExpression _expression = null;
-
- if (exp.isLogicalOrComparison()) {
- switch (exp.asLogicalOrComparison().getType()) {
- case Not:
- _expression = new EdmNotImpl(getExpression(exp.asLogicalOrComparison().getLeft()));
- break;
- case And:
- _expression = new EdmAndImpl(
- getExpression(exp.asLogicalOrComparison().getLeft()),
- getExpression(exp.asLogicalOrComparison().getRight()));
- break;
-
- case Or:
- _expression = new EdmOrImpl(
- getExpression(exp.asLogicalOrComparison().getLeft()),
- getExpression(exp.asLogicalOrComparison().getRight()));
- break;
-
- case Eq:
- _expression = new EdmEqImpl(
- getExpression(exp.asLogicalOrComparison().getLeft()),
- getExpression(exp.asLogicalOrComparison().getRight()));
- break;
-
- case Ne:
- _expression = new EdmNeImpl(
- getExpression(exp.asLogicalOrComparison().getLeft()),
- getExpression(exp.asLogicalOrComparison().getRight()));
- break;
-
- case Ge:
- _expression = new EdmGeImpl(
- getExpression(exp.asLogicalOrComparison().getLeft()),
- getExpression(exp.asLogicalOrComparison().getRight()));
- break;
-
- case Gt:
- _expression = new EdmGtImpl(
- getExpression(exp.asLogicalOrComparison().getLeft()),
- getExpression(exp.asLogicalOrComparison().getRight()));
- break;
-
- case Le:
- _expression = new EdmLeImpl(
- getExpression(exp.asLogicalOrComparison().getLeft()),
- getExpression(exp.asLogicalOrComparison().getRight()));
- break;
-
- case Lt:
- _expression = new EdmLtImpl(
- getExpression(exp.asLogicalOrComparison().getLeft()),
- getExpression(exp.asLogicalOrComparison().getRight()));
- break;
-
- default:
- }
- } else if (exp.isAnnotationPath()) {
- _expression = new EdmAnnotationPathImpl(exp.asAnnotationPath().getValue());
- } else if (exp.isApply()) {
- final List<EdmAnnotationExpression> parameters =
- new ArrayList<EdmAnnotationExpression>(exp.asApply().getParameters().size());
- for (CsdlExpression param : exp.asApply().getParameters()) {
- parameters.add(getExpression(param));
- }
- _expression = new EdmApplyImpl(exp.asApply().getFunction(), parameters);
- } else if (exp.isCast()) {
- _expression = new EdmCastImpl(edm, exp.asCast(), getDynamicExpression(exp.asCast().getValue()));
- } else if (exp.isCollection()) {
- final List<EdmAnnotationExpression> items =
- new ArrayList<EdmAnnotationExpression>(exp.asCollection().getItems().size());
- for (CsdlExpression param : exp.asCollection().getItems()) {
- items.add(getExpression(param));
- }
- _expression = new EdmCollectionImpl(items);
- } else if (exp.isIf()) {
- _expression = new EdmIfImpl(
- getExpression(exp.asIf().getGuard()),
- getExpression(exp.asIf().getThen()),
- getExpression(exp.asIf().getElse()));
- } else if (exp.isIsOf()) {
- _expression = new EdmIsOfImpl(edm, exp.asIsOf(), getDynamicExpression(exp.asIsOf().getValue().asDynamic()));
- } else if (exp.isLabeledElement()) {
- _expression = new EdmLabeledElementImpl(
- exp.asLabeledElement().getName(), getDynamicExpression(exp.asLabeledElement().getValue().asDynamic()));
- } else if (exp.isLabeledElementReference()) {
- _expression = new EdmLabeledElementReferenceImpl(exp.asLabeledElementReference().getValue());
- } else if (exp.isNull()) {
- _expression = new EdmNullImpl();
- } else if (exp.isNavigationPropertyPath()) {
- _expression = new EdmNavigationPropertyPathImpl(exp.asNavigationPropertyPath().getValue());
- } else if (exp.isPath()) {
- _expression = new EdmPathImpl(exp.asPath().getValue());
- } else if (exp.isPropertyPath()) {
- _expression = new EdmPropertyPathImpl(exp.asPropertyPath().getValue());
- } else if (exp.isPropertyValue()) {
- _expression = new EdmPropertyValueImpl(
- exp.asPropertyValue().getProperty(), getExpression(exp.asPropertyValue().getValue()));
- } else if (exp.isRecord()) {
- final List<EdmPropertyValue> propertyValues =
- new ArrayList<EdmPropertyValue>(exp.asRecord().getPropertyValues().size());
- for (CsdlPropertyValue propertyValue : exp.asRecord().getPropertyValues()) {
- propertyValues.add(new EdmPropertyValueImpl(
- propertyValue.getProperty(), getExpression(propertyValue.getValue())));
- }
- _expression = new EdmRecordImpl(edm, exp.asRecord().getType(), propertyValues);
- } else if (exp.isUrlRef()) {
- _expression = new EdmUrlRefImpl(getExpression(exp.asUrlRef().getValue()));
- }
-
- if (_expression instanceof EdmAnnotatable && exp instanceof CsdlAnnotatable) {
- for (CsdlAnnotation _annotation : ((CsdlAnnotatable) exp).getAnnotations()) {
- ((EdmAnnotatable) _expression).getAnnotations().add(new EdmAnnotationImpl(edm, _annotation));
- }
- }
-
- return _expression;
- }
+
@Override
- public EdmAnnotationExpression getExpression() {
+ public EdmExpression getExpression() {
if (expression == null) {
- expression = getExpression(annotation.getExpression());
+ if (annotation.getExpression() != null) {
+ expression = AbstractEdmExpression.getExpression(edm, annotation.getExpression());
+ }
}
return expression;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotatableDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotatableDynamicAnnotationExpression.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotatableDynamicAnnotationExpression.java
deleted file mode 100644
index 4011fa2..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotatableDynamicAnnotationExpression.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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 org.apache.olingo.commons.core.edm.annotation;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.EdmAnnotatable;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-
-public abstract class AbstractEdmAnnotatableDynamicAnnotationExpression
-extends AbstractEdmDynamicAnnotationExpression implements EdmAnnotatable {
-
- private final List<EdmAnnotation> annotations = new ArrayList<EdmAnnotation>();
-
- //TODO: Can we derive this method from AbstractEdmAnnotatable?
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term, String qualifier) {
- EdmAnnotation result = null;
- for (EdmAnnotation annotation : getAnnotations()) {
- if (term.getFullQualifiedName().equals(annotation.getTerm().getFullQualifiedName())) {
- if (qualifier == annotation.getQualifier()
- || (qualifier != null && qualifier.equals(annotation.getQualifier()))) {
- result = annotation;
- break;
- }
- }
- }
- return result;
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- return annotations;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotatableDynamicExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotatableDynamicExpression.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotatableDynamicExpression.java
new file mode 100644
index 0000000..5ac562b
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotatableDynamicExpression.java
@@ -0,0 +1,56 @@
+/*
+ * 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 org.apache.olingo.commons.core.edm.annotation;
+
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAnnotatable;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotatable;
+import org.apache.olingo.commons.core.edm.AbstractEdmAnnotatable;
+
+public abstract class AbstractEdmAnnotatableDynamicExpression extends AbstractEdmDynamicExpression implements
+ EdmAnnotatable {
+
+ private final AnnotationHelper helper;
+
+ public AbstractEdmAnnotatableDynamicExpression(Edm edm, String name, CsdlAnnotatable annotatable) {
+ super(edm, name);
+ helper = new AnnotationHelper(edm, annotatable);
+ }
+
+ @Override
+ public EdmAnnotation getAnnotation(final EdmTerm term, String qualifier) {
+ return helper.getAnnotation(term, qualifier);
+ }
+
+ @Override
+ public List<EdmAnnotation> getAnnotations() {
+ return helper.getAnnotations();
+ }
+
+ private class AnnotationHelper extends AbstractEdmAnnotatable {
+
+ public AnnotationHelper(Edm edm, CsdlAnnotatable annotatable) {
+ super(edm, annotatable);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotationExpression.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotationExpression.java
deleted file mode 100644
index 26757c1..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotationExpression.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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 org.apache.olingo.commons.core.edm.annotation;
-
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
-import org.apache.olingo.commons.api.edm.annotation.EdmConstantAnnotationExpression;
-import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
-
-public abstract class AbstractEdmAnnotationExpression implements EdmAnnotationExpression {
-
- @Override
- public boolean isConstant() {
- return this instanceof EdmConstantAnnotationExpression;
- }
-
- @Override
- public EdmConstantAnnotationExpression asConstant() {
- return isConstant() ? (EdmConstantAnnotationExpression) this : null;
- }
-
- @Override
- public boolean isDynamic() {
- return this instanceof EdmDynamicAnnotationExpression;
- }
-
- @Override
- public EdmDynamicAnnotationExpression asDynamic() {
- return isDynamic() ? (EdmDynamicAnnotationExpression) this : null;
- }
-}