From 07400abc4aa7c81fe9c0173d5d49b8698a1768f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesco=20Chicchiricc=C3=B2?= Date: Mon, 24 Feb 2014 13:32:53 +0100 Subject: [PATCH] Removing unneeded type genericization after interface introduction --- .../odata4/client/api/edm/DataServices.java | 34 ++++ .../olingo/odata4/client/api/edm/Edmx.java | 7 + .../client/api/edm/EntityContainer.java | 11 +- .../odata4/client/api/edm/EntitySet.java | 7 + .../odata4/client/api/edm/EntityType.java | 7 +- .../odata4/client/api/edm/FunctionImport.java | 3 + .../odata4/client/api/edm/v4/Annotation.java | 18 ++ .../client/api/edm/{ => v4}/OnDelete.java | 5 +- .../edm/v4/annotation/ConstExprConstruct.java | 56 ++++++ .../edm/v4/annotation/DynExprConstruct.java | 23 +++ .../client/core/edm/AbstractDataServices.java | 12 +- .../client/core/edm/AbstractEdmMetadata.java | 24 ++- .../client/core/edm/AbstractEdmType.java | 33 ++-- .../odata4/client/core/edm/AbstractEdmx.java | 40 ++-- .../core/edm/AbstractEntityContainer.java | 30 +-- .../client/core/edm/AbstractEntitySet.java | 4 + .../client/core/edm/AbstractEntityType.java | 5 - .../client/core/edm/AbstractEnumType.java | 23 +++ .../core/edm/AbstractFunctionImport.java | 3 - .../client/core/edm/AbstractSchema.java | 147 ++++++--------- .../odata4/client/core/edm/OnDeleteImpl.java | 4 +- .../core/edm/v3/AssociationEndImpl.java | 2 +- .../client/core/edm/v3/DataServicesImpl.java | 3 +- .../client/core/edm/v3/EdmMetadataImpl.java | 21 ++- .../client/core/edm/v3/EdmTypeImpl.java | 19 +- .../odata4/client/core/edm/v3/EdmxImpl.java | 8 +- .../core/edm/v3/EntityContainerImpl.java | 29 +-- .../client/core/edm/v3/EnumTypeImpl.java | 16 +- .../odata4/client/core/edm/v3/SchemaImpl.java | 43 +++-- .../core/edm/v4/AbstractAnnotatedEdmItem.java | 8 +- .../core/edm/v4/ActionDeserializer.java | 4 +- .../client/core/edm/v4/AnnotatedEdmItem.java | 2 +- .../core/edm/v4/AnnotationDeserializer.java | 4 +- .../client/core/edm/v4/AnnotationImpl.java | 26 ++- .../client/core/edm/v4/AnnotationsImpl.java | 1 + .../client/core/edm/v4/ComplexTypeImpl.java | 6 +- .../client/core/edm/v4/DataServicesImpl.java | 3 +- .../client/core/edm/v4/EdmMetadataImpl.java | 34 +++- .../client/core/edm/v4/EdmTypeImpl.java | 18 +- .../odata4/client/core/edm/v4/EdmxImpl.java | 8 +- .../core/edm/v4/EntityContainerImpl.java | 173 +++++++++--------- .../client/core/edm/v4/EntitySetImpl.java | 6 +- .../client/core/edm/v4/EntityTypeImpl.java | 78 ++++---- .../client/core/edm/v4/EnumTypeImpl.java | 22 +-- .../core/edm/v4/FunctionDeserializer.java | 4 +- .../core/edm/v4/FunctionImportImpl.java | 8 +- .../odata4/client/core/edm/v4/MemberImpl.java | 8 +- .../v4/NavigationPropertyDeserializer.java | 6 +- .../core/edm/v4/NavigationPropertyImpl.java | 6 +- .../odata4/client/core/edm/v4/SchemaImpl.java | 53 +++--- .../core/edm/v4/SingletonDeserializer.java | 4 +- .../client/core/edm/v4/TermDeserializer.java | 2 +- .../annotation/AbstractElOrAttrConstruct.java | 2 +- .../annotation/AnnotatedDynExprConstruct.java | 9 +- .../client/core/edm/v4/annotation/Apply.java | 4 +- .../edm/v4/annotation/ApplyDeserializer.java | 4 +- .../client/core/edm/v4/annotation/Cast.java | 6 +- .../edm/v4/annotation/CastDeserializer.java | 4 +- .../core/edm/v4/annotation/Collection.java | 6 +- .../v4/annotation/CollectionDeserializer.java | 2 +- ...truct.java => ConstExprConstructImpl.java} | 34 +--- .../DynExprConstructDeserializer.java | 18 +- ...nstruct.java => DynExprConstructImpl.java} | 3 +- .../v4/annotation/DynExprDoubleParamOp.java | 14 +- .../v4/annotation/DynExprSingleParamOp.java | 8 +- ...rConstruct.java => ExprConstructImpl.java} | 2 +- .../client/core/edm/v4/annotation/If.java | 18 +- .../client/core/edm/v4/annotation/IsOf.java | 6 +- .../edm/v4/annotation/IsOfDeserializer.java | 4 +- .../edm/v4/annotation/LabeledElement.java | 6 +- .../LabeledElementDeserializer.java | 4 +- .../edm/v4/annotation/NullDeserializer.java | 2 +- .../core/edm/v4/annotation/PropertyValue.java | 6 +- .../annotation/PropertyValueDeserializer.java | 4 +- .../edm/v4/annotation/RecordDeserializer.java | 4 +- .../client/core/edm/v4/annotation/UrlRef.java | 8 +- .../edm/v4/annotation/UrlRefDeserializer.java | 2 +- .../core/op/impl/AbstractEdmDeserializer.java | 10 +- .../core/op/impl/ComplexTypeDeserializer.java | 2 +- .../op/impl/EntityContainerDeserializer.java | 8 +- .../core/op/impl/EntitySetDeserializer.java | 4 +- .../core/op/impl/EnumTypeDeserializer.java | 2 +- .../odata4/client/core/v3/MetadataTest.java | 8 +- .../odata4/client/core/v4/MetadataTest.java | 12 +- 84 files changed, 775 insertions(+), 572 deletions(-) create mode 100644 odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/DataServices.java rename odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/{ => v4}/OnDelete.java (87%) create mode 100644 odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/annotation/ConstExprConstruct.java create mode 100644 odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/annotation/DynExprConstruct.java rename odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/{ConstExprConstruct.java => ConstExprConstructImpl.java} (72%) rename odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/{DynExprConstruct.java => DynExprConstructImpl.java} (85%) rename odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/{ExprConstruct.java => ExprConstructImpl.java} (93%) diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/DataServices.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/DataServices.java new file mode 100644 index 000000000..9d72c7ed2 --- /dev/null +++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/DataServices.java @@ -0,0 +1,34 @@ +/* + * 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.odata4.client.api.edm; + +import java.util.List; + +public interface DataServices { + + String getDataServiceVersion(); + + void setDataServiceVersion(String dataServiceVersion); + + String getMaxDataServiceVersion(); + + void setMaxDataServiceVersion(String maxDataServiceVersion); + + List getSchemas(); +} diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Edmx.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Edmx.java index df5250b26..94fb5a8e0 100644 --- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Edmx.java +++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Edmx.java @@ -20,4 +20,11 @@ package org.apache.olingo.odata4.client.api.edm; public interface Edmx { + String getVersion(); + + void setVersion(String version); + + DataServices getDataServices(); + + void setDataServices(DataServices dataServices); } diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityContainer.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityContainer.java index e497d3e7c..a0a507df0 100644 --- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityContainer.java +++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityContainer.java @@ -16,9 +16,16 @@ * specific language governing permissions and limitations * under the License. */ - package org.apache.olingo.odata4.client.api.edm; +import java.util.List; + public interface EntityContainer { - + + List getEntitySets(); + + EntitySet getEntitySet(String name); + + List getFunctionImports(); + } diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntitySet.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntitySet.java index de64e11aa..4c75e9ffe 100644 --- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntitySet.java +++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntitySet.java @@ -20,4 +20,11 @@ package org.apache.olingo.odata4.client.api.edm; public interface EntitySet { + String getName(); + + void setName(String name); + + String getEntityType(); + + void setEntityType(String entityType); } diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityType.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityType.java index c769b2730..5779fbe43 100644 --- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityType.java +++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityType.java @@ -18,6 +18,11 @@ */ package org.apache.olingo.odata4.client.api.edm; -public interface EntityType { +import java.util.List; +public interface EntityType extends ComplexType { + + List getNavigationProperties(); + + NavigationProperty getNavigationProperty(String name); } diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/FunctionImport.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/FunctionImport.java index 3b23a3065..412b628ae 100644 --- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/FunctionImport.java +++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/FunctionImport.java @@ -20,4 +20,7 @@ package org.apache.olingo.odata4.client.api.edm; public interface FunctionImport { + String getName(); + + String getEntitySet(); } diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Annotation.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Annotation.java index a59cbc829..0fe51090f 100644 --- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Annotation.java +++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Annotation.java @@ -18,6 +18,24 @@ */ package org.apache.olingo.odata4.client.api.edm.v4; +import org.apache.olingo.odata4.client.api.edm.v4.annotation.ConstExprConstruct; +import org.apache.olingo.odata4.client.api.edm.v4.annotation.DynExprConstruct; + public interface Annotation { + String getTerm(); + + void setTerm(String term); + + String getQualifier(); + + void setQualifier(String qualifier); + + ConstExprConstruct getConstExpr(); + + void setConstExpr(ConstExprConstruct constExpr); + + DynExprConstruct getDynExpr(); + + void setDynExpr(DynExprConstruct dynExpr); } diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/OnDelete.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/OnDelete.java similarity index 87% rename from odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/OnDelete.java rename to odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/OnDelete.java index 85e128974..c1c10b2d3 100644 --- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/OnDelete.java +++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/OnDelete.java @@ -16,8 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.client.api.edm; +package org.apache.olingo.odata4.client.api.edm.v4; public interface OnDelete { + OnDeleteAction getAction(); + + void setAction(OnDeleteAction action); } diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/annotation/ConstExprConstruct.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/annotation/ConstExprConstruct.java new file mode 100644 index 000000000..21f171961 --- /dev/null +++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/annotation/ConstExprConstruct.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.odata4.client.api.edm.v4.annotation; + +public interface ConstExprConstruct { + + public enum Type { + + Binary, + Bool, + Date, + DateTimeOffset, + Decimal, + Duration, + EnumMember, + Float, + Guid, + Int, + String, + TimeOfDay; + + public static Type fromString(final String value) { + Type result = null; + try { + result = valueOf(value); + } catch (IllegalArgumentException e) { + // ignore + } + return result; + } + } + + Type getType(); + + void setType(Type type); + + String getValue(); + + void setValue(String value); +} diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/annotation/DynExprConstruct.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/annotation/DynExprConstruct.java new file mode 100644 index 000000000..b409059ff --- /dev/null +++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/annotation/DynExprConstruct.java @@ -0,0 +1,23 @@ +/* + * 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.odata4.client.api.edm.v4.annotation; + +public interface DynExprConstruct { + +} diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractDataServices.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractDataServices.java index feda3a523..ab1ad1dff 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractDataServices.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractDataServices.java @@ -19,12 +19,10 @@ package org.apache.olingo.odata4.client.core.edm; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; +import org.apache.olingo.odata4.client.api.edm.DataServices; @JsonDeserialize(using = DataServicesDeserializer.class) -public abstract class AbstractDataServices, EC extends AbstractEntityContainer< - FI>, E extends AbstractEntityType, C extends AbstractComplexType, FI extends AbstractFunctionImport> - extends AbstractEdmItem { +public abstract class AbstractDataServices extends AbstractEdmItem implements DataServices { private static final long serialVersionUID = -9126377222393876166L; @@ -32,21 +30,23 @@ public abstract class AbstractDataServices getSchemas(); } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmMetadata.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmMetadata.java index cf94a7b61..e8f923a6f 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmMetadata.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmMetadata.java @@ -25,21 +25,19 @@ import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.apache.olingo.odata4.client.api.ODataClient; import org.apache.olingo.odata4.client.api.edm.EdmMetadata; +import org.apache.olingo.odata4.client.api.edm.Edmx; +import org.apache.olingo.odata4.client.api.edm.Schema; /** * Entry point for access information about EDM metadata. */ -public abstract class AbstractEdmMetadata< - EDMX extends AbstractEdmx, DS extends AbstractDataServices< - S, EC, E, C, FI>, S extends AbstractSchema, EC extends AbstractEntityContainer< - FI>, E extends AbstractEntityType, C extends AbstractComplexType, FI extends AbstractFunctionImport> - extends AbstractEdmItem implements EdmMetadata { +public abstract class AbstractEdmMetadata extends AbstractEdmItem implements EdmMetadata { private static final long serialVersionUID = -1214173426671503187L; - protected final EDMX edmx; + protected final Edmx edmx; - protected final Map schemaByNsOrAlias; + protected final Map schemaByNsOrAlias; /** * Constructor. @@ -49,10 +47,10 @@ public abstract class AbstractEdmMetadata< */ @SuppressWarnings("unchecked") public AbstractEdmMetadata(final ODataClient client, final InputStream inputStream) { - edmx = (EDMX) client.getDeserializer().toMetadata(inputStream); + edmx = client.getDeserializer().toMetadata(inputStream); - this.schemaByNsOrAlias = new HashMap(); - for (S schema : edmx.getDataServices().getSchemas()) { + this.schemaByNsOrAlias = new HashMap(); + for (Schema schema : edmx.getDataServices().getSchemas()) { this.schemaByNsOrAlias.put(schema.getNamespace(), schema); if (StringUtils.isNotBlank(schema.getAlias())) { this.schemaByNsOrAlias.put(schema.getAlias(), schema); @@ -78,7 +76,7 @@ public abstract class AbstractEdmMetadata< * @return the Schema at the specified position in the EdM metadata document */ @Override - public S getSchema(final int index) { + public Schema getSchema(final int index) { return this.edmx.getDataServices().getSchemas().get(index); } @@ -89,7 +87,7 @@ public abstract class AbstractEdmMetadata< * @return the Schema with the specified key in the EdM metadata document */ @Override - public S getSchema(final String key) { + public Schema getSchema(final String key) { return this.schemaByNsOrAlias.get(key); } @@ -99,7 +97,7 @@ public abstract class AbstractEdmMetadata< * @return all Schema objects defined in the EdM metadata document */ @Override - public List getSchemas() { + public List getSchemas() { return this.edmx.getDataServices().getSchemas(); } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmType.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmType.java index c2d862be8..0cf93d6f8 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmType.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmType.java @@ -20,17 +20,18 @@ package org.apache.olingo.odata4.client.core.edm; import org.apache.commons.lang3.StringUtils; import org.apache.olingo.odata4.client.api.data.EdmSimpleType; +import org.apache.olingo.odata4.client.api.edm.ComplexType; +import org.apache.olingo.odata4.client.api.edm.EdmMetadata; import org.apache.olingo.odata4.client.api.edm.EdmType; import org.apache.olingo.odata4.client.api.edm.EdmTypeNotFoundException; +import org.apache.olingo.odata4.client.api.edm.EntityType; +import org.apache.olingo.odata4.client.api.edm.EnumType; +import org.apache.olingo.odata4.client.api.edm.Schema; /** * Parse type information from metadata into semantic data. */ -public abstract class AbstractEdmType, EDMX extends AbstractEdmx, DS extends AbstractDataServices< - S, EC, E, C, FI>, S extends AbstractSchema, EC extends AbstractEntityContainer< - FI>, E extends AbstractEntityType, C extends AbstractComplexType, FI extends AbstractFunctionImport> - implements EdmType { +public abstract class AbstractEdmType implements EdmType { private final String typeExpression; @@ -42,11 +43,11 @@ public abstract class AbstractEdmTypeEdmTypeNotFoundException will be raised if it is not an enum type. */ @Override - public final AbstractEnumType getEnumType() { + public EnumType getEnumType() { if (!isEnumType()) { throw new EdmTypeNotFoundException(AbstractEnumType.class, this.typeExpression); } @@ -197,7 +198,7 @@ public abstract class AbstractEdmTypeEdmTypeNotFoundException will be raised if it is not a complex type. */ @Override - public final C getComplexType() { + public ComplexType getComplexType() { if (!isComplexType()) { throw new EdmTypeNotFoundException(AbstractComplexType.class, this.typeExpression); } @@ -221,7 +222,7 @@ public abstract class AbstractEdmTypeEdmTypeNotFoundException will be raised if it is not an entity type. */ @Override - public final E getEntityType() { + public EntityType getEntityType() { if (!isEntityType()) { throw new EdmTypeNotFoundException(AbstractEntityType.class, this.typeExpression); } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmx.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmx.java index 3a379f209..dac8d0918 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmx.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmx.java @@ -19,33 +19,35 @@ package org.apache.olingo.odata4.client.core.edm; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import org.apache.olingo.odata4.client.api.edm.DataServices; import org.apache.olingo.odata4.client.api.edm.Edmx; @JsonDeserialize(using = EdmxDeserializer.class) -public abstract class AbstractEdmx, S extends AbstractSchema< - EC, E, C, FI>, EC extends AbstractEntityContainer< - FI>, E extends AbstractEntityType, C extends AbstractComplexType, FI extends AbstractFunctionImport> - extends AbstractEdmItem implements Edmx { +public abstract class AbstractEdmx extends AbstractEdmItem implements Edmx { - private static final long serialVersionUID = -5480835122183091469L; + private static final long serialVersionUID = -5480835122183091469L; - private String version; + private String version; - private DS dataServices; + private DataServices dataServices; - public String getVersion() { - return version; - } + @Override + public String getVersion() { + return version; + } - public void setVersion(final String version) { - this.version = version; - } + @Override + public void setVersion(final String version) { + this.version = version; + } - public DS getDataServices() { - return dataServices; - } + @Override + public DataServices getDataServices() { + return dataServices; + } - public void setDataServices(final DS dataServices) { - this.dataServices = dataServices; - } + @Override + public void setDataServices(final DataServices dataServices) { + this.dataServices = dataServices; + } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityContainer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityContainer.java index 95102f1e0..e9c38104f 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityContainer.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityContainer.java @@ -22,11 +22,12 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.util.ArrayList; import java.util.List; import org.apache.olingo.odata4.client.api.edm.EntityContainer; +import org.apache.olingo.odata4.client.api.edm.EntitySet; +import org.apache.olingo.odata4.client.api.edm.FunctionImport; import org.apache.olingo.odata4.client.core.op.impl.EntityContainerDeserializer; @JsonDeserialize(using = EntityContainerDeserializer.class) -public abstract class AbstractEntityContainer - extends AbstractEdmItem implements EntityContainer { +public abstract class AbstractEntityContainer extends AbstractEdmItem implements EntityContainer { private static final long serialVersionUID = 4121974387552855032L; @@ -70,9 +71,16 @@ public abstract class AbstractEntityContainer this.defaultEntityContainer = defaultEntityContainer; } - public abstract List getEntitySets(); - - public abstract AbstractEntitySet getEntitySet(String name); + @Override + public EntitySet getEntitySet(final String name) { + EntitySet result = null; + for (EntitySet entitySet : getEntitySets()) { + if (name.equals(entitySet.getName())) { + result = entitySet; + } + } + return result; + } /** * Gets the first function import with given name. @@ -80,8 +88,8 @@ public abstract class AbstractEntityContainer * @param name name. * @return function import. */ - public FI getFunctionImport(final String name) { - final List funcImps = getFunctionImports(name); + public FunctionImport getFunctionImport(final String name) { + final List funcImps = getFunctionImports(name); return funcImps.isEmpty() ? null : funcImps.get(0); @@ -93,15 +101,13 @@ public abstract class AbstractEntityContainer * @param name name. * @return function imports. */ - public List getFunctionImports(final String name) { - final List result = new ArrayList(); - for (FI functionImport : getFunctionImports()) { + public List getFunctionImports(final String name) { + final List result = new ArrayList(); + for (FunctionImport functionImport : getFunctionImports()) { if (name.equals(functionImport.getName())) { result.add(functionImport); } } return result; } - - public abstract List getFunctionImports(); } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntitySet.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntitySet.java index 65679d542..83f7a383f 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntitySet.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntitySet.java @@ -31,18 +31,22 @@ public abstract class AbstractEntitySet extends AbstractEdmItem implements Entit private String entityType; + @Override public String getName() { return name; } + @Override public void setName(final String name) { this.name = name; } + @Override public String getEntityType() { return entityType; } + @Override public void setEntityType(final String entityType) { this.entityType = entityType; } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityType.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityType.java index c564d6969..741bb3dbc 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityType.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityType.java @@ -19,7 +19,6 @@ package org.apache.olingo.odata4.client.core.edm; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; import org.apache.olingo.odata4.client.api.edm.EntityType; import org.apache.olingo.odata4.client.core.op.impl.EntityTypeDeserializer; @@ -78,8 +77,4 @@ public abstract class AbstractEntityType extends AbstractComplexType implements this.hasStream = hasStream; } - public abstract List getNavigationProperties(); - - public abstract AbstractNavigationProperty getNavigationProperty(String name); - } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEnumType.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEnumType.java index 1ac42eb66..0b2169728 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEnumType.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEnumType.java @@ -20,6 +20,7 @@ package org.apache.olingo.odata4.client.core.edm; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import org.apache.olingo.odata4.client.api.edm.EnumType; +import org.apache.olingo.odata4.client.api.edm.Member; import org.apache.olingo.odata4.client.core.op.impl.EnumTypeDeserializer; @JsonDeserialize(using = EnumTypeDeserializer.class) @@ -62,4 +63,26 @@ public abstract class AbstractEnumType extends AbstractEdmItem implements EnumTy public void setFlags(final boolean flags) { this.flags = flags; } + + @Override + public Member getMember(final String name) { + Member result = null; + for (Member member : getMembers()) { + if (name.equals(member.getName())) { + result = member; + } + } + return result; + } + + @Override + public Member getMember(final Integer value) { + Member result = null; + for (Member member : getMembers()) { + if (value.equals(member.getValue())) { + result = member; + } + } + return result; + } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractFunctionImport.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractFunctionImport.java index fc6e9e486..9f6200dd1 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractFunctionImport.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractFunctionImport.java @@ -24,7 +24,4 @@ public abstract class AbstractFunctionImport extends AbstractEdmItem implements private static final long serialVersionUID = 4154308065211315663L; - public abstract String getName(); - - public abstract String getEntitySet(); } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractSchema.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractSchema.java index 489b42215..5aee6e202 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractSchema.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractSchema.java @@ -19,110 +19,71 @@ package org.apache.olingo.odata4.client.core.edm; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; +import org.apache.olingo.odata4.client.api.edm.ComplexType; +import org.apache.olingo.odata4.client.api.edm.EntityType; +import org.apache.olingo.odata4.client.api.edm.EnumType; import org.apache.olingo.odata4.client.api.edm.Schema; import org.apache.olingo.odata4.client.core.op.impl.SchemaDeserializer; @JsonDeserialize(using = SchemaDeserializer.class) -public abstract class AbstractSchema, E extends AbstractEntityType, C extends AbstractComplexType, FI extends AbstractFunctionImport> - extends AbstractEdmItem implements Schema { +public abstract class AbstractSchema extends AbstractEdmItem implements Schema { - private static final long serialVersionUID = -1356392748971378455L; + private static final long serialVersionUID = -1356392748971378455L; - private String namespace; + private String namespace; - private String alias; + private String alias; - @Override - public String getNamespace() { - return namespace; + @Override + public String getNamespace() { + return namespace; + } + + @Override + public void setNamespace(final String namespace) { + this.namespace = namespace; + } + + @Override + public String getAlias() { + return alias; + } + + @Override + public void setAlias(final String alias) { + this.alias = alias; + } + + @Override + public EnumType getEnumType(final String name) { + EnumType result = null; + for (EnumType type : getEnumTypes()) { + if (name.equals(type.getName())) { + result = type; + } } + return result; + } - @Override - public void setNamespace(final String namespace) { - this.namespace = namespace; + @Override + public ComplexType getComplexType(final String name) { + ComplexType result = null; + for (ComplexType type : getComplexTypes()) { + if (name.equals(type.getName())) { + result = type; + } } + return result; + } - @Override - public String getAlias() { - return alias; - } - - @Override - public void setAlias(final String alias) { - this.alias = alias; - } - - @Override - public abstract List getEntityTypes(); - - @Override - public abstract List getEnumTypes(); - - @Override - public abstract AbstractEnumType getEnumType(String name); - - @Override - public abstract List getAnnotationsList(); - - @Override - public abstract AbstractAnnotations getAnnotationsList(String target); - - @Override - public abstract List getComplexTypes(); - - @Override - public abstract List getEntityContainers(); - - /** - * Gets default entity container. - * - * @return default entity container. - */ - @Override - public abstract EC getDefaultEntityContainer(); - - /** - * Gets entity container with the given name. - * - * @param name name. - * @return entity container. - */ - @Override - public abstract EC getEntityContainer(String name); - - /** - * Gets entity type with the given name. - * - * @param name name. - * @return entity type. - */ - @Override - public E getEntityType(final String name) { - E result = null; - for (E type : getEntityTypes()) { - if (name.equals(type.getName())) { - result = type; - } - } - return result; - } - - /** - * Gets complex type with the given name. - * - * @param name name. - * @return complex type. - */ - @Override - public C getComplexType(final String name) { - C result = null; - for (C type : getComplexTypes()) { - if (name.equals(type.getName())) { - result = type; - } - } - return result; + @Override + public EntityType getEntityType(final String name) { + EntityType result = null; + for (EntityType type : getEntityTypes()) { + if (name.equals(type.getName())) { + result = type; + } } + return result; + } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/OnDeleteImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/OnDeleteImpl.java index f3ba343ee..5bf83b680 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/OnDeleteImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/OnDeleteImpl.java @@ -20,7 +20,7 @@ package org.apache.olingo.odata4.client.core.edm; import org.apache.olingo.odata4.client.api.edm.v4.OnDeleteAction; import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.olingo.odata4.client.api.edm.OnDelete; +import org.apache.olingo.odata4.client.api.edm.v4.OnDelete; public class OnDeleteImpl extends AbstractEdmItem implements OnDelete { @@ -29,10 +29,12 @@ public class OnDeleteImpl extends AbstractEdmItem implements OnDelete { @JsonProperty(value = "Action", required = true) private OnDeleteAction action = OnDeleteAction.None; + @Override public OnDeleteAction getAction() { return action; } + @Override public void setAction(final OnDeleteAction action) { this.action = action; } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationEndImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationEndImpl.java index ea3b40ee5..fd235ad2e 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationEndImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationEndImpl.java @@ -19,7 +19,7 @@ package org.apache.olingo.odata4.client.core.edm.v3; import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.olingo.odata4.client.api.edm.OnDelete; +import org.apache.olingo.odata4.client.api.edm.v4.OnDelete; import org.apache.olingo.odata4.client.api.edm.v3.AssociationEnd; import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem; diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/DataServicesImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/DataServicesImpl.java index 4272b2c59..2d64109f8 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/DataServicesImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/DataServicesImpl.java @@ -22,8 +22,7 @@ import java.util.ArrayList; import java.util.List; import org.apache.olingo.odata4.client.core.edm.AbstractDataServices; -public class DataServicesImpl extends AbstractDataServices< - SchemaImpl, EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl, FunctionImportImpl> { +public class DataServicesImpl extends AbstractDataServices { private static final long serialVersionUID = 633129618050875211L; diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmMetadataImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmMetadataImpl.java index 29c6f0b45..4076b3537 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmMetadataImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmMetadataImpl.java @@ -19,12 +19,11 @@ package org.apache.olingo.odata4.client.core.edm.v3; import java.io.InputStream; +import java.util.List; import org.apache.olingo.odata4.client.api.ODataClient; import org.apache.olingo.odata4.client.core.edm.AbstractEdmMetadata; -public class EdmMetadataImpl extends AbstractEdmMetadata< - EdmxImpl, DataServicesImpl, SchemaImpl, EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl, - FunctionImportImpl> { +public class EdmMetadataImpl extends AbstractEdmMetadata { private static final long serialVersionUID = -7765327879691528010L; @@ -32,4 +31,20 @@ public class EdmMetadataImpl extends AbstractEdmMetadata< super(client, inputStream); } + @Override + public SchemaImpl getSchema(final int index) { + return (SchemaImpl) super.getSchema(index); + } + + @Override + public SchemaImpl getSchema(final String key) { + return (SchemaImpl) super.getSchema(key); + } + + @Override + @SuppressWarnings("unchecked") + public List getSchemas() { + return (List) super.getSchemas(); + } + } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmTypeImpl.java index a061fa22a..eed924512 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmTypeImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmTypeImpl.java @@ -20,9 +20,7 @@ package org.apache.olingo.odata4.client.core.edm.v3; import org.apache.olingo.odata4.client.core.edm.AbstractEdmType; -public class EdmTypeImpl extends AbstractEdmType< - EdmMetadataImpl, EdmxImpl, DataServicesImpl, SchemaImpl, EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl, - FunctionImportImpl> { +public class EdmTypeImpl extends AbstractEdmType { public EdmTypeImpl(final String typeExpression) { super(typeExpression); @@ -32,4 +30,19 @@ public class EdmTypeImpl extends AbstractEdmType< super(metadata, typeExpression); } + @Override + public EnumTypeImpl getEnumType() { + return (EnumTypeImpl) super.getEnumType(); + } + + @Override + public ComplexTypeImpl getComplexType() { + return (ComplexTypeImpl) super.getComplexType(); + } + + @Override + public EntityTypeImpl getEntityType() { + return (EntityTypeImpl) super.getEntityType(); + } + } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmxImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmxImpl.java index b9ebbc1ad..f0b95cd03 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmxImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmxImpl.java @@ -20,9 +20,13 @@ package org.apache.olingo.odata4.client.core.edm.v3; import org.apache.olingo.odata4.client.core.edm.AbstractEdmx; -public class EdmxImpl extends AbstractEdmx< - DataServicesImpl, SchemaImpl, EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl, FunctionImportImpl> { +public class EdmxImpl extends AbstractEdmx { private static final long serialVersionUID = -8031883176876401375L; + @Override + public DataServicesImpl getDataServices() { + return (DataServicesImpl) super.getDataServices(); + } + } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EntityContainerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EntityContainerImpl.java index f97b97ee0..66362dd2a 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EntityContainerImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EntityContainerImpl.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.List; import org.apache.olingo.odata4.client.core.edm.AbstractEntityContainer; -public class EntityContainerImpl extends AbstractEntityContainer { +public class EntityContainerImpl extends AbstractEntityContainer { private static final long serialVersionUID = 8934431875078180370L; @@ -32,26 +32,31 @@ public class EntityContainerImpl extends AbstractEntityContainer functionImports = new ArrayList(); + @Override + public EntitySetImpl getEntitySet(final String name) { + return (EntitySetImpl) super.getEntitySet(name); + } + @Override public List getEntitySets() { return entitySets; } - @Override - public EntitySetImpl getEntitySet(final String name) { - EntitySetImpl result = null; - for (EntitySetImpl entitySet : getEntitySets()) { - if (name.equals(entitySet.getName())) { - result = entitySet; - } - } - return result; - } - public List getAssociationSets() { return associationSets; } + @Override + public FunctionImportImpl getFunctionImport(final String name) { + return (FunctionImportImpl) super.getFunctionImport(name); + } + + @Override + @SuppressWarnings("unchecked") + public List getFunctionImports(final String name) { + return (List) super.getFunctionImports(name); + } + @Override public List getFunctionImports() { return functionImports; diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EnumTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EnumTypeImpl.java index 45f38cbf1..16eaf0427 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EnumTypeImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EnumTypeImpl.java @@ -35,24 +35,12 @@ public class EnumTypeImpl extends AbstractEnumType { @Override public MemberImpl getMember(final String name) { - MemberImpl result = null; - for (MemberImpl member : getMembers()) { - if (name.equals(member.getName())) { - result = member; - } - } - return result; + return (MemberImpl) super.getMember(name); } @Override public MemberImpl getMember(final Integer value) { - MemberImpl result = null; - for (MemberImpl member : getMembers()) { - if (value.equals(member.getValue())) { - result = member; - } - } - return result; + return (MemberImpl) super.getMember(value); } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/SchemaImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/SchemaImpl.java index f0436ac34..a9f699b0c 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/SchemaImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/SchemaImpl.java @@ -23,8 +23,7 @@ import java.util.List; import org.apache.olingo.odata4.client.api.edm.Schema; import org.apache.olingo.odata4.client.core.edm.AbstractSchema; -public class SchemaImpl extends AbstractSchema - implements Schema { +public class SchemaImpl extends AbstractSchema implements Schema { private static final long serialVersionUID = 4453992249818796144L; @@ -82,22 +81,6 @@ public class SchemaImpl extends AbstractSchema getEnumTypes() { - return enumTypes; - } - - @Override - public EnumTypeImpl getEnumType(final String name) { - EnumTypeImpl result = null; - for (EnumTypeImpl type : getEnumTypes()) { - if (name.equals(type.getName())) { - result = type; - } - } - return result; - } - @Override public List getEntityContainers() { return entityContainers; @@ -126,8 +109,18 @@ public class SchemaImpl extends AbstractSchema getEntityTypes() { - return entityTypes; + public EnumTypeImpl getEnumType(final String name) { + return (EnumTypeImpl) super.getEnumType(name); + } + + @Override + public List getEnumTypes() { + return enumTypes; + } + + @Override + public ComplexTypeImpl getComplexType(final String name) { + return (ComplexTypeImpl) super.getComplexType(name); } @Override @@ -135,4 +128,14 @@ public class SchemaImpl extends AbstractSchema getEntityTypes() { + return entityTypes; + } + } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AbstractAnnotatedEdmItem.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AbstractAnnotatedEdmItem.java index 365cdebb9..77bc1cb07 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AbstractAnnotatedEdmItem.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AbstractAnnotatedEdmItem.java @@ -18,6 +18,7 @@ */ package org.apache.olingo.odata4.client.core.edm.v4; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.olingo.odata4.client.api.edm.v4.Annotation; import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem; @@ -27,16 +28,17 @@ public abstract class AbstractAnnotatedEdmItem extends AbstractEdmItem implement private static final long serialVersionUID = -8859729466090997718L; @JsonProperty("Annotation") - private Annotation annotation; + private AnnotationImpl annotation; @Override - public Annotation getAnnotation() { + public AnnotationImpl getAnnotation() { return annotation; } + @JsonIgnore @Override public void setAnnotation(final Annotation annotation) { - this.annotation = annotation; + this.annotation = (AnnotationImpl) annotation; } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ActionDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ActionDeserializer.java index c8abf8bdd..3cf779f70 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ActionDeserializer.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ActionDeserializer.java @@ -45,12 +45,12 @@ public class ActionDeserializer extends AbstractEdmDeserializer { action.setEntitySetPath(jp.nextTextValue()); } else if ("Parameter".equals(jp.getCurrentName())) { jp.nextToken(); - action.getParameters().add(jp.readValueAs( ParameterImpl.class)); + action.getParameters().add(jp.readValueAs(ParameterImpl.class)); } else if ("ReturnType".equals(jp.getCurrentName())) { action.setReturnType(parseReturnType(jp, "Action")); } else if ("Annotation".equals(jp.getCurrentName())) { jp.nextToken(); - action.setAnnotation(jp.readValueAs( AnnotationImpl.class)); + action.setAnnotation(jp.readValueAs(AnnotationImpl.class)); } } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotatedEdmItem.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotatedEdmItem.java index c0b64b735..7497f5a7d 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotatedEdmItem.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotatedEdmItem.java @@ -22,7 +22,7 @@ import org.apache.olingo.odata4.client.api.edm.v4.Annotation; public interface AnnotatedEdmItem { - Annotation getAnnotation(); + AnnotationImpl getAnnotation(); void setAnnotation(Annotation annotation); } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationDeserializer.java index a88092439..0b318ee89 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationDeserializer.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationDeserializer.java @@ -24,7 +24,7 @@ import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.DeserializationContext; import java.io.IOException; import org.apache.olingo.odata4.client.core.op.impl.AbstractEdmDeserializer; -import org.apache.olingo.odata4.client.core.edm.v4.annotation.DynExprConstruct; +import org.apache.olingo.odata4.client.core.edm.v4.annotation.DynExprConstructImpl; public class AnnotationDeserializer extends AbstractEdmDeserializer { @@ -46,7 +46,7 @@ public class AnnotationDeserializer extends AbstractEdmDeserializer navigationProperties = new ArrayList(); - private Annotation annotation; + private AnnotationImpl annotation; public boolean isAbstractEntityType() { return abstractEntityType; @@ -94,13 +94,13 @@ public class ComplexTypeImpl extends AbstractComplexType implements AnnotatedEdm } @Override - public Annotation getAnnotation() { + public AnnotationImpl getAnnotation() { return annotation; } @Override public void setAnnotation(final Annotation annotation) { - this.annotation = annotation; + this.annotation = (AnnotationImpl) annotation; } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/DataServicesImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/DataServicesImpl.java index 33423a1ae..c64ac8c05 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/DataServicesImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/DataServicesImpl.java @@ -22,8 +22,7 @@ import java.util.ArrayList; import java.util.List; import org.apache.olingo.odata4.client.core.edm.AbstractDataServices; -public class DataServicesImpl extends AbstractDataServices< - SchemaImpl, EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl, FunctionImportImpl> { +public class DataServicesImpl extends AbstractDataServices { private static final long serialVersionUID = -7954360771258897632L; diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmMetadataImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmMetadataImpl.java index b8fc84745..b6bf27cd3 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmMetadataImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmMetadataImpl.java @@ -23,17 +23,31 @@ import java.util.List; import org.apache.olingo.odata4.client.api.ODataClient; import org.apache.olingo.odata4.client.core.edm.AbstractEdmMetadata; -public class EdmMetadataImpl extends AbstractEdmMetadata< - EdmxImpl, DataServicesImpl, SchemaImpl, EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl, - FunctionImportImpl> { +public class EdmMetadataImpl extends AbstractEdmMetadata { - private static final long serialVersionUID = -7765327879691528010L; + private static final long serialVersionUID = -7765327879691528010L; - public EdmMetadataImpl(final ODataClient client, final InputStream inputStream) { - super(client, inputStream); - } + public EdmMetadataImpl(final ODataClient client, final InputStream inputStream) { + super(client, inputStream); + } - public List getReferences() { - return this.edmx.getReferences(); - } + @Override + public SchemaImpl getSchema(final int index) { + return (SchemaImpl) super.getSchema(index); + } + + @Override + public SchemaImpl getSchema(final String key) { + return (SchemaImpl) super.getSchema(key); + } + + @Override + @SuppressWarnings("unchecked") + public List getSchemas() { + return (List) super.getSchemas(); + } + + public List getReferences() { + return ((EdmxImpl) this.edmx).getReferences(); + } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmTypeImpl.java index f4755a19d..6e66c7ece 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmTypeImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmTypeImpl.java @@ -20,9 +20,7 @@ package org.apache.olingo.odata4.client.core.edm.v4; import org.apache.olingo.odata4.client.core.edm.AbstractEdmType; -public class EdmTypeImpl extends AbstractEdmType< - EdmMetadataImpl, EdmxImpl, DataServicesImpl, SchemaImpl, EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl, - FunctionImportImpl> { +public class EdmTypeImpl extends AbstractEdmType { public EdmTypeImpl(final String typeExpression) { super(typeExpression); @@ -32,4 +30,18 @@ public class EdmTypeImpl extends AbstractEdmType< super(metadata, typeExpression); } + @Override + public EnumTypeImpl getEnumType() { + return (EnumTypeImpl) super.getEnumType(); + } + + @Override + public ComplexTypeImpl getComplexType() { + return (ComplexTypeImpl) super.getComplexType(); + } + + @Override + public EntityTypeImpl getEntityType() { + return (EntityTypeImpl) super.getEntityType(); + } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmxImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmxImpl.java index 2663b78c3..18beb3f0d 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmxImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmxImpl.java @@ -22,13 +22,17 @@ import java.util.ArrayList; import java.util.List; import org.apache.olingo.odata4.client.core.edm.AbstractEdmx; -public class EdmxImpl extends AbstractEdmx< - DataServicesImpl, SchemaImpl, EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl, FunctionImportImpl> { +public class EdmxImpl extends AbstractEdmx { private static final long serialVersionUID = -8031883176876401375L; private final List references = new ArrayList(); + @Override + public DataServicesImpl getDataServices() { + return (DataServicesImpl) super.getDataServices(); + } + public List getReferences() { return references; } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntityContainerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntityContainerImpl.java index 7eb6ea8bc..738f92aca 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntityContainerImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntityContainerImpl.java @@ -23,106 +23,111 @@ import java.util.List; import org.apache.olingo.odata4.client.api.edm.v4.Annotation; import org.apache.olingo.odata4.client.core.edm.AbstractEntityContainer; -public class EntityContainerImpl extends AbstractEntityContainer implements AnnotatedEdmItem { +public class EntityContainerImpl extends AbstractEntityContainer implements AnnotatedEdmItem { - private static final long serialVersionUID = 2526002525927260320L; + private static final long serialVersionUID = 2526002525927260320L; - private final List entitySets = new ArrayList(); + private final List entitySets = new ArrayList(); - private final List singletons = new ArrayList(); + private final List singletons = new ArrayList(); - private final List actionImports = new ArrayList(); + private final List actionImports = new ArrayList(); - private final List functionImports = new ArrayList(); + private final List functionImports = new ArrayList(); - private Annotation annotation; + private AnnotationImpl annotation; - @Override - public void setDefaultEntityContainer(final boolean defaultEntityContainer) { - // no action: a single entity container MUST be available as per OData 4.0 + @Override + public void setDefaultEntityContainer(final boolean defaultEntityContainer) { + // no action: a single entity container MUST be available as per OData 4.0 + } + + @Override + public boolean isDefaultEntityContainer() { + return true; + } + + @Override + public EntitySetImpl getEntitySet(final String name) { + return (EntitySetImpl) super.getEntitySet(name); + } + + @Override + public List getEntitySets() { + return entitySets; + } + + public List getSingletons() { + return singletons; + } + + public SingletonImpl getSingleton(final String name) { + SingletonImpl result = null; + for (SingletonImpl singleton : getSingletons()) { + if (name.equals(singleton.getName())) { + result = singleton; + } } + return result; + } - @Override - public boolean isDefaultEntityContainer() { - return true; - } + @Override + public FunctionImportImpl getFunctionImport(final String name) { + return (FunctionImportImpl) super.getFunctionImport(name); + } - @Override - public List getEntitySets() { - return entitySets; - } + @Override + @SuppressWarnings("unchecked") + public List getFunctionImports(final String name) { + return (List) super.getFunctionImports(name); + } - @Override - public EntitySetImpl getEntitySet(final String name) { - EntitySetImpl result = null; - for (EntitySetImpl entitySet : getEntitySets()) { - if (name.equals(entitySet.getName())) { - result = entitySet; - } - } - return result; - } + /** + * Gets the first action import with given name. + * + * @param name name. + * @return action import. + */ + public ActionImportImpl getActionImport(final String name) { + final List actImps = getActionImports(name); + return actImps.isEmpty() + ? null + : actImps.get(0); + } - public List getSingletons() { - return singletons; + /** + * Gets all action imports with given name. + * + * @param name name. + * @return action imports. + */ + public List getActionImports(final String name) { + final List result = new ArrayList(); + for (ActionImportImpl actionImport : getActionImports()) { + if (name.equals(actionImport.getName())) { + result.add(actionImport); + } } + return result; + } - public SingletonImpl getSingleton(final String name) { - SingletonImpl result = null; - for (SingletonImpl singleton : getSingletons()) { - if (name.equals(singleton.getName())) { - result = singleton; - } - } - return result; - } + public List getActionImports() { + return actionImports; + } - /** - * Gets the first action import with given name. - * - * @param name name. - * @return action import. - */ - public ActionImportImpl getActionImport(final String name) { - final List actImps = getActionImports(name); - return actImps.isEmpty() - ? null - : actImps.get(0); - } + @Override + public List getFunctionImports() { + return functionImports; + } - /** - * Gets all action imports with given name. - * - * @param name name. - * @return action imports. - */ - public List getActionImports(final String name) { - final List result = new ArrayList(); - for (ActionImportImpl actionImport : getActionImports()) { - if (name.equals(actionImport.getName())) { - result.add(actionImport); - } - } - return result; - } + @Override + public AnnotationImpl getAnnotation() { + return annotation; + } - public List getActionImports() { - return actionImports; - } - - @Override - public List getFunctionImports() { - return functionImports; - } - - @Override - public Annotation getAnnotation() { - return annotation; - } - - @Override - public void setAnnotation(final Annotation annotation) { - this.annotation = annotation; - } + @Override + public void setAnnotation(final Annotation annotation) { + this.annotation = (AnnotationImpl) annotation; + } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntitySetImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntitySetImpl.java index 33bbe0b7b..1db9c901f 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntitySetImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntitySetImpl.java @@ -30,7 +30,7 @@ public class EntitySetImpl extends AbstractEntitySet implements AnnotatedEdmItem private boolean includeInServiceDocument = true; - private Annotation annotation; + private AnnotationImpl annotation; private final List navigationPropertyBindings = new ArrayList(); @@ -48,13 +48,13 @@ public class EntitySetImpl extends AbstractEntitySet implements AnnotatedEdmItem } @Override - public Annotation getAnnotation() { + public AnnotationImpl getAnnotation() { return annotation; } @Override public void setAnnotation(final Annotation annotation) { - this.annotation = annotation; + this.annotation = (AnnotationImpl) annotation; } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntityTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntityTypeImpl.java index 125f63ddd..1ec06b438 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntityTypeImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntityTypeImpl.java @@ -25,54 +25,54 @@ import org.apache.olingo.odata4.client.core.edm.AbstractEntityType; public class EntityTypeImpl extends AbstractEntityType implements AnnotatedEdmItem { - private static final long serialVersionUID = 8727765036150269547L; + private static final long serialVersionUID = 8727765036150269547L; - private final List properties = new ArrayList(); + private final List properties = new ArrayList(); - private final List navigationProperties = new ArrayList(); + private final List navigationProperties = new ArrayList(); - private Annotation annotation; + private AnnotationImpl annotation; - @Override - public List getProperties() { - return properties; + @Override + public List getProperties() { + return properties; + } + + @Override + public PropertyImpl getProperty(final String name) { + PropertyImpl result = null; + for (PropertyImpl property : getProperties()) { + if (name.equals(property.getName())) { + result = property; + } } + return result; + } - @Override - public PropertyImpl getProperty(final String name) { - PropertyImpl result = null; - for (PropertyImpl property : getProperties()) { - if (name.equals(property.getName())) { - result = property; - } - } - return result; - } + @Override + public List getNavigationProperties() { + return navigationProperties; + } - @Override - public List getNavigationProperties() { - return navigationProperties; + @Override + public NavigationPropertyImpl getNavigationProperty(final String name) { + NavigationPropertyImpl result = null; + for (NavigationPropertyImpl property : getNavigationProperties()) { + if (name.equals(property.getName())) { + result = property; + } } + return result; + } - @Override - public NavigationPropertyImpl getNavigationProperty(final String name) { - NavigationPropertyImpl result = null; - for (NavigationPropertyImpl property : getNavigationProperties()) { - if (name.equals(property.getName())) { - result = property; - } - } - return result; - } + @Override + public AnnotationImpl getAnnotation() { + return annotation; + } - @Override - public Annotation getAnnotation() { - return annotation; - } - - @Override - public void setAnnotation(final Annotation annotation) { - this.annotation = annotation; - } + @Override + public void setAnnotation(final Annotation annotation) { + this.annotation = (AnnotationImpl) annotation; + } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EnumTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EnumTypeImpl.java index 8df023912..5d9fb6ebc 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EnumTypeImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EnumTypeImpl.java @@ -27,7 +27,7 @@ public class EnumTypeImpl extends AbstractEnumType implements AnnotatedEdmItem { private static final long serialVersionUID = -3329664331877556957L; - private Annotation annotation; + private AnnotationImpl annotation; private final List members = new ArrayList(); @@ -38,34 +38,22 @@ public class EnumTypeImpl extends AbstractEnumType implements AnnotatedEdmItem { @Override public MemberImpl getMember(final String name) { - MemberImpl result = null; - for (MemberImpl member : getMembers()) { - if (name.equals(member.getName())) { - result = member; - } - } - return result; + return (MemberImpl) super.getMember(name); } @Override public MemberImpl getMember(final Integer value) { - MemberImpl result = null; - for (MemberImpl member : getMembers()) { - if (value.equals(member.getValue())) { - result = member; - } - } - return result; + return (MemberImpl) super.getMember(value); } @Override - public Annotation getAnnotation() { + public AnnotationImpl getAnnotation() { return annotation; } @Override public void setAnnotation(final Annotation annotation) { - this.annotation = annotation; + this.annotation = (AnnotationImpl) annotation; } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionDeserializer.java index 7dfe50b5d..0c4f8b986 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionDeserializer.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionDeserializer.java @@ -47,12 +47,12 @@ public class FunctionDeserializer extends AbstractEdmDeserializer function.setEntitySetPath(jp.nextTextValue()); } else if ("Parameter".equals(jp.getCurrentName())) { jp.nextToken(); - function.getParameters().add(jp.readValueAs( ParameterImpl.class)); + function.getParameters().add(jp.readValueAs(ParameterImpl.class)); } else if ("ReturnType".equals(jp.getCurrentName())) { function.setReturnType(parseReturnType(jp, "Function")); } else if ("Annotation".equals(jp.getCurrentName())) { jp.nextToken(); - function.setAnnotation(jp.readValueAs( AnnotationImpl.class)); + function.setAnnotation(jp.readValueAs(AnnotationImpl.class)); } } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionImportImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionImportImpl.java index bf9ad53e1..5a40bca8a 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionImportImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionImportImpl.java @@ -18,6 +18,7 @@ */ package org.apache.olingo.odata4.client.core.edm.v4; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.olingo.odata4.client.api.edm.v4.Annotation; import org.apache.olingo.odata4.client.core.edm.AbstractFunctionImport; @@ -39,7 +40,7 @@ public class FunctionImportImpl extends AbstractFunctionImport implements Annota private boolean includeInServiceDocument = false; @JsonProperty(value = "Annotation") - private Annotation annotation; + private AnnotationImpl annotation; @Override public String getName() { @@ -76,13 +77,14 @@ public class FunctionImportImpl extends AbstractFunctionImport implements Annota } @Override - public Annotation getAnnotation() { + public AnnotationImpl getAnnotation() { return annotation; } + @JsonIgnore @Override public void setAnnotation(final Annotation annotation) { - this.annotation = annotation; + this.annotation = (AnnotationImpl) annotation; } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/MemberImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/MemberImpl.java index 15e853389..39383fad4 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/MemberImpl.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/MemberImpl.java @@ -18,6 +18,7 @@ */ package org.apache.olingo.odata4.client.core.edm.v4; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.olingo.odata4.client.api.edm.Member; import org.apache.olingo.odata4.client.api.edm.v4.Annotation; @@ -28,16 +29,17 @@ public class MemberImpl extends AbstractMember implements Member, AnnotatedEdmIt private static final long serialVersionUID = -344920557183058824L; @JsonProperty("Annotation") - private Annotation annotation; + private AnnotationImpl annotation; @Override - public Annotation getAnnotation() { + public AnnotationImpl getAnnotation() { return annotation; } + @JsonIgnore @Override public void setAnnotation(final Annotation annotation) { - this.annotation = annotation; + this.annotation = (AnnotationImpl) annotation; } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/NavigationPropertyDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/NavigationPropertyDeserializer.java index 1a195eac8..1c19b21e3 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/NavigationPropertyDeserializer.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/NavigationPropertyDeserializer.java @@ -50,13 +50,13 @@ public class NavigationPropertyDeserializer extends AbstractEdmDeserializer - implements Schema, AnnotatedEdmItem { +public class SchemaImpl extends AbstractSchema implements Schema, AnnotatedEdmItem { private static final long serialVersionUID = 4453992249818796144L; @@ -50,7 +49,7 @@ public class SchemaImpl extends AbstractSchema typeDefinitions = new ArrayList(); - private Annotation annotation; + private AnnotationImpl annotation; public List getActions() { return actions; @@ -86,22 +85,6 @@ public class SchemaImpl extends AbstractSchema getEnumTypes() { - return enumTypes; - } - - @Override - public EnumTypeImpl getEnumType(final String name) { - EnumTypeImpl result = null; - for (EnumTypeImpl type : getEnumTypes()) { - if (name.equals(type.getName())) { - result = type; - } - } - return result; - } - public List getFunctions() { return functions; } @@ -152,8 +135,28 @@ public class SchemaImpl extends AbstractSchema getEntityTypes() { - return entityTypes; + public AnnotationImpl getAnnotation() { + return annotation; + } + + @Override + public void setAnnotation(final Annotation annotation) { + this.annotation = (AnnotationImpl) annotation; + } + + @Override + public EnumTypeImpl getEnumType(final String name) { + return (EnumTypeImpl) super.getEnumType(name); + } + + @Override + public List getEnumTypes() { + return enumTypes; + } + + @Override + public ComplexTypeImpl getComplexType(final String name) { + return (ComplexTypeImpl) super.getComplexType(name); } @Override @@ -162,12 +165,12 @@ public class SchemaImpl extends AbstractSchema getEntityTypes() { + return entityTypes; } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/SingletonDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/SingletonDeserializer.java index e5520ca57..89fe59e4f 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/SingletonDeserializer.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/SingletonDeserializer.java @@ -43,10 +43,10 @@ public class SingletonDeserializer extends AbstractEdmDeserializer { } } else if ("Annotation".equals(jp.getCurrentName())) { jp.nextToken(); - term.setAnnotation(jp.readValueAs( AnnotationImpl.class)); + term.setAnnotation(jp.readValueAs(AnnotationImpl.class)); } } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AbstractElOrAttrConstruct.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AbstractElOrAttrConstruct.java index f8e772575..8f3365f34 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AbstractElOrAttrConstruct.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AbstractElOrAttrConstruct.java @@ -21,7 +21,7 @@ package org.apache.olingo.odata4.client.core.edm.v4.annotation; /** * Groups dynamic expressions that may be provided using element notation or attribute notation. */ -abstract class AbstractElOrAttrConstruct extends DynExprConstruct { +abstract class AbstractElOrAttrConstruct extends DynExprConstructImpl { private static final long serialVersionUID = 5503275111425750339L; diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotatedDynExprConstruct.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotatedDynExprConstruct.java index 1f9adfb09..1fa7f84be 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotatedDynExprConstruct.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotatedDynExprConstruct.java @@ -20,20 +20,21 @@ package org.apache.olingo.odata4.client.core.edm.v4.annotation; import org.apache.olingo.odata4.client.api.edm.v4.Annotation; import org.apache.olingo.odata4.client.core.edm.v4.AnnotatedEdmItem; +import org.apache.olingo.odata4.client.core.edm.v4.AnnotationImpl; -public abstract class AnnotatedDynExprConstruct extends DynExprConstruct implements AnnotatedEdmItem { +abstract class AnnotatedDynExprConstruct extends DynExprConstructImpl implements AnnotatedEdmItem { private static final long serialVersionUID = -8117155475397749038L; - private Annotation annotation; + private AnnotationImpl annotation; @Override - public Annotation getAnnotation() { + public AnnotationImpl getAnnotation() { return annotation; } @Override public void setAnnotation(final Annotation annotation) { - this.annotation = annotation; + this.annotation = (AnnotationImpl) annotation; } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Apply.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Apply.java index 3f05ec1e5..9c5b9c75b 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Apply.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Apply.java @@ -35,7 +35,7 @@ public class Apply extends AnnotatedDynExprConstruct { private String function; - private final List parameters = new ArrayList(); + private final List parameters = new ArrayList(); public String getFunction() { return function; @@ -45,7 +45,7 @@ public class Apply extends AnnotatedDynExprConstruct { this.function = function; } - public List getParameters() { + public List getParameters() { return parameters; } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ApplyDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ApplyDeserializer.java index 9d0306850..f65b7fa83 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ApplyDeserializer.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ApplyDeserializer.java @@ -40,11 +40,11 @@ public class ApplyDeserializer extends AbstractEdmDeserializer { if ("Function".equals(jp.getCurrentName())) { apply.setFunction(jp.nextTextValue()); } else if ("Annotation".equals(jp.getCurrentName())) { - apply.setAnnotation(jp.readValueAs( AnnotationImpl.class)); + apply.setAnnotation(jp.readValueAs(AnnotationImpl.class)); } else if (isAnnotationConstExprConstruct(jp)) { apply.getParameters().add(parseAnnotationConstExprConstruct(jp)); } else { - apply.getParameters().add(jp.readValueAs( DynExprConstruct.class)); + apply.getParameters().add(jp.readValueAs(DynExprConstructImpl.class)); } } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Cast.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Cast.java index efb00d496..6085ba0c3 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Cast.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Cast.java @@ -36,7 +36,7 @@ public class Cast extends AnnotatedDynExprConstruct { private String srid; - private DynExprConstruct value; + private DynExprConstructImpl value; public String getType() { return type; @@ -78,11 +78,11 @@ public class Cast extends AnnotatedDynExprConstruct { this.srid = srid; } - public DynExprConstruct getValue() { + public DynExprConstructImpl getValue() { return value; } - public void setValue(final DynExprConstruct value) { + public void setValue(final DynExprConstructImpl value) { this.value = value; } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CastDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CastDeserializer.java index 3219776bf..b97c5e5c2 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CastDeserializer.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CastDeserializer.java @@ -41,7 +41,7 @@ public class CastDeserializer extends AbstractEdmDeserializer { if ("Type".equals(jp.getCurrentName())) { cast.setType(jp.nextTextValue()); } else if ("Annotation".equals(jp.getCurrentName())) { - cast.setAnnotation(jp.readValueAs( AnnotationImpl.class)); + cast.setAnnotation(jp.readValueAs(AnnotationImpl.class)); } else if ("MaxLength".equals(jp.getCurrentName())) { cast.setMaxLength(jp.nextTextValue()); } else if ("Precision".equals(jp.getCurrentName())) { @@ -51,7 +51,7 @@ public class CastDeserializer extends AbstractEdmDeserializer { } else if ("SRID".equals(jp.getCurrentName())) { cast.setSrid(jp.nextTextValue()); } else { - cast.setValue(jp.readValueAs( DynExprConstruct.class)); + cast.setValue(jp.readValueAs(DynExprConstructImpl.class)); } } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Collection.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Collection.java index dd2efb7ed..a23604cba 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Collection.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Collection.java @@ -23,13 +23,13 @@ import java.util.ArrayList; import java.util.List; @JsonDeserialize(using = CollectionDeserializer.class) -public class Collection extends DynExprConstruct { +public class Collection extends DynExprConstructImpl { private static final long serialVersionUID = -4975881520695477686L; - private final List items = new ArrayList(); + private final List items = new ArrayList(); - public List getItems() { + public List getItems() { return items; } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CollectionDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CollectionDeserializer.java index 986a22ae8..a16748fd8 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CollectionDeserializer.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CollectionDeserializer.java @@ -39,7 +39,7 @@ public class CollectionDeserializer extends AbstractEdmDeserializer if (isAnnotationConstExprConstruct(jp)) { collection.getItems().add(parseAnnotationConstExprConstruct(jp)); } else { - collection.getItems().add(jp.readValueAs( DynExprConstruct.class)); + collection.getItems().add(jp.readValueAs( DynExprConstructImpl.class)); } } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ConstExprConstruct.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ConstExprConstructImpl.java similarity index 72% rename from odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ConstExprConstruct.java rename to odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ConstExprConstructImpl.java index d7ff53b43..51b62443e 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ConstExprConstruct.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ConstExprConstructImpl.java @@ -18,52 +18,32 @@ */ package org.apache.olingo.odata4.client.core.edm.v4.annotation; -public class ConstExprConstruct extends ExprConstruct { +import org.apache.olingo.odata4.client.api.edm.v4.annotation.ConstExprConstruct; + +public class ConstExprConstructImpl extends ExprConstructImpl implements ConstExprConstruct { private static final long serialVersionUID = 2250072064504668969L; - public enum Type { - - Binary, - Bool, - Date, - DateTimeOffset, - Decimal, - Duration, - EnumMember, - Float, - Guid, - Int, - String, - TimeOfDay; - - public static Type fromString(final String value) { - Type result = null; - try { - result = valueOf(value); - } catch (IllegalArgumentException e) { - // ignore - } - return result; - } - } - private Type type; private String value; + @Override public Type getType() { return type; } + @Override public void setType(final Type type) { this.type = type; } + @Override public String getValue() { return value; } + @Override public void setValue(final String value) { this.value = value; } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprConstructDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprConstructDeserializer.java index 3f8088144..d3d4fd42e 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprConstructDeserializer.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprConstructDeserializer.java @@ -28,7 +28,7 @@ import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ClassUtils; import org.apache.olingo.odata4.client.core.op.impl.AbstractEdmDeserializer; -public class DynExprConstructDeserializer extends AbstractEdmDeserializer { +public class DynExprConstructDeserializer extends AbstractEdmDeserializer { private static final String[] EL_OR_ATTR = { AnnotationPath.class.getSimpleName(), Path.class.getSimpleName() }; @@ -62,12 +62,12 @@ public class DynExprConstructDeserializer extends AbstractEdmDeserializer { if ("Type".equals(jp.getCurrentName())) { isof.setType(jp.nextTextValue()); } else if ("Annotation".equals(jp.getCurrentName())) { - isof.setAnnotation(jp.readValueAs( AnnotationImpl.class)); + isof.setAnnotation(jp.readValueAs(AnnotationImpl.class)); } else if ("MaxLength".equals(jp.getCurrentName())) { isof.setMaxLength(jp.nextTextValue()); } else if ("Precision".equals(jp.getCurrentName())) { @@ -51,7 +51,7 @@ public class IsOfDeserializer extends AbstractEdmDeserializer { } else if ("SRID".equals(jp.getCurrentName())) { isof.setSrid(jp.nextTextValue()); } else { - isof.setValue(jp.readValueAs( DynExprConstruct.class)); + isof.setValue(jp.readValueAs(DynExprConstructImpl.class)); } } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElement.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElement.java index cfd492986..318347f24 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElement.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElement.java @@ -27,7 +27,7 @@ public class LabeledElement extends AnnotatedDynExprConstruct { private String name; - private DynExprConstruct value; + private DynExprConstructImpl value; public String getName() { return name; @@ -37,11 +37,11 @@ public class LabeledElement extends AnnotatedDynExprConstruct { this.name = name; } - public DynExprConstruct getValue() { + public DynExprConstructImpl getValue() { return value; } - public void setValue(final DynExprConstruct value) { + public void setValue(final DynExprConstructImpl value) { this.value = value; } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElementDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElementDeserializer.java index 1f238b754..4ae9f648a 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElementDeserializer.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElementDeserializer.java @@ -40,9 +40,9 @@ public class LabeledElementDeserializer extends AbstractEdmDeserializer { final JsonToken token = jp.getCurrentToken(); if (token == JsonToken.FIELD_NAME) { if ("Annotation".equals(jp.getCurrentName())) { - _null.setAnnotation(jp.readValueAs( AnnotationImpl.class)); + _null.setAnnotation(jp.readValueAs(AnnotationImpl.class)); } } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyValue.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyValue.java index 5bbdc06ff..fab382982 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyValue.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyValue.java @@ -27,7 +27,7 @@ public class PropertyValue extends AnnotatedDynExprConstruct { private String property; - private ExprConstruct value; + private ExprConstructImpl value; public String getProperty() { return property; @@ -37,11 +37,11 @@ public class PropertyValue extends AnnotatedDynExprConstruct { this.property = property; } - public ExprConstruct getValue() { + public ExprConstructImpl getValue() { return value; } - public void setValue(final ExprConstruct value) { + public void setValue(final ExprConstructImpl value) { this.value = value; } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyValueDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyValueDeserializer.java index 0e48dfcc1..af2ffb58c 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyValueDeserializer.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyValueDeserializer.java @@ -40,11 +40,11 @@ public class PropertyValueDeserializer extends AbstractEdmDeserializer { if ("Tyoe".equals(jp.getCurrentName())) { record.setType(jp.nextTextValue()); } else if ("Annotation".equals(jp.getCurrentName())) { - record.setAnnotation(jp.readValueAs( AnnotationImpl.class)); + record.setAnnotation(jp.readValueAs(AnnotationImpl.class)); } else { - record.getPropertyValues().add(jp.readValueAs( PropertyValue.class)); + record.getPropertyValues().add(jp.readValueAs(PropertyValue.class)); } } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/UrlRef.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/UrlRef.java index 164ddfe56..5cc0f9b5e 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/UrlRef.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/UrlRef.java @@ -21,17 +21,17 @@ package org.apache.olingo.odata4.client.core.edm.v4.annotation; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @JsonDeserialize(using = UrlRefDeserializer.class) -public class UrlRef extends DynExprConstruct { +public class UrlRef extends DynExprConstructImpl { private static final long serialVersionUID = 3755101394647430897L; - private ExprConstruct value; + private ExprConstructImpl value; - public ExprConstruct getValue() { + public ExprConstructImpl getValue() { return value; } - public void setValue(final ExprConstruct value) { + public void setValue(final ExprConstructImpl value) { this.value = value; } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/UrlRefDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/UrlRefDeserializer.java index b37c3e846..de91b7cd8 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/UrlRefDeserializer.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/UrlRefDeserializer.java @@ -39,7 +39,7 @@ public class UrlRefDeserializer extends AbstractEdmDeserializer { if (isAnnotationConstExprConstruct(jp)) { urlref.setValue(parseAnnotationConstExprConstruct(jp)); } else { - urlref.setValue(jp.readValueAs( DynExprConstruct.class)); + urlref.setValue(jp.readValueAs( DynExprConstructImpl.class)); } } } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/AbstractEdmDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/AbstractEdmDeserializer.java index 6e6e10339..c6b5bba0c 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/AbstractEdmDeserializer.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/AbstractEdmDeserializer.java @@ -26,19 +26,19 @@ import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser; import java.io.IOException; import org.apache.olingo.odata4.client.api.ODataClient; import org.apache.olingo.odata4.client.core.edm.v4.ReturnTypeImpl; -import org.apache.olingo.odata4.client.core.edm.v4.annotation.ConstExprConstruct; +import org.apache.olingo.odata4.client.core.edm.v4.annotation.ConstExprConstructImpl; public abstract class AbstractEdmDeserializer extends JsonDeserializer { protected ODataClient client; protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException { - return ConstExprConstruct.Type.fromString(jp.getCurrentName()) != null; + return ConstExprConstructImpl.Type.fromString(jp.getCurrentName()) != null; } - protected ConstExprConstruct parseAnnotationConstExprConstruct(final JsonParser jp) throws IOException { - final ConstExprConstruct constExpr = new ConstExprConstruct(); - constExpr.setType(ConstExprConstruct.Type.fromString(jp.getCurrentName())); + protected ConstExprConstructImpl parseAnnotationConstExprConstruct(final JsonParser jp) throws IOException { + final ConstExprConstructImpl constExpr = new ConstExprConstructImpl(); + constExpr.setType(ConstExprConstructImpl.Type.fromString(jp.getCurrentName())); constExpr.setValue(jp.nextTextValue()); return constExpr; } diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/ComplexTypeDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/ComplexTypeDeserializer.java index 511bdb13b..81bbd48d9 100644 --- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/ComplexTypeDeserializer.java +++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/ComplexTypeDeserializer.java @@ -71,7 +71,7 @@ public class ComplexTypeDeserializer extends AbstractEdmDeserializer functionImports - = metadata.getSchemas().get(0).getDefaultEntityContainer().getFunctionImports(); + final List functionImports = metadata.getSchemas().get(0). + getDefaultEntityContainer().getFunctionImports(); int legacyGetters = 0; int legacyPosters = 0; int actions = 0; diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/v4/MetadataTest.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/v4/MetadataTest.java index e11986125..b3c20926e 100644 --- a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/v4/MetadataTest.java +++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/v4/MetadataTest.java @@ -44,7 +44,7 @@ import org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl; import org.apache.olingo.odata4.client.core.edm.v4.SingletonImpl; import org.apache.olingo.odata4.client.core.edm.v4.annotation.Apply; import org.apache.olingo.odata4.client.core.edm.v4.annotation.Collection; -import org.apache.olingo.odata4.client.core.edm.v4.annotation.ConstExprConstruct; +import org.apache.olingo.odata4.client.core.edm.v4.annotation.ConstExprConstructImpl; import org.apache.olingo.odata4.client.core.edm.v4.annotation.Path; import org.apache.olingo.odata4.commons.api.edm.constants.StoreGeneratedPattern; import org.junit.Test; @@ -127,7 +127,7 @@ public class MetadataTest extends AbstractTest { AnnotationsImpl annots = metadata.getSchema(0).getAnnotationsList("ODataDemo.DemoService/Suppliers"); assertNotNull(annots); assertFalse(annots.getAnnotations().isEmpty()); - assertEquals(ConstExprConstruct.Type.String, + assertEquals(ConstExprConstructImpl.Type.String, annots.getAnnotation("Org.OData.Publication.V1.PrivacyPolicyUrl").getConstExpr().getType()); assertEquals("http://www.odata.org/", annots.getAnnotation("Org.OData.Publication.V1.PrivacyPolicyUrl").getConstExpr().getValue()); @@ -225,8 +225,8 @@ public class MetadataTest extends AbstractTest { firstArg.setValue("Name"); assertEquals(firstArg, apply.getParameters().get(0)); - final ConstExprConstruct secondArg = new ConstExprConstruct(); - secondArg.setType(ConstExprConstruct.Type.String); + final ConstExprConstructImpl secondArg = new ConstExprConstructImpl(); + secondArg.setType(ConstExprConstructImpl.Type.String); secondArg.setValue(" in "); assertEquals(secondArg, apply.getParameters().get(1)); @@ -244,8 +244,8 @@ public class MetadataTest extends AbstractTest { assertTrue(tags.getDynExpr() instanceof Collection); final Collection collection = (Collection) tags.getDynExpr(); assertEquals(1, collection.getItems().size()); - assertEquals(ConstExprConstruct.Type.String, ((ConstExprConstruct) collection.getItems().get(0)).getType()); - assertEquals("MasterData", ((ConstExprConstruct) collection.getItems().get(0)).getValue()); + assertEquals(ConstExprConstructImpl.Type.String, ((ConstExprConstructImpl) collection.getItems().get(0)).getType()); + assertEquals("MasterData", ((ConstExprConstructImpl) collection.getItems().get(0)).getValue()); } /**