Removing unneeded type genericization after interface introduction

This commit is contained in:
Francesco Chicchiriccò 2014-02-24 13:32:53 +01:00
parent a9bc09d930
commit 07400abc4a
84 changed files with 775 additions and 572 deletions

View File

@ -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<? extends Schema> getSchemas();
}

View File

@ -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);
}

View File

@ -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<? extends EntitySet> getEntitySets();
EntitySet getEntitySet(String name);
List<? extends FunctionImport> getFunctionImports();
}

View File

@ -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);
}

View File

@ -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<? extends NavigationProperty> getNavigationProperties();
NavigationProperty getNavigationProperty(String name);
}

View File

@ -20,4 +20,7 @@ package org.apache.olingo.odata4.client.api.edm;
public interface FunctionImport {
String getName();
String getEntitySet();
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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 {
}

View File

@ -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<S extends AbstractSchema<EC, E, C, FI>, 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<S extends AbstractSchema<EC, E, C, FI
private String maxDataServiceVersion;
@Override
public String getDataServiceVersion() {
return dataServiceVersion;
}
@Override
public void setDataServiceVersion(final String dataServiceVersion) {
this.dataServiceVersion = dataServiceVersion;
}
@Override
public String getMaxDataServiceVersion() {
return maxDataServiceVersion;
}
@Override
public void setMaxDataServiceVersion(final String maxDataServiceVersion) {
this.maxDataServiceVersion = maxDataServiceVersion;
}
public abstract List<S> getSchemas();
}

View File

@ -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, S, EC, E, C, FI>, DS extends AbstractDataServices<
S, EC, E, C, FI>, S extends AbstractSchema<EC, E, C, FI>, 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<String, S> schemaByNsOrAlias;
protected final Map<String, Schema> 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<String, S>();
for (S schema : edmx.getDataServices().getSchemas()) {
this.schemaByNsOrAlias = new HashMap<String, Schema>();
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<S> getSchemas() {
public List<? extends Schema> getSchemas() {
return this.edmx.getDataServices().getSchemas();
}

View File

@ -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<META extends AbstractEdmMetadata<
EDMX, DS, S, EC, E, C, FI>, EDMX extends AbstractEdmx<DS, S, EC, E, C, FI>, DS extends AbstractDataServices<
S, EC, E, C, FI>, S extends AbstractSchema<EC, E, C, FI>, 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 AbstractEdmType<META extends AbstractEdmMetadata<
private EdmSimpleType simpleType;
private AbstractEnumType enumType;
private EnumType enumType;
private C complexType;
private ComplexType complexType;
private E entityType;
private EntityType entityType;
/**
* Constructor.
@ -63,7 +64,7 @@ public abstract class AbstractEdmType<META extends AbstractEdmMetadata<
* @param metadata metadata.
* @param typeExpression type expression.
*/
public AbstractEdmType(final META metadata, final String typeExpression) {
public AbstractEdmType(final EdmMetadata metadata, final String typeExpression) {
this.typeExpression = typeExpression;
final int collectionStartIdx = typeExpression.indexOf("Collection(");
@ -95,21 +96,21 @@ public abstract class AbstractEdmType<META extends AbstractEdmMetadata<
if (!metadata.isNsOrAlias(namespaceOrAlias)) {
throw new IllegalArgumentException("Illegal namespace or alias: " + namespaceOrAlias);
}
final S schema = metadata.getSchema(namespaceOrAlias);
final Schema schema = metadata.getSchema(namespaceOrAlias);
for (AbstractEnumType type : schema.getEnumTypes()) {
for (EnumType type : schema.getEnumTypes()) {
if (typeName.equals(type.getName())) {
this.enumType = type;
}
}
if (this.enumType == null) {
for (C type : schema.getComplexTypes()) {
for (ComplexType type : schema.getComplexTypes()) {
if (typeName.equals(type.getName())) {
this.complexType = type;
}
}
if (this.complexType == null) {
for (E type : schema.getEntityTypes()) {
for (EntityType type : schema.getEntityTypes()) {
if (typeName.equals(type.getName())) {
this.entityType = type;
}
@ -173,7 +174,7 @@ public abstract class AbstractEdmType<META extends AbstractEdmMetadata<
* @return enum type. An <tt>EdmTypeNotFoundException</tt> 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 AbstractEdmType<META extends AbstractEdmMetadata<
* @return complex type. An <tt>EdmTypeNotFoundException</tt> 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 AbstractEdmType<META extends AbstractEdmMetadata<
* @return entity type. An <tt>EdmTypeNotFoundException</tt> 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);
}

View File

@ -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<DS extends AbstractDataServices<S, EC, E, C, FI>, 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;
}
}

View File

@ -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<FI extends AbstractFunctionImport>
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<FI extends AbstractFunctionImport>
this.defaultEntityContainer = defaultEntityContainer;
}
public abstract List<? extends AbstractEntitySet> 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<FI extends AbstractFunctionImport>
* @param name name.
* @return function import.
*/
public FI getFunctionImport(final String name) {
final List<FI> funcImps = getFunctionImports(name);
public FunctionImport getFunctionImport(final String name) {
final List<? extends FunctionImport> funcImps = getFunctionImports(name);
return funcImps.isEmpty()
? null
: funcImps.get(0);
@ -93,15 +101,13 @@ public abstract class AbstractEntityContainer<FI extends AbstractFunctionImport>
* @param name name.
* @return function imports.
*/
public List<FI> getFunctionImports(final String name) {
final List<FI> result = new ArrayList<FI>();
for (FI functionImport : getFunctionImports()) {
public List<? extends FunctionImport> getFunctionImports(final String name) {
final List<FunctionImport> result = new ArrayList<FunctionImport>();
for (FunctionImport functionImport : getFunctionImports()) {
if (name.equals(functionImport.getName())) {
result.add(functionImport);
}
}
return result;
}
public abstract List<FI> getFunctionImports();
}

View File

@ -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;
}

View File

@ -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<? extends AbstractNavigationProperty> getNavigationProperties();
public abstract AbstractNavigationProperty getNavigationProperty(String name);
}

View File

@ -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;
}
}

View File

@ -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();
}

View File

@ -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<EC extends AbstractEntityContainer<
FI>, 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<E> getEntityTypes();
@Override
public abstract List<? extends AbstractEnumType> getEnumTypes();
@Override
public abstract AbstractEnumType getEnumType(String name);
@Override
public abstract List<? extends AbstractAnnotations> getAnnotationsList();
@Override
public abstract AbstractAnnotations getAnnotationsList(String target);
@Override
public abstract List<C> getComplexTypes();
@Override
public abstract List<EC> 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;
}
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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<SchemaImpl> getSchemas() {
return (List<SchemaImpl>) super.getSchemas();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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<FunctionImportImpl> {
public class EntityContainerImpl extends AbstractEntityContainer {
private static final long serialVersionUID = 8934431875078180370L;
@ -32,26 +32,31 @@ public class EntityContainerImpl extends AbstractEntityContainer<FunctionImportI
private final List<FunctionImportImpl> functionImports = new ArrayList<FunctionImportImpl>();
@Override
public EntitySetImpl getEntitySet(final String name) {
return (EntitySetImpl) super.getEntitySet(name);
}
@Override
public List<EntitySetImpl> 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<AssociationSetImpl> getAssociationSets() {
return associationSets;
}
@Override
public FunctionImportImpl getFunctionImport(final String name) {
return (FunctionImportImpl) super.getFunctionImport(name);
}
@Override
@SuppressWarnings("unchecked")
public List<FunctionImportImpl> getFunctionImports(final String name) {
return (List<FunctionImportImpl>) super.getFunctionImports(name);
}
@Override
public List<FunctionImportImpl> getFunctionImports() {
return functionImports;

View File

@ -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);
}
}

View File

@ -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<EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl, FunctionImportImpl>
implements Schema {
public class SchemaImpl extends AbstractSchema implements Schema {
private static final long serialVersionUID = 4453992249818796144L;
@ -82,22 +81,6 @@ public class SchemaImpl extends AbstractSchema<EntityContainerImpl, EntityTypeIm
return valueTerms;
}
@Override
public List<EnumTypeImpl> 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<EntityContainerImpl> getEntityContainers() {
return entityContainers;
@ -126,8 +109,18 @@ public class SchemaImpl extends AbstractSchema<EntityContainerImpl, EntityTypeIm
}
@Override
public List<EntityTypeImpl> getEntityTypes() {
return entityTypes;
public EnumTypeImpl getEnumType(final String name) {
return (EnumTypeImpl) super.getEnumType(name);
}
@Override
public List<EnumTypeImpl> 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<EntityContainerImpl, EntityTypeIm
return complexTypes;
}
@Override
public EntityTypeImpl getEntityType(final String name) {
return (EntityTypeImpl) super.getEntityType(name);
}
@Override
public List<EntityTypeImpl> getEntityTypes() {
return entityTypes;
}
}

View File

@ -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;
}
}

View File

@ -45,12 +45,12 @@ public class ActionDeserializer extends AbstractEdmDeserializer<ActionImpl> {
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));
}
}
}

View File

@ -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);
}

View File

@ -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<AnnotationImpl> {
@ -46,7 +46,7 @@ public class AnnotationDeserializer extends AbstractEdmDeserializer<AnnotationIm
annotation.setConstExpr(parseAnnotationConstExprConstruct(jp));
} else {
// Dynamic Expressions
annotation.setDynExpr(jp.readValueAs( DynExprConstruct.class));
annotation.setDynExpr(jp.readValueAs( DynExprConstructImpl.class));
}
}
}

View File

@ -20,9 +20,11 @@ package org.apache.olingo.odata4.client.core.edm.v4;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
import org.apache.olingo.odata4.client.api.edm.v4.annotation.ConstExprConstruct;
import org.apache.olingo.odata4.client.api.edm.v4.annotation.DynExprConstruct;
import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
import org.apache.olingo.odata4.client.core.edm.v4.annotation.ConstExprConstruct;
import org.apache.olingo.odata4.client.core.edm.v4.annotation.DynExprConstruct;
import org.apache.olingo.odata4.client.core.edm.v4.annotation.ConstExprConstructImpl;
import org.apache.olingo.odata4.client.core.edm.v4.annotation.DynExprConstructImpl;
@JsonDeserialize(using = AnnotationDeserializer.class)
public class AnnotationImpl extends AbstractEdmItem implements Annotation {
@ -33,40 +35,48 @@ public class AnnotationImpl extends AbstractEdmItem implements Annotation {
private String qualifier;
private ConstExprConstruct constExpr;
private ConstExprConstructImpl constExpr;
private DynExprConstruct dynExpr;
private DynExprConstructImpl dynExpr;
@Override
public String getTerm() {
return term;
}
@Override
public void setTerm(final String term) {
this.term = term;
}
@Override
public String getQualifier() {
return qualifier;
}
@Override
public void setQualifier(final String qualifier) {
this.qualifier = qualifier;
}
public ConstExprConstruct getConstExpr() {
@Override
public ConstExprConstructImpl getConstExpr() {
return constExpr;
}
@Override
public void setConstExpr(final ConstExprConstruct constExpr) {
this.constExpr = constExpr;
this.constExpr = (ConstExprConstructImpl) constExpr;
}
public DynExprConstruct getDynExpr() {
@Override
public DynExprConstructImpl getDynExpr() {
return dynExpr;
}
@Override
public void setDynExpr(final DynExprConstruct dynExpr) {
this.dynExpr = dynExpr;
this.dynExpr = (DynExprConstructImpl) dynExpr;
}
}

View File

@ -21,6 +21,7 @@ package org.apache.olingo.odata4.client.core.edm.v4;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.List;
import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
import org.apache.olingo.odata4.client.api.edm.v4.Annotations;
import org.apache.olingo.odata4.client.core.edm.AbstractAnnotations;

View File

@ -37,7 +37,7 @@ public class ComplexTypeImpl extends AbstractComplexType implements AnnotatedEdm
private final List<NavigationPropertyImpl> navigationProperties = new ArrayList<NavigationPropertyImpl>();
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;
}
}

View File

@ -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;

View File

@ -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<ReferenceImpl> 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<SchemaImpl> getSchemas() {
return (List<SchemaImpl>) super.getSchemas();
}
public List<ReferenceImpl> getReferences() {
return ((EdmxImpl) this.edmx).getReferences();
}
}

View File

@ -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();
}
}

View File

@ -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<ReferenceImpl> references = new ArrayList<ReferenceImpl>();
@Override
public DataServicesImpl getDataServices() {
return (DataServicesImpl) super.getDataServices();
}
public List<ReferenceImpl> getReferences() {
return references;
}

View File

@ -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<FunctionImportImpl> implements AnnotatedEdmItem {
public class EntityContainerImpl extends AbstractEntityContainer implements AnnotatedEdmItem {
private static final long serialVersionUID = 2526002525927260320L;
private static final long serialVersionUID = 2526002525927260320L;
private final List<EntitySetImpl> entitySets = new ArrayList<EntitySetImpl>();
private final List<EntitySetImpl> entitySets = new ArrayList<EntitySetImpl>();
private final List<SingletonImpl> singletons = new ArrayList<SingletonImpl>();
private final List<SingletonImpl> singletons = new ArrayList<SingletonImpl>();
private final List<ActionImportImpl> actionImports = new ArrayList<ActionImportImpl>();
private final List<ActionImportImpl> actionImports = new ArrayList<ActionImportImpl>();
private final List<FunctionImportImpl> functionImports = new ArrayList<FunctionImportImpl>();
private final List<FunctionImportImpl> functionImports = new ArrayList<FunctionImportImpl>();
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<EntitySetImpl> getEntitySets() {
return entitySets;
}
public List<SingletonImpl> 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<EntitySetImpl> getEntitySets() {
return entitySets;
}
@Override
@SuppressWarnings("unchecked")
public List<FunctionImportImpl> getFunctionImports(final String name) {
return (List<FunctionImportImpl>) 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<ActionImportImpl> actImps = getActionImports(name);
return actImps.isEmpty()
? null
: actImps.get(0);
}
public List<SingletonImpl> getSingletons() {
return singletons;
/**
* Gets all action imports with given name.
*
* @param name name.
* @return action imports.
*/
public List<ActionImportImpl> getActionImports(final String name) {
final List<ActionImportImpl> result = new ArrayList<ActionImportImpl>();
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<ActionImportImpl> 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<ActionImportImpl> actImps = getActionImports(name);
return actImps.isEmpty()
? null
: actImps.get(0);
}
@Override
public List<FunctionImportImpl> getFunctionImports() {
return functionImports;
}
/**
* Gets all action imports with given name.
*
* @param name name.
* @return action imports.
*/
public List<ActionImportImpl> getActionImports(final String name) {
final List<ActionImportImpl> result = new ArrayList<ActionImportImpl>();
for (ActionImportImpl actionImport : getActionImports()) {
if (name.equals(actionImport.getName())) {
result.add(actionImport);
}
}
return result;
}
@Override
public AnnotationImpl getAnnotation() {
return annotation;
}
public List<ActionImportImpl> getActionImports() {
return actionImports;
}
@Override
public List<FunctionImportImpl> 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;
}
}

View File

@ -30,7 +30,7 @@ public class EntitySetImpl extends AbstractEntitySet implements AnnotatedEdmItem
private boolean includeInServiceDocument = true;
private Annotation annotation;
private AnnotationImpl annotation;
private final List<NavigationPropertyBinding> navigationPropertyBindings
= new ArrayList<NavigationPropertyBinding>();
@ -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;
}
}

View File

@ -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<PropertyImpl> properties = new ArrayList<PropertyImpl>();
private final List<PropertyImpl> properties = new ArrayList<PropertyImpl>();
private final List<NavigationPropertyImpl> navigationProperties = new ArrayList<NavigationPropertyImpl>();
private final List<NavigationPropertyImpl> navigationProperties = new ArrayList<NavigationPropertyImpl>();
private Annotation annotation;
private AnnotationImpl annotation;
@Override
public List<PropertyImpl> getProperties() {
return properties;
@Override
public List<PropertyImpl> 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<NavigationPropertyImpl> getNavigationProperties() {
return navigationProperties;
}
@Override
public List<NavigationPropertyImpl> 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;
}
}

View File

@ -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<MemberImpl> members = new ArrayList<MemberImpl>();
@ -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;
}
}

View File

@ -47,12 +47,12 @@ public class FunctionDeserializer extends AbstractEdmDeserializer<FunctionImpl>
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));
}
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -50,13 +50,13 @@ public class NavigationPropertyDeserializer extends AbstractEdmDeserializer<Navi
property.setContainsTarget(BooleanUtils.toBoolean(jp.nextTextValue()));
} else if ("ReferentialConstraint".equals(jp.getCurrentName())) {
jp.nextToken();
property.getReferentialConstraints().add(jp.readValueAs( ReferentialConstraintImpl.class));
property.getReferentialConstraints().add(jp.readValueAs(ReferentialConstraintImpl.class));
} else if ("OnDelete".equals(jp.getCurrentName())) {
jp.nextToken();
property.setOnDelete(jp.readValueAs( OnDeleteImpl.class));
property.setOnDelete(jp.readValueAs(OnDeleteImpl.class));
} else if ("Annotation".equals(jp.getCurrentName())) {
jp.nextToken();
property.setAnnotation(jp.readValueAs( AnnotationImpl.class));
property.setAnnotation(jp.readValueAs(AnnotationImpl.class));
}
}
}

View File

@ -42,7 +42,7 @@ public class NavigationPropertyImpl extends AbstractNavigationProperty implement
private OnDeleteImpl onDelete;
private Annotation annotation;
private AnnotationImpl annotation;
public String getType() {
return type;
@ -89,13 +89,13 @@ public class NavigationPropertyImpl extends AbstractNavigationProperty implement
}
@Override
public Annotation getAnnotation() {
public AnnotationImpl getAnnotation() {
return annotation;
}
@Override
public void setAnnotation(final Annotation annotation) {
this.annotation = annotation;
this.annotation = (AnnotationImpl) annotation;
}
}

View File

@ -25,8 +25,7 @@ import org.apache.olingo.odata4.client.api.edm.Schema;
import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
import org.apache.olingo.odata4.client.core.edm.AbstractSchema;
public class SchemaImpl extends AbstractSchema<EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl, FunctionImportImpl>
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<EntityContainerImpl, EntityTypeIm
private final List<TypeDefinitionImpl> typeDefinitions = new ArrayList<TypeDefinitionImpl>();
private Annotation annotation;
private AnnotationImpl annotation;
public List<ActionImpl> getActions() {
return actions;
@ -86,22 +85,6 @@ public class SchemaImpl extends AbstractSchema<EntityContainerImpl, EntityTypeIm
return annotations;
}
@Override
public List<EnumTypeImpl> 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<FunctionImpl> getFunctions() {
return functions;
}
@ -152,8 +135,28 @@ public class SchemaImpl extends AbstractSchema<EntityContainerImpl, EntityTypeIm
}
@Override
public List<EntityTypeImpl> 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<EnumTypeImpl> 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<EntityContainerImpl, EntityTypeIm
}
@Override
public Annotation getAnnotation() {
return annotation;
public EntityTypeImpl getEntityType(final String name) {
return (EntityTypeImpl) super.getEntityType(name);
}
@Override
public void setAnnotation(final Annotation annotation) {
this.annotation = annotation;
public List<EntityTypeImpl> getEntityTypes() {
return entityTypes;
}
}

View File

@ -43,10 +43,10 @@ public class SingletonDeserializer extends AbstractEdmDeserializer<SingletonImpl
} else if ("NavigationPropertyBinding".equals(jp.getCurrentName())) {
jp.nextToken();
singleton.getNavigationPropertyBindings().add(
jp.readValueAs( NavigationPropertyBindingImpl.class));
jp.readValueAs(NavigationPropertyBindingImpl.class));
} else if ("Annotation".equals(jp.getCurrentName())) {
jp.nextToken();
singleton.setAnnotation(jp.readValueAs( AnnotationImpl.class));
singleton.setAnnotation(jp.readValueAs(AnnotationImpl.class));
}
}
}

View File

@ -64,7 +64,7 @@ public class TermDeserializer extends AbstractEdmDeserializer<TermImpl> {
}
} else if ("Annotation".equals(jp.getCurrentName())) {
jp.nextToken();
term.setAnnotation(jp.readValueAs( AnnotationImpl.class));
term.setAnnotation(jp.readValueAs(AnnotationImpl.class));
}
}
}

View File

@ -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;

View File

@ -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;
}
}

View File

@ -35,7 +35,7 @@ public class Apply extends AnnotatedDynExprConstruct {
private String function;
private final List<ExprConstruct> parameters = new ArrayList<ExprConstruct>();
private final List<ExprConstructImpl> parameters = new ArrayList<ExprConstructImpl>();
public String getFunction() {
return function;
@ -45,7 +45,7 @@ public class Apply extends AnnotatedDynExprConstruct {
this.function = function;
}
public List<ExprConstruct> getParameters() {
public List<ExprConstructImpl> getParameters() {
return parameters;
}

View File

@ -40,11 +40,11 @@ public class ApplyDeserializer extends AbstractEdmDeserializer<Apply> {
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));
}
}
}

View File

@ -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;
}

View File

@ -41,7 +41,7 @@ public class CastDeserializer extends AbstractEdmDeserializer<Cast> {
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<Cast> {
} else if ("SRID".equals(jp.getCurrentName())) {
cast.setSrid(jp.nextTextValue());
} else {
cast.setValue(jp.readValueAs( DynExprConstruct.class));
cast.setValue(jp.readValueAs(DynExprConstructImpl.class));
}
}
}

View File

@ -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<ExprConstruct> items = new ArrayList<ExprConstruct>();
private final List<ExprConstructImpl> items = new ArrayList<ExprConstructImpl>();
public List<ExprConstruct> getItems() {
public List<ExprConstructImpl> getItems() {
return items;
}

View File

@ -39,7 +39,7 @@ public class CollectionDeserializer extends AbstractEdmDeserializer<Collection>
if (isAnnotationConstExprConstruct(jp)) {
collection.getItems().add(parseAnnotationConstExprConstruct(jp));
} else {
collection.getItems().add(jp.readValueAs( DynExprConstruct.class));
collection.getItems().add(jp.readValueAs( DynExprConstructImpl.class));
}
}
}

View File

@ -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;
}

View File

@ -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<DynExprConstruct> {
public class DynExprConstructDeserializer extends AbstractEdmDeserializer<DynExprConstructImpl> {
private static final String[] EL_OR_ATTR = { AnnotationPath.class.getSimpleName(), Path.class.getSimpleName() };
@ -62,12 +62,12 @@ public class DynExprConstructDeserializer extends AbstractEdmDeserializer<DynExp
}
}
private ExprConstruct parseConstOrEnumExprConstruct(final JsonParser jp) throws IOException {
ExprConstruct result;
private ExprConstructImpl parseConstOrEnumExprConstruct(final JsonParser jp) throws IOException {
ExprConstructImpl result;
if (isAnnotationConstExprConstruct(jp)) {
result = parseAnnotationConstExprConstruct(jp);
} else {
result = jp.readValueAs( DynExprConstruct.class);
result = jp.readValueAs( DynExprConstructImpl.class);
}
jp.nextToken();
@ -75,10 +75,10 @@ public class DynExprConstructDeserializer extends AbstractEdmDeserializer<DynExp
}
@Override
protected DynExprConstruct doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
protected DynExprConstructImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
DynExprConstruct construct = null;
DynExprConstructImpl construct = null;
if (DynExprSingleParamOp.Type.fromString(jp.getCurrentName()) != null) {
final DynExprSingleParamOp dynExprSingleParamOp = new DynExprSingleParamOp();
@ -86,7 +86,7 @@ public class DynExprConstructDeserializer extends AbstractEdmDeserializer<DynExp
jp.nextToken();
jp.nextToken();
dynExprSingleParamOp.setExpression(jp.readValueAs( DynExprConstruct.class));
dynExprSingleParamOp.setExpression(jp.readValueAs( DynExprConstructImpl.class));
construct = dynExprSingleParamOp;
} else if (DynExprDoubleParamOp.Type.fromString(jp.getCurrentName()) != null) {
@ -95,8 +95,8 @@ public class DynExprConstructDeserializer extends AbstractEdmDeserializer<DynExp
jp.nextToken();
jp.nextToken();
dynExprDoubleParamOp.setLeft(jp.readValueAs( DynExprConstruct.class));
dynExprDoubleParamOp.setRight(jp.readValueAs( DynExprConstruct.class));
dynExprDoubleParamOp.setLeft(jp.readValueAs( DynExprConstructImpl.class));
dynExprDoubleParamOp.setRight(jp.readValueAs( DynExprConstructImpl.class));
construct = dynExprDoubleParamOp;
} else if (ArrayUtils.contains(EL_OR_ATTR, jp.getCurrentName())) {

View File

@ -19,9 +19,10 @@
package org.apache.olingo.odata4.client.core.edm.v4.annotation;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.apache.olingo.odata4.client.api.edm.v4.annotation.DynExprConstruct;
@JsonDeserialize(using = DynExprConstructDeserializer.class)
public abstract class DynExprConstruct extends ExprConstruct {
public abstract class DynExprConstructImpl extends ExprConstructImpl implements DynExprConstruct {
private static final long serialVersionUID = -642012862023177349L;

View File

@ -18,7 +18,7 @@
*/
package org.apache.olingo.odata4.client.core.edm.v4.annotation;
public class DynExprDoubleParamOp extends DynExprConstruct {
public class DynExprDoubleParamOp extends DynExprConstructImpl {
private static final long serialVersionUID = -7974475975925167731L;
@ -40,9 +40,9 @@ public class DynExprDoubleParamOp extends DynExprConstruct {
private Type type;
private DynExprConstruct left;
private DynExprConstructImpl left;
private DynExprConstruct right;
private DynExprConstructImpl right;
public Type getType() {
return type;
@ -52,19 +52,19 @@ public class DynExprDoubleParamOp extends DynExprConstruct {
this.type = type;
}
public DynExprConstruct getLeft() {
public DynExprConstructImpl getLeft() {
return left;
}
public void setLeft(final DynExprConstruct left) {
public void setLeft(final DynExprConstructImpl left) {
this.left = left;
}
public DynExprConstruct getRight() {
public DynExprConstructImpl getRight() {
return right;
}
public void setRight(final DynExprConstruct right) {
public void setRight(final DynExprConstructImpl right) {
this.right = right;
}

View File

@ -18,7 +18,7 @@
*/
package org.apache.olingo.odata4.client.core.edm.v4.annotation;
public class DynExprSingleParamOp extends DynExprConstruct {
public class DynExprSingleParamOp extends DynExprConstructImpl {
private static final long serialVersionUID = -7974475975925167731L;
@ -46,7 +46,7 @@ public class DynExprSingleParamOp extends DynExprConstruct {
private Type type;
private DynExprConstruct expression;
private DynExprConstructImpl expression;
public Type getType() {
return type;
@ -56,11 +56,11 @@ public class DynExprSingleParamOp extends DynExprConstruct {
this.type = type;
}
public DynExprConstruct getExpression() {
public DynExprConstructImpl getExpression() {
return expression;
}
public void setExpression(final DynExprConstruct expression) {
public void setExpression(final DynExprConstructImpl expression) {
this.expression = expression;
}

View File

@ -20,7 +20,7 @@ package org.apache.olingo.odata4.client.core.edm.v4.annotation;
import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
public abstract class ExprConstruct extends AbstractEdmItem {
public abstract class ExprConstructImpl extends AbstractEdmItem {
private static final long serialVersionUID = 7108626008005050492L;

View File

@ -22,33 +22,33 @@ public class If extends AnnotatedDynExprConstruct {
private static final long serialVersionUID = 6752952406406218936L;
private ExprConstruct guard;
private ExprConstructImpl guard;
private ExprConstruct _then;
private ExprConstructImpl _then;
private ExprConstruct _else;
private ExprConstructImpl _else;
public ExprConstruct getGuard() {
public ExprConstructImpl getGuard() {
return guard;
}
public void setGuard(final ExprConstruct guard) {
public void setGuard(final ExprConstructImpl guard) {
this.guard = guard;
}
public ExprConstruct getThen() {
public ExprConstructImpl getThen() {
return _then;
}
public void setThen(final ExprConstruct _then) {
public void setThen(final ExprConstructImpl _then) {
this._then = _then;
}
public ExprConstruct getElse() {
public ExprConstructImpl getElse() {
return _else;
}
public void setElse(final ExprConstruct _else) {
public void setElse(final ExprConstructImpl _else) {
this._else = _else;
}

View File

@ -36,7 +36,7 @@ public class IsOf extends AnnotatedDynExprConstruct {
private String srid;
private DynExprConstruct value;
private DynExprConstructImpl value;
public String getType() {
return type;
@ -78,11 +78,11 @@ public class IsOf 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;
}

View File

@ -41,7 +41,7 @@ public class IsOfDeserializer extends AbstractEdmDeserializer<IsOf> {
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<IsOf> {
} else if ("SRID".equals(jp.getCurrentName())) {
isof.setSrid(jp.nextTextValue());
} else {
isof.setValue(jp.readValueAs( DynExprConstruct.class));
isof.setValue(jp.readValueAs(DynExprConstructImpl.class));
}
}
}

View File

@ -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;
}

View File

@ -40,9 +40,9 @@ public class LabeledElementDeserializer extends AbstractEdmDeserializer<LabeledE
if ("Name".equals(jp.getCurrentName())) {
element.setName(jp.nextTextValue());
} else if ("Annotation".equals(jp.getCurrentName())) {
element.setAnnotation(jp.readValueAs( AnnotationImpl.class));
element.setAnnotation(jp.readValueAs(AnnotationImpl.class));
} else {
element.setValue(jp.readValueAs( DynExprConstruct.class));
element.setValue(jp.readValueAs(DynExprConstructImpl.class));
}
}
}

View File

@ -38,7 +38,7 @@ public class NullDeserializer extends AbstractEdmDeserializer<Null> {
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));
}
}
}

View File

@ -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;
}

View File

@ -40,11 +40,11 @@ public class PropertyValueDeserializer extends AbstractEdmDeserializer<PropertyV
if ("Property".equals(jp.getCurrentName())) {
propValue.setProperty(jp.nextTextValue());
} else if ("Annotation".equals(jp.getCurrentName())) {
propValue.setAnnotation(jp.readValueAs( AnnotationImpl.class));
propValue.setAnnotation(jp.readValueAs(AnnotationImpl.class));
} else if (isAnnotationConstExprConstruct(jp)) {
propValue.setValue(parseAnnotationConstExprConstruct(jp));
} else {
propValue.setValue(jp.readValueAs( DynExprConstruct.class));
propValue.setValue(jp.readValueAs(DynExprConstructImpl.class));
}
}
}

View File

@ -40,9 +40,9 @@ public class RecordDeserializer extends AbstractEdmDeserializer<Record> {
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));
}
}
}

View File

@ -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;
}

View File

@ -39,7 +39,7 @@ public class UrlRefDeserializer extends AbstractEdmDeserializer<UrlRef> {
if (isAnnotationConstExprConstruct(jp)) {
urlref.setValue(parseAnnotationConstExprConstruct(jp));
} else {
urlref.setValue(jp.readValueAs( DynExprConstruct.class));
urlref.setValue(jp.readValueAs( DynExprConstructImpl.class));
}
}
}

View File

@ -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<T> extends JsonDeserializer<T> {
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;
}

View File

@ -71,7 +71,7 @@ public class ComplexTypeDeserializer extends AbstractEdmDeserializer<AbstractCom
} else if ("Annotation".equals(jp.getCurrentName())) {
jp.nextToken();
((org.apache.olingo.odata4.client.core.edm.v4.ComplexTypeImpl) complexType).
setAnnotation(jp.readValueAs( AnnotationImpl.class));
setAnnotation(jp.readValueAs(AnnotationImpl.class));
}
}
}

View File

@ -67,15 +67,15 @@ public class EntityContainerDeserializer extends AbstractEdmDeserializer<Abstrac
} else if ("AssociationSet".equals(jp.getCurrentName())) {
jp.nextToken();
((org.apache.olingo.odata4.client.core.edm.v3.EntityContainerImpl) entityContainer).
getAssociationSets().add(jp.readValueAs( AssociationSetImpl.class));
getAssociationSets().add(jp.readValueAs(AssociationSetImpl.class));
} else if ("Singleton".equals(jp.getCurrentName())) {
jp.nextToken();
((org.apache.olingo.odata4.client.core.edm.v4.EntityContainerImpl) entityContainer).
getSingletons().add(jp.readValueAs( SingletonImpl.class));
getSingletons().add(jp.readValueAs(SingletonImpl.class));
} else if ("ActionImport".equals(jp.getCurrentName())) {
jp.nextToken();
((org.apache.olingo.odata4.client.core.edm.v4.EntityContainerImpl) entityContainer).
getActionImports().add(jp.readValueAs( ActionImportImpl.class));
getActionImports().add(jp.readValueAs(ActionImportImpl.class));
} else if ("FunctionImport".equals(jp.getCurrentName())) {
jp.nextToken();
if (entityContainer instanceof org.apache.olingo.odata4.client.core.edm.v3.EntityContainerImpl) {
@ -90,7 +90,7 @@ public class EntityContainerDeserializer extends AbstractEdmDeserializer<Abstrac
} else if ("Annotation".equals(jp.getCurrentName())) {
jp.nextToken();
((org.apache.olingo.odata4.client.core.edm.v4.EntityContainerImpl) entityContainer).
setAnnotation(jp.readValueAs( AnnotationImpl.class));
setAnnotation(jp.readValueAs(AnnotationImpl.class));
}
}
}

View File

@ -53,11 +53,11 @@ public class EntitySetDeserializer extends AbstractEdmDeserializer<AbstractEntit
jp.nextToken();
((org.apache.olingo.odata4.client.core.edm.v4.EntitySetImpl) entitySet).
getNavigationPropertyBindings().add(
jp.readValueAs( NavigationPropertyBindingImpl.class));
jp.readValueAs(NavigationPropertyBindingImpl.class));
} else if ("Annotation".equals(jp.getCurrentName())) {
jp.nextToken();
((org.apache.olingo.odata4.client.core.edm.v4.EntitySetImpl) entitySet).
setAnnotation(jp.readValueAs( AnnotationImpl.class));
setAnnotation(jp.readValueAs(AnnotationImpl.class));
}
}
}

View File

@ -61,7 +61,7 @@ public class EnumTypeDeserializer extends AbstractEdmDeserializer<AbstractEnumTy
} else if ("Annotation".equals(jp.getCurrentName())) {
jp.nextToken();
((org.apache.olingo.odata4.client.core.edm.v4.EnumTypeImpl) enumType).
setAnnotation(jp.readValueAs( AnnotationImpl.class));
setAnnotation(jp.readValueAs(AnnotationImpl.class));
}
}
}

View File

@ -50,8 +50,8 @@ public class MetadataTest extends AbstractTest {
readMetadata(getClass().getResourceAsStream("metadata.xml"));
assertNotNull(metadata);
final EdmTypeImpl orderCollection
= new EdmTypeImpl(metadata, "Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Order)");
final EdmTypeImpl orderCollection = new EdmTypeImpl(metadata,
"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Order)");
assertNotNull(orderCollection);
assertTrue(orderCollection.isCollection());
assertFalse(orderCollection.isSimpleType());
@ -71,8 +71,8 @@ public class MetadataTest extends AbstractTest {
assertFalse(stream.isComplexType());
assertFalse(stream.isEntityType());
final List<FunctionImportImpl> functionImports
= metadata.getSchemas().get(0).getDefaultEntityContainer().getFunctionImports();
final List<FunctionImportImpl> functionImports = metadata.getSchemas().get(0).
getDefaultEntityContainer().getFunctionImports();
int legacyGetters = 0;
int legacyPosters = 0;
int actions = 0;

View File

@ -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());
}
/**