You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by fm...@apache.org on 2014/07/22 13:12:58 UTC

[5/8] [OLINGO-366] provides Primitive and Complex collection handling

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java
index 9e55ec7..b4d336b 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java
@@ -33,7 +33,6 @@ import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
 import org.apache.olingo.ext.proxy.api.AbstractSingleton;
 import org.apache.olingo.ext.proxy.api.Search;
 import org.apache.olingo.ext.proxy.api.SingleQuery;
-import org.apache.olingo.ext.proxy.api.StructuredType;
 import org.apache.olingo.ext.proxy.api.annotations.EntitySet;
 import org.apache.olingo.ext.proxy.context.AttachedEntityStatus;
 import org.apache.olingo.ext.proxy.context.EntityContext;
@@ -53,11 +52,12 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmEntityContainer;
 import org.apache.olingo.ext.proxy.Service;
+import org.apache.olingo.ext.proxy.api.EntityType;
 import org.apache.olingo.ext.proxy.api.annotations.Namespace;
 import org.apache.olingo.ext.proxy.api.annotations.Singleton;
 
 class EntitySetInvocationHandler<
-        T extends StructuredType, KEY extends Serializable, EC extends EntityCollection<T>>
+        T extends EntityType, KEY extends Serializable, EC extends EntityCollection<T>>
         extends AbstractEntityCollectionInvocationHandler<T, EC>
         implements AbstractEntitySet<T, KEY, EC> {
 
@@ -69,42 +69,35 @@ class EntitySetInvocationHandler<
   private static final Logger LOG = LoggerFactory.getLogger(EntitySetInvocationHandler.class);
 
   @SuppressWarnings({"rawtypes", "unchecked"})
-  static EntitySetInvocationHandler getInstance(
-          final Class<?> ref,
-          final Service<?> service,
-          final String entitySetName) {
-
-    return new EntitySetInvocationHandler(ref, service, entitySetName, buildURI(ref, service, entitySetName));
+  static EntitySetInvocationHandler getInstance(final Class<?> ref, final Service<?> service) {
+    return new EntitySetInvocationHandler(ref, service, buildURI(ref, service));
   }
 
   @SuppressWarnings({"rawtypes", "unchecked"})
-  static EntitySetInvocationHandler getInstance(
-          final Class<?> ref, final Service<?> service, final URI uri) {
-
-    return new EntitySetInvocationHandler(
-            ref,
-            service,
-            (ref.getAnnotation(EntitySet.class)).name(),
-            service.getClient().newURIBuilder(uri.toASCIIString()));
+  static EntitySetInvocationHandler getInstance(final Class<?> ref, final Service<?> service, final URI uri) {
+    return new EntitySetInvocationHandler(ref, service, service.getClient().newURIBuilder(uri.toASCIIString()));
   }
 
   private static CommonURIBuilder<?> buildURI(
           final Class<?> ref,
-          final Service<?> service,
-          final String entitySetName) {
+          final Service<?> service) {
     final CommonURIBuilder<?> uriBuilder = service.getClient().newURIBuilder();
 
     final Edm edm = service.getClient().getCachedEdm();
     final String containerNS;
+    final String entitySetName;
     Annotation ann = ref.getAnnotation(EntitySet.class);
     if (ann instanceof EntitySet) {
       containerNS = EntitySet.class.cast(ann).container();
+      entitySetName = EntitySet.class.cast(ann).name();
     } else {
       ann = ref.getAnnotation(Singleton.class);
       if (ann instanceof Singleton) {
         containerNS = Singleton.class.cast(ann).container();
+        entitySetName = Singleton.class.cast(ann).name();
       } else {
         containerNS = null;
+        entitySetName = null;
       }
     }
 
@@ -125,23 +118,11 @@ class EntitySetInvocationHandler<
   protected EntitySetInvocationHandler(
           final Class<?> ref,
           final Service<?> service,
-          final String entitySetName,
           final CommonURIBuilder<?> uri) {
 
     super(ref, service, uri);
   }
 
-  @SuppressWarnings("unchecked")
-  protected EntitySetInvocationHandler(
-          final Class<?> itemRef,
-          final Class<EC> collItemRef,
-          final Service<?> service,
-          final String entitySetName,
-          final CommonURIBuilder<?> uri) {
-
-    super(itemRef, collItemRef, service, uri.build(), uri);
-  }
-
   @Override
   public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
     if ("filter".equals(method.getName())
@@ -160,15 +141,6 @@ class EntitySetInvocationHandler<
   }
 
   @Override
-  public void add(final T entity) {
-    final EntityInvocationHandler handler = EntityInvocationHandler.class.cast(Proxy.getInvocationHandler(entity));
-    if (!getContext().entityContext().isAttached(handler)) {
-      handler.updateUUID(baseURI, itemRef, null);
-      getContext().entityContext().attachNew(handler);
-    }
-  }
-
-  @Override
   public Long count() {
     final ODataValueRequest req = getClient().getRetrieveRequestFactory().
             getValueRequest(getClient().newURIBuilder(this.uri.build().toASCIIString()).count().build());
@@ -209,7 +181,6 @@ class EntitySetInvocationHandler<
               typeRef.getAnnotation(Namespace.class).value(), ClassUtils.getEntityTypeName(typeRef)));
 
       handler = EntityInvocationHandler.getInstance(key, entity, this.baseURI, typeRef, service);
-
     } else if (isDeleted(handler)) {
       // object deleted
       LOG.debug("Object '{}({})' has been deleted", typeRef.getSimpleName(), uuid);
@@ -222,6 +193,7 @@ class EntitySetInvocationHandler<
             handler);
   }
 
+  @Override
   public EC execute() {
     return execute(collItemRef);
   }
@@ -240,16 +212,16 @@ class EntitySetInvocationHandler<
               ClassUtils.getNamespace(ref), ClassUtils.getEntityTypeName(ref)).toString());
     }
 
-    final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>();
+    final List<ODataAnnotation> anns = new ArrayList<ODataAnnotation>();
 
-    final Triple<List<S>, URI, List<ODataAnnotation>> entitySet = fetchPartialEntitySet(uriBuilder.build(), ref);
-    annotations.addAll(entitySet.getRight());
+    final Triple<List<S>, URI, List<ODataAnnotation>> entitySet = fetchPartial(uriBuilder.build(), ref);
+    anns.addAll(entitySet.getRight());
 
-    final EntityCollectionInvocationHandler<S> entityCollectionHandler =
-            new EntityCollectionInvocationHandler<S>(service, entitySet.getLeft(), ref, this.baseURI, uriBuilder);
-    entityCollectionHandler.setAnnotations(annotations);
+    final EntityCollectionInvocationHandler<S> entityCollectionHandler = new EntityCollectionInvocationHandler<S>(
+            service, entitySet.getLeft(), collTypeRef, this.baseURI, uriBuilder);
+    entityCollectionHandler.setAnnotations(anns);
 
-    entityCollectionHandler.setNextPage(entitySet.getMiddle());
+    entityCollectionHandler.nextPageURI = entitySet.getMiddle();
 
     return (SEC) Proxy.newProxyInstance(
             Thread.currentThread().getContextClassLoader(),
@@ -267,8 +239,7 @@ class EntitySetInvocationHandler<
 
   @Override
   @SuppressWarnings("unchecked")
-  public <S extends T, SEC extends EntityCollection<S>> Search<S, SEC> createSearch(
-          final Class<SEC> reference) {
+  public <S extends T, SEC extends EntityCollection<S>> Search<S, SEC> createSearch(final Class<SEC> reference) {
 
     if (getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0) {
       throw new UnsupportedInV3Exception();
@@ -280,6 +251,31 @@ class EntitySetInvocationHandler<
             (EntitySetInvocationHandler<S, ?, SEC>) this);
   }
 
+  @SuppressWarnings("unchecked")
+  public <S extends T, SEC extends EntityCollection<S>> SEC fetchWholeEntitySet(
+          final CommonURIBuilder<?> uriBuilder, final Class<S> typeRef, final Class<SEC> collTypeRef) {
+
+    final List<S> res = new ArrayList<S>();
+    final List<ODataAnnotation> anns = new ArrayList<ODataAnnotation>();
+
+    URI nextURI = uriBuilder.build();
+    while (nextURI != null) {
+      final Triple<List<S>, URI, List<ODataAnnotation>> entitySet = fetchPartial(nextURI, typeRef);
+      res.addAll(entitySet.getLeft());
+      nextURI = entitySet.getMiddle();
+      anns.addAll(entitySet.getRight());
+    }
+
+    final EntityCollectionInvocationHandler<S> entityCollectionHandler =
+            new EntityCollectionInvocationHandler<S>(service, res, collTypeRef, targetEntitySetURI, uriBuilder);
+    entityCollectionHandler.setAnnotations(anns);
+
+    return (SEC) Proxy.newProxyInstance(
+            Thread.currentThread().getContextClassLoader(),
+            new Class<?>[] {collTypeRef},
+            entityCollectionHandler);
+  }
+
   @Override
   public void delete(final KEY key) throws IllegalArgumentException {
     final EntityContext entityContext = getContext().entityContext();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetIterator.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetIterator.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetIterator.java
index 60c0068..77d58f7 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetIterator.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetIterator.java
@@ -28,9 +28,9 @@ import java.util.NoSuchElementException;
 import org.apache.commons.lang3.tuple.Triple;
 import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
 import org.apache.olingo.ext.proxy.api.EntityCollection;
-import org.apache.olingo.ext.proxy.api.StructuredType;
+import org.apache.olingo.ext.proxy.api.EntityType;
 
-class EntitySetIterator<T extends StructuredType, KEY extends Serializable, EC extends EntityCollection<T>>
+class EntitySetIterator<T extends EntityType, KEY extends Serializable, EC extends EntityCollection<T>>
         implements Iterator<T> {
 
   private final EntitySetInvocationHandler<T, KEY, EC> esi;
@@ -81,8 +81,7 @@ class EntitySetIterator<T extends StructuredType, KEY extends Serializable, EC e
   }
 
   private void goOn() {
-    final Triple<List<T>, URI, List<ODataAnnotation>> entitySet =
-            esi.fetchPartialEntitySet(this.next, this.esi.getTypeRef());
+    final Triple<List<T>, URI, List<ODataAnnotation>> entitySet = esi.fetchPartial(this.next, this.esi.getTypeRef());
     this.current = entitySet.getLeft().iterator();
     this.next = entitySet.getMiddle();
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java
index 8c9a01d..32226f8 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java
@@ -63,6 +63,14 @@ final class OperationInvocationHandler extends AbstractInvocationHandler impleme
     return new OperationInvocationHandler(collectionHandler);
   }
 
+  static OperationInvocationHandler getInstance(final ComplexCollectionInvocationHandler<?> collectionHandler) {
+    return new OperationInvocationHandler(collectionHandler);
+  }
+
+  static OperationInvocationHandler getInstance(final PrimitiveCollectionInvocationHandler<?> collectionHandler) {
+    return new OperationInvocationHandler(collectionHandler);
+  }
+
   private OperationInvocationHandler(final EntityContainerInvocationHandler containerHandler) {
     super(containerHandler.service);
 
@@ -82,8 +90,30 @@ final class OperationInvocationHandler extends AbstractInvocationHandler impleme
 
     this.target = collectionHandler;
 
-    final String typeName = ClassUtils.getEntityTypeName(collectionHandler.getEntityReference());
-    final String typeNamespace = ClassUtils.getNamespace(collectionHandler.getEntityReference());
+    final String typeName = ClassUtils.getEntityTypeName(collectionHandler.getTypeRef());
+    final String typeNamespace = ClassUtils.getNamespace(collectionHandler.getTypeRef());
+
+    this.targetFQN = new FullQualifiedName(typeNamespace, typeName);
+  }
+
+  private OperationInvocationHandler(final ComplexCollectionInvocationHandler<?> collectionHandler) {
+    super(collectionHandler.service);
+
+    this.target = collectionHandler;
+
+    final String typeName = ClassUtils.getEntityTypeName(collectionHandler.getTypeRef());
+    final String typeNamespace = ClassUtils.getNamespace(collectionHandler.getTypeRef());
+
+    this.targetFQN = new FullQualifiedName(typeNamespace, typeName);
+  }
+
+  private OperationInvocationHandler(final PrimitiveCollectionInvocationHandler<?> collectionHandler) {
+    super(collectionHandler.service);
+
+    this.target = collectionHandler;
+
+    final String typeName = ClassUtils.getEntityTypeName(collectionHandler.getTypeRef());
+    final String typeNamespace = ClassUtils.getNamespace(collectionHandler.getTypeRef());
 
     this.targetFQN = new FullQualifiedName(typeNamespace, typeName);
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java
new file mode 100644
index 0000000..dff529a
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java
@@ -0,0 +1,137 @@
+/*
+ * 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.ext.proxy.commons;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.tuple.Triple;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.apache.commons.lang3.tuple.ImmutableTriple;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.ext.proxy.Service;
+import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
+
+public class PrimitiveCollectionInvocationHandler<T extends Serializable>
+        extends AbstractCollectionInvocationHandler<T, PrimitiveCollection<T>>
+        implements PrimitiveCollection<T> {
+
+  private static final long serialVersionUID = 98078202642671756L;
+
+  public PrimitiveCollectionInvocationHandler(
+          final Service<?> service,
+          final Class<T> itemRef) {
+    this(service, new ArrayList<T>(), itemRef, null);
+  }
+
+  public PrimitiveCollectionInvocationHandler(
+          final Service<?> service,
+          final Class<T> itemRef,
+          final CommonURIBuilder<?> uri) {
+    this(service, new ArrayList<T>(), itemRef, uri);
+  }
+
+  public PrimitiveCollectionInvocationHandler(
+          final Service<?> service,
+          final Collection<T> items,
+          final Class<T> itemRef,
+          final CommonURIBuilder<?> uri) {
+
+    super(service, items, itemRef, uri);
+  }
+
+  @Override
+  public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
+    if ("filter".equals(method.getName())
+            || "orderBy".equals(method.getName())
+            || "top".equals(method.getName())
+            || "skip".equals(method.getName())
+            || "expand".equals(method.getName())
+            || "select".equals(method.getName())
+            || "nextPage".equals(method.getName())
+            || "execute".equals(method.getName())) {
+      invokeSelfMethod(method, args);
+      return proxy;
+    } else if (isSelfMethod(method, args)) {
+      return invokeSelfMethod(method, args);
+    } else if ("operations".equals(method.getName()) && ArrayUtils.isEmpty(args)) {
+      final Class<?> returnType = method.getReturnType();
+
+      return Proxy.newProxyInstance(
+              Thread.currentThread().getContextClassLoader(),
+              new Class<?>[] {returnType},
+              OperationInvocationHandler.getInstance(this));
+    } else {
+      throw new NoSuchMethodException(method.getName());
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public <S extends T> Triple<List<S>, URI, List<ODataAnnotation>> fetchPartial(final URI uri, final Class<S> typeRef) {
+    final ODataPropertyRequest<ODataProperty> req = getClient().getRetrieveRequestFactory().getPropertyRequest(uri);
+    if (getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) > 0) {
+      req.setPrefer(getClient().newPreferences().includeAnnotations("*"));
+    }
+
+    final ODataRetrieveResponse<ODataProperty> res = req.execute();
+
+    List<S> resItems = new ArrayList<S>();
+
+    final ODataProperty property = res.getBody();
+    if (property != null && !property.hasNullValue()) {
+      for (ODataValue item : property.getCollectionValue()) {
+        resItems.add((S) getComplex(property.getName(), item, typeRef, null, null, true));
+      }
+    }
+
+    return new ImmutableTriple<List<S>, URI, List<ODataAnnotation>>(
+            resItems, null, Collections.<ODataAnnotation>emptyList());
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    if (obj instanceof Proxy) {
+      final InvocationHandler handler = Proxy.getInvocationHandler(obj);
+      if (handler instanceof PrimitiveCollectionInvocationHandler) {
+        return items.equals(PrimitiveCollectionInvocationHandler.class.cast(handler).items);
+      }
+    }
+
+    return false;
+  }
+
+  @Override
+  public int hashCode() {
+    return items.hashCode();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/SearchImpl.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/SearchImpl.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/SearchImpl.java
index e2787f7..e994d6f 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/SearchImpl.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/SearchImpl.java
@@ -25,11 +25,11 @@ import org.apache.olingo.client.api.uri.v4.URISearch;
 import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.ext.proxy.api.EntityCollection;
+import org.apache.olingo.ext.proxy.api.EntityType;
 import org.apache.olingo.ext.proxy.api.Search;
-import org.apache.olingo.ext.proxy.api.StructuredType;
 import org.apache.olingo.ext.proxy.utils.ClassUtils;
 
-public class SearchImpl<T extends StructuredType, EC extends EntityCollection<T>> implements Search<T, EC> {
+public class SearchImpl<T extends EntityType, EC extends EntityCollection<T>> implements Search<T, EC> {
 
   private static final long serialVersionUID = 4383858176507769973L;
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/SingletonInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/SingletonInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/SingletonInvocationHandler.java
index 41a416e..4512188 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/SingletonInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/SingletonInvocationHandler.java
@@ -23,27 +23,27 @@ import java.lang.reflect.Method;
 import org.apache.olingo.ext.proxy.Service;
 import org.apache.olingo.ext.proxy.api.EntityCollection;
 import org.apache.olingo.ext.proxy.api.AbstractSingleton;
+import org.apache.olingo.ext.proxy.api.EntityType;
 
 public class SingletonInvocationHandler<
-        T extends Serializable, KEY extends Serializable, EC extends EntityCollection<T>>
+        T extends EntityType, KEY extends Serializable, EC extends EntityCollection<T>>
         extends AbstractInvocationHandler
         implements AbstractSingleton<T, KEY, EC> {
 
   private static final long serialVersionUID = 2450269053734776228L;
 
-  @SuppressWarnings({"rawtypes", "unchecked"})
-  static SingletonInvocationHandler getInstance(
-          final Class<?> ref, final Service<?> service, final String singletonName) {
+  private final EntitySetInvocationHandler<?, ?, ?> entitySetHandler;
 
-    return new SingletonInvocationHandler(ref, service, singletonName);
+  @SuppressWarnings({"rawtypes", "unchecked"})
+  static SingletonInvocationHandler getInstance(final Class<?> ref, final Service<?> service) {
+    return new SingletonInvocationHandler(ref, service);
   }
-  private final EntitySetInvocationHandler<?, ?, ?> entitySetHandler;
 
   @SuppressWarnings({"rawtypes", "unchecked"})
-  private SingletonInvocationHandler(final Class<?> ref, final Service<?> service, final String singletonName) {
+  private SingletonInvocationHandler(final Class<?> ref, final Service<?> service) {
 
     super(service);
-    this.entitySetHandler = EntitySetInvocationHandler.getInstance(ref, service, singletonName);
+    this.entitySetHandler = EntitySetInvocationHandler.getInstance(ref, service);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
index f0b48b1..35d7aba 100644
--- a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
@@ -281,6 +281,7 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
           objs.clear();
           objs.put("complexType", complex);
           parseObj(typesBaseDir, typesPkg, "complexType", className + ".java", objs);
+          parseObj(typesBaseDir, typesPkg, "complexCollection", className + "Collection.java", objs);
         }
 
         for (EdmEntityType entity : schema.getEntityTypes()) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
index c506710..8fcc246 100644
--- a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
@@ -302,10 +302,6 @@ public abstract class AbstractUtility {
 
     final EdmTypeInfo edmType = getEdmTypeInfo(typeExpression);
 
-    if ((forceCollection || edmType.isCollection()) && !edmType.isEntityType()) {
-      res.append("java.util.Collection<");
-    }
-
     final String basepkg = StringUtils.isBlank(basePackage) ? "" : basePackage + ".";
 
     if ("Edm.Stream".equals(typeExpression)) {
@@ -337,10 +333,10 @@ public abstract class AbstractUtility {
     }
 
     if (forceCollection || edmType.isCollection()) {
-      if (edmType.isEntityType()) {
+      if (edmType.isEntityType() || edmType.isComplexType()) {
         res.append("Collection");
       } else {
-        res.append('>');
+        res.insert(0, "org.apache.olingo.ext.proxy.api.PrimitiveCollection<").append(">");
       }
     }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/ext/pojogen-maven-plugin/src/main/resources/complexCollection.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/complexCollection.vm b/ext/pojogen-maven-plugin/src/main/resources/complexCollection.vm
new file mode 100644
index 0000000..beeee41
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/complexCollection.vm
@@ -0,0 +1,103 @@
+#*
+ * 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 ${package};
+
+//CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+import org.apache.olingo.ext.proxy.api.OperationType;
+import org.apache.olingo.ext.proxy.api.annotations.Operation;
+import org.apache.olingo.ext.proxy.api.annotations.Parameter;
+#foreach($ns in $namespaces)
+import #if($basePackage)${basePackage}.#end${ns}.*;
+#end
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.UUID;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Calendar;
+import javax.xml.datatype.Duration;
+//CHECKSTYLE:ON (Maven checkstyle)
+
+#set ( $javaComplexType = $utility.getJavaType($complexType) )
+
+public interface $utility.capitalize($complexType.Name)Collection extends 
+    org.apache.olingo.ext.proxy.api.StruncturedCollectionQuery<$javaComplexType, ${javaComplexType}Collection, ${javaComplexType}Collection>, org.apache.olingo.ext.proxy.api.ComplexCollection<$javaComplexType> {
+#set( $functions = $utility.getFunctionsBoundTo($complexType.Name, true) )
+#set( $actions = $utility.getActionsBoundTo($complexType.Name, true) )
+#if( $functions.size() > 0 || $actions.size() > 0 )
+    Operations operations();
+
+    public interface Operations {
+
+    #foreach($operation in $functions)
+      @Operation(name = "$operation.Name",
+                    type = OperationType.FUNCTION,
+                    isComposable = $operation.Composable#if($operation.ReturnType),
+                    returnType = "#if( $operation.ReturnType.Collection )Collection(#end$operation.ReturnType.Type.FullQualifiedName.toString()#if( $operation.ReturnType.Collection ))#end"#end)
+      #if($operation.ReturnType)$utility.getJavaType($operation.ReturnType.Type, $operation.ReturnType.Collection)#{else}void#end $utility.uncapitalize($operation.Name)(
+      #if($operation.ParameterNames)
+        #set( $count = $operation.ParameterNames.size() )#*
+        *##foreach($paramName in $operation.ParameterNames)#*
+          *##set( $count = $count - 1 )#*
+          *##set( $param = $operation.getParameter($paramName) )#*
+          *##if( !$complexType.FullQualifiedName.equals($param.Type.FullQualifiedName) )#*
+        *#    @Parameter(name = "$param.Name", type = "#if( $param.Collection )Collection(#end$param.Type.FullQualifiedName.toString()#if( $param.Collection ))#end", nullable = $param.Nullable) $utility.getJavaType($param.Type, $param.Collection) $utility.uncapitalize($param.Name)#if( $count > 0 ), #end
+
+      #end
+      #end#*
+      *##end);
+
+    #end
+
+    #foreach($operation in $actions)
+      @Operation(name = "$operation.Name",
+                    type = OperationType.ACTION#if($operation.ReturnType),
+                    returnType = "#if( $operation.ReturnType.Collection )Collection(#end$operation.ReturnType.Type.FullQualifiedName.toString()#if( $operation.ReturnType.Collection ))#end"#end)
+      #if($operation.ReturnType)$utility.getJavaType($operation.ReturnType.Type, $operation.ReturnType.Collection)#{else}void#end $utility.uncapitalize($operation.Name)(
+      #if($operation.ParameterNames)
+        #set( $count = $operation.ParameterNames.size() )#*
+        *##foreach($paramName in $operation.ParameterNames)#*
+          *##set( $count = $count - 1 )#*
+          *##set( $param = $operation.getParameter($paramName) )#*
+          *##if( !$complexType.FullQualifiedName.equals($param.Type.FullQualifiedName) )#*
+        *#    @Parameter(name = "$param.Name", type = "#if( $param.Collection )Collection(#end$param.Type.FullQualifiedName.toString()#if( $param.Collection ))#end", nullable = $param.Nullable) $utility.getJavaType($param.Type, $param.Collection) $utility.uncapitalize($param.Name)#if( $count > 0 ), #end
+
+      #end
+      #end#*
+      *##end);
+
+    #end
+    }
+#end
+
+  Object getAnnotation(Class<? extends AbstractTerm> term);
+
+  Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/ext/pojogen-maven-plugin/src/main/resources/entityCollection.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/entityCollection.vm b/ext/pojogen-maven-plugin/src/main/resources/entityCollection.vm
index 92ac748..f8ea0df 100644
--- a/ext/pojogen-maven-plugin/src/main/resources/entityCollection.vm
+++ b/ext/pojogen-maven-plugin/src/main/resources/entityCollection.vm
@@ -48,7 +48,7 @@ import javax.xml.datatype.Duration;
 #set ( $javaEntityType = $utility.getJavaType($entityType) )
 
 public interface $utility.capitalize($entityType.Name)Collection extends 
-    org.apache.olingo.ext.proxy.api.EntityCollectionQuery<$javaEntityType, ${javaEntityType}Collection, ${javaEntityType}Collection>, org.apache.olingo.ext.proxy.api.EntityCollection<$javaEntityType> {
+    org.apache.olingo.ext.proxy.api.StruncturedCollectionQuery<$javaEntityType, ${javaEntityType}Collection, ${javaEntityType}Collection>, org.apache.olingo.ext.proxy.api.EntityCollection<$javaEntityType> {
 #set( $functions = $utility.getFunctionsBoundTo($entityType.Name, true) )
 #set( $actions = $utility.getActionsBoundTo($entityType.Name, true) )
 #if( $functions.size() > 0 || $actions.size() > 0 )

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
index 0d0ce64..2a7c384 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
@@ -16,25 +16,25 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 //CHECKSTYLE:OFF (Maven checkstyle)
 import org.apache.olingo.client.api.v3.EdmEnabledODataClient;
 import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.ext.proxy.Service;
+import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
+import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ContactDetailsCollection;
+import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.PhoneCollection;
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.DefaultContainer;
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Aliases;
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ContactDetails;
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Customer;
-import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Phone;
+
 import org.junit.BeforeClass;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collections;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -96,21 +96,38 @@ public abstract class AbstractTestITCase {
     // add key attribute
     customer.setCustomerId(id);
 
-    final ContactDetails cd = service.newComplex(ContactDetails.class); // PrimaryContactInfo
-    cd.setAlternativeNames(Arrays.asList("alternative1", "alternative2"));
-    cd.setEmailBag(Collections.<String>singleton("myname@mydomain.org"));
-    cd.setMobilePhoneBag(Collections.<Phone>emptySet());
+    final ContactDetails cd = service.newComplexInstance(ContactDetails.class); // PrimaryContactInfo
+
+    PrimitiveCollection<String> value = service.newPrimitiveCollection(String.class);
+    value.add("alternative1");
+    value.add("alternative2");
+    cd.setAlternativeNames(value);
+
+    value = service.newPrimitiveCollection(String.class);
+    value.add("myname@mydomain.org");
+    cd.setEmailBag(value);
+
+    cd.setMobilePhoneBag(service.newComplexCollection(PhoneCollection.class)); // empty
     customer.setPrimaryContactInfo(cd);
 
-    final Aliases aliases = service.newComplex(Aliases.class);
-    aliases.setAlternativeNames(Collections.<String>singleton("myAlternativeName"));
+    final Aliases aliases = service.newComplexInstance(Aliases.class);
+
+    value = service.newPrimitiveCollection(String.class);
+    value.add("myAlternativeName");
+    aliases.setAlternativeNames(value);
     cd.setContactAlias(aliases);
 
-    final ContactDetails bcd = service.newComplex(ContactDetails.class); // BackupContactInfo;
-    bcd.setAlternativeNames(Arrays.asList("alternative3", "alternative4"));
-    bcd.setEmailBag(Collections.<String>emptySet());
-    bcd.setMobilePhoneBag(Collections.<Phone>emptySet());
-    customer.setBackupContactInfo(Collections.<ContactDetails>singleton(bcd));
+    final ContactDetails bcd = service.newComplexInstance(ContactDetails.class); // BackupContactInfo;
+    value = service.newPrimitiveCollection(String.class);
+    value.add("alternative3");
+    value.add("alternative4");
+    bcd.setAlternativeNames(value);
+    bcd.setEmailBag(service.newPrimitiveCollection(String.class)); // empty
+    bcd.setMobilePhoneBag(service.newComplexCollection(PhoneCollection.class)); // empty
+
+    final ContactDetailsCollection bci = service.newComplexCollection(ContactDetailsCollection.class);
+    bci.add(bcd);
+    customer.setBackupContactInfo(bci);
 
     container.getCustomer().add(customer);
     return customer;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ContextTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ContextTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ContextTestITCase.java
index 84e2206..8fea084 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ContextTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ContextTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 //CHECKSTYLE:OFF (Maven checkstyle)
@@ -29,16 +28,16 @@ import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.service
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Login;
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Order;
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.OrderCollection;
-import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Phone;
 import org.junit.Test;
 
 import java.lang.reflect.Proxy;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
+import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ContactDetailsCollection;
+import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.PhoneCollection;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -240,15 +239,24 @@ public class ContextTestITCase extends AbstractTestITCase {
     final Customer customer = service.newEntityInstance(Customer.class);
     customer.setCustomerId(100);
 
-    final ContactDetails cd = service.newComplex(ContactDetails.class);
+    final ContactDetails cd = service.newComplexInstance(ContactDetails.class);
     customer.setPrimaryContactInfo(cd);
 
-    cd.setAlternativeNames(Arrays.asList("alternative1", "alternative2"));
+    PrimitiveCollection<String> alternativeNames = service.newPrimitiveCollection(String.class);
+    alternativeNames.add("alternative1");
+    alternativeNames.add("alternative2");
+    cd.setAlternativeNames(alternativeNames);
+
+    final ContactDetails bcd = service.newComplexInstance(ContactDetails.class);
+    final ContactDetailsCollection bci = service.newComplexCollection(ContactDetailsCollection.class);
+    bci.add(bcd);
 
-    final ContactDetails bcd = service.newComplex(ContactDetails.class);
-    customer.setBackupContactInfo(Collections.<ContactDetails>singletonList(bcd));
+    customer.setBackupContactInfo(bci);
 
-    bcd.setAlternativeNames(Arrays.asList("alternative3", "alternative4"));
+    alternativeNames = service.newPrimitiveCollection(String.class);
+    alternativeNames.add("alternative3");
+    alternativeNames.add("alternative4");
+    bcd.setAlternativeNames(alternativeNames);
 
     assertEquals(Integer.valueOf(100), customer.getCustomerId());
     assertNotNull(customer.getPrimaryContactInfo().getAlternativeNames());
@@ -382,18 +390,34 @@ public class ContextTestITCase extends AbstractTestITCase {
     customerInfo.setInformation("some new info ...");
     customer.setInfo(customerInfo);
 
-    final ContactDetails cd = service.newComplex(ContactDetails.class);
-    cd.setAlternativeNames(Arrays.asList("alternative1", "alternative2"));
-    cd.setEmailBag(Collections.<String>singleton("myemail@mydomain.org"));
-    cd.setMobilePhoneBag(Collections.<Phone>emptySet());
+    final ContactDetails cd = service.newComplexInstance(ContactDetails.class);
+    PrimitiveCollection<String> alternativeNames = service.newPrimitiveCollection(String.class);
+    alternativeNames.add("alternative1");
+    alternativeNames.add("alternative2");
+    cd.setAlternativeNames(alternativeNames);
+
+    final PrimitiveCollection<String> emailBag = service.newPrimitiveCollection(String.class);
+    alternativeNames.add("myemail@mydomain.org");
+    cd.setEmailBag(emailBag);
+
+    cd.setMobilePhoneBag(service.newComplexCollection(PhoneCollection.class)); // empty
 
-    final ContactDetails bcd = service.newComplex(ContactDetails.class);
-    bcd.setAlternativeNames(Arrays.asList("alternative3", "alternative4"));
-    bcd.setEmailBag(Collections.<String>emptySet());
-    bcd.setMobilePhoneBag(Collections.<Phone>emptySet());
+    final ContactDetails bcd = service.newComplexInstance(ContactDetails.class);
+
+    alternativeNames = service.newPrimitiveCollection(String.class);
+    alternativeNames.add("alternative3");
+    alternativeNames.add("alternative4");
+
+    bcd.setAlternativeNames(alternativeNames);
+    bcd.setEmailBag(service.newPrimitiveCollection(String.class));
+    bcd.setMobilePhoneBag(service.newComplexCollection(PhoneCollection.class)); // empty
 
     customer.setPrimaryContactInfo(cd);
-    customer.setBackupContactInfo(Collections.<ContactDetails>singletonList(bcd));
+
+    final ContactDetailsCollection bci = service.newComplexCollection(ContactDetailsCollection.class);
+    bci.add(bcd);
+
+    customer.setBackupContactInfo(bci);
 
     container.getCustomer().add(customer);
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityRetrieveTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityRetrieveTestITCase.java
index a4d4922..3b0e396 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityRetrieveTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityRetrieveTestITCase.java
@@ -53,6 +53,7 @@ import java.lang.reflect.Proxy;
 import java.sql.Timestamp;
 import java.util.Calendar;
 import java.util.Collection;
+import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -172,7 +173,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
 
     try {
       assertNotNull(computerDetail.operations().getClass().getMethod(
-              "resetComputerDetailsSpecifications", Collection.class, Timestamp.class));
+              "resetComputerDetailsSpecifications", PrimitiveCollection.class, Timestamp.class));
     } catch (Exception e) {
       fail();
     }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/InvokeTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/InvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/InvokeTestITCase.java
index d4c2f00..efee258 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/InvokeTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/InvokeTestITCase.java
@@ -16,11 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 //CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ComputerDetail;
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ContactDetails;
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Customer;
@@ -29,17 +28,19 @@ import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.service
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Employee;
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.EmployeeCollection;
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Product;
-import org.junit.Test;
+
+import org.apache.commons.lang3.StringUtils;
 
 import java.math.BigDecimal;
 import java.sql.Timestamp;
 import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ContactDetailsCollection;
+
+import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -58,7 +59,7 @@ public class InvokeTestITCase extends AbstractTestITCase {
     assertEquals("Foo", string);
 
     // 2. complex collection result
-    final Collection<ContactDetails> details = container.operations().entityProjectionReturnsCollectionOfComplexTypes();
+    final ContactDetailsCollection details = container.operations().entityProjectionReturnsCollectionOfComplexTypes();
     assertFalse(details.isEmpty());
     for (ContactDetails detail : details) {
       assertNotNull(detail);
@@ -147,7 +148,7 @@ public class InvokeTestITCase extends AbstractTestITCase {
     product.setProductId(id);
     product.setDescription("New product");
 
-    final Dimensions origDimensions = service.newComplex(Dimensions.class);
+    final Dimensions origDimensions = service.newComplexInstance(Dimensions.class);
     origDimensions.setDepth(BigDecimal.ZERO);
     origDimensions.setHeight(BigDecimal.ZERO);
     origDimensions.setWidth(BigDecimal.ZERO);
@@ -165,7 +166,7 @@ public class InvokeTestITCase extends AbstractTestITCase {
 
     try {
       // 1. invoke action bound to the product just created
-      final Dimensions newDimensions = service.newComplex(Dimensions.class);
+      final Dimensions newDimensions = service.newComplexInstance(Dimensions.class);
       newDimensions.setDepth(BigDecimal.ONE);
       newDimensions.setHeight(BigDecimal.ONE);
       newDimensions.setWidth(BigDecimal.ONE);
@@ -199,7 +200,11 @@ public class InvokeTestITCase extends AbstractTestITCase {
 
     ComputerDetail computerDetail = service.newEntityInstance(ComputerDetail.class);
     computerDetail.setComputerDetailId(id);
-    computerDetail.setSpecificationsBag(Collections.singleton("First spec"));
+
+    final PrimitiveCollection<String> sb = service.newPrimitiveCollection(String.class);
+    sb.add("First spec");
+    computerDetail.setSpecificationsBag(sb);
+
     computerDetail.setPurchaseDate(new Timestamp(purchaseDate.getTimeInMillis()));
 
     container.getComputerDetail().add(computerDetail);
@@ -213,9 +218,12 @@ public class InvokeTestITCase extends AbstractTestITCase {
     assertEquals(purchaseDate.getTimeInMillis(), computerDetail.getPurchaseDate().getTime());
 
     try {
+      final PrimitiveCollection<String> cds = service.newPrimitiveCollection(String.class);
+      cds.add("Second spec");
+
       // 1. invoke action bound to the computer detail just created
       computerDetail.operations().resetComputerDetailsSpecifications(
-              Collections.singleton("Second spec"), new Timestamp(Calendar.getInstance().getTimeInMillis()));
+              cds, new Timestamp(Calendar.getInstance().getTimeInMillis()));
 
       // 2. check that invoked action has effectively run
       computerDetail = container.getComputerDetail().getByKey(id).load();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/MediaEntityTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/MediaEntityTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/MediaEntityTestITCase.java
index 500e64d..80255b0 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/MediaEntityTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/MediaEntityTestITCase.java
@@ -16,6 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.olingo.fit.proxy.v3;
 
 import org.apache.commons.io.IOUtils;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java
index 9db13bb..fcb5dc6 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java
@@ -93,7 +93,7 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
     rowIndex.addAdditionalProperty("aByte", Byte.MAX_VALUE);
     rowIndex.addAdditionalProperty("aDate", Calendar.getInstance());
 
-    final ContactDetails contact = otservice.newComplex(ContactDetails.class);
+    final ContactDetails contact = otservice.newComplexInstance(ContactDetails.class);
     contact.setFirstContacted("text".getBytes());
 
     Calendar cal = Calendar.getInstance();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/Aliases.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/Aliases.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/Aliases.java
index 8e92dfc..e150e4e 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/Aliases.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/Aliases.java
@@ -30,9 +30,9 @@ public interface Aliases
 
 
     @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AlternativeNames", type = "Edm.String", nullable = false)
-    java.util.Collection<java.lang.String> getAlternativeNames();
+    org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getAlternativeNames();
 
-    void setAlternativeNames(java.util.Collection<java.lang.String> _alternativeNames);
+    void setAlternativeNames(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _alternativeNames);
 
     
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialCollectionTypesCollection.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialCollectionTypesCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialCollectionTypesCollection.java
index 1a2bab6..ccf704d 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialCollectionTypesCollection.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialCollectionTypesCollection.java
@@ -26,7 +26,7 @@ import java.util.Collection;
 
 
 public interface AllSpatialCollectionTypesCollection extends 
-    org.apache.olingo.ext.proxy.api.EntityCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypes, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypesCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypesCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypes> {
+    org.apache.olingo.ext.proxy.api.StruncturedCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypes, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypesCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypesCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypes> {
 
   Object getAnnotation(Class<? extends AbstractTerm> term);
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialCollectionTypes_Simple.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialCollectionTypes_Simple.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialCollectionTypes_Simple.java
index b77873e..73e6a96 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialCollectionTypes_Simple.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialCollectionTypes_Simple.java
@@ -82,9 +82,9 @@ public interface AllSpatialCollectionTypes_Simple
                 fcNSPrefix = "",
                 fcNSURI = "",
                 fcKeepInContent = false)
-    java.util.Collection<org.apache.olingo.commons.api.edm.geo.Point> getManyGeogPoint();
+    org.apache.olingo.ext.proxy.api.PrimitiveCollection<org.apache.olingo.commons.api.edm.geo.Point> getManyGeogPoint();
 
-    void setManyGeogPoint(java.util.Collection<org.apache.olingo.commons.api.edm.geo.Point> _manyGeogPoint);
+    void setManyGeogPoint(org.apache.olingo.ext.proxy.api.PrimitiveCollection<org.apache.olingo.commons.api.edm.geo.Point> _manyGeogPoint);
     
     
     @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ManyGeogLine", 
@@ -105,9 +105,9 @@ public interface AllSpatialCollectionTypes_Simple
                 fcNSPrefix = "",
                 fcNSURI = "",
                 fcKeepInContent = false)
-    java.util.Collection<org.apache.olingo.commons.api.edm.geo.LineString> getManyGeogLine();
+    org.apache.olingo.ext.proxy.api.PrimitiveCollection<org.apache.olingo.commons.api.edm.geo.LineString> getManyGeogLine();
 
-    void setManyGeogLine(java.util.Collection<org.apache.olingo.commons.api.edm.geo.LineString> _manyGeogLine);
+    void setManyGeogLine(org.apache.olingo.ext.proxy.api.PrimitiveCollection<org.apache.olingo.commons.api.edm.geo.LineString> _manyGeogLine);
     
     
     @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ManyGeogPolygon", 
@@ -128,9 +128,9 @@ public interface AllSpatialCollectionTypes_Simple
                 fcNSPrefix = "",
                 fcNSURI = "",
                 fcKeepInContent = false)
-    java.util.Collection<org.apache.olingo.commons.api.edm.geo.Polygon> getManyGeogPolygon();
+    org.apache.olingo.ext.proxy.api.PrimitiveCollection<org.apache.olingo.commons.api.edm.geo.Polygon> getManyGeogPolygon();
 
-    void setManyGeogPolygon(java.util.Collection<org.apache.olingo.commons.api.edm.geo.Polygon> _manyGeogPolygon);
+    void setManyGeogPolygon(org.apache.olingo.ext.proxy.api.PrimitiveCollection<org.apache.olingo.commons.api.edm.geo.Polygon> _manyGeogPolygon);
     
     
     @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ManyGeomPoint", 
@@ -151,9 +151,9 @@ public interface AllSpatialCollectionTypes_Simple
                 fcNSPrefix = "",
                 fcNSURI = "",
                 fcKeepInContent = false)
-    java.util.Collection<org.apache.olingo.commons.api.edm.geo.Point> getManyGeomPoint();
+    org.apache.olingo.ext.proxy.api.PrimitiveCollection<org.apache.olingo.commons.api.edm.geo.Point> getManyGeomPoint();
 
-    void setManyGeomPoint(java.util.Collection<org.apache.olingo.commons.api.edm.geo.Point> _manyGeomPoint);
+    void setManyGeomPoint(org.apache.olingo.ext.proxy.api.PrimitiveCollection<org.apache.olingo.commons.api.edm.geo.Point> _manyGeomPoint);
     
     
     @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ManyGeomLine", 
@@ -174,9 +174,9 @@ public interface AllSpatialCollectionTypes_Simple
                 fcNSPrefix = "",
                 fcNSURI = "",
                 fcKeepInContent = false)
-    java.util.Collection<org.apache.olingo.commons.api.edm.geo.LineString> getManyGeomLine();
+    org.apache.olingo.ext.proxy.api.PrimitiveCollection<org.apache.olingo.commons.api.edm.geo.LineString> getManyGeomLine();
 
-    void setManyGeomLine(java.util.Collection<org.apache.olingo.commons.api.edm.geo.LineString> _manyGeomLine);
+    void setManyGeomLine(org.apache.olingo.ext.proxy.api.PrimitiveCollection<org.apache.olingo.commons.api.edm.geo.LineString> _manyGeomLine);
     
     
     @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ManyGeomPolygon", 
@@ -197,9 +197,9 @@ public interface AllSpatialCollectionTypes_Simple
                 fcNSPrefix = "",
                 fcNSURI = "",
                 fcKeepInContent = false)
-    java.util.Collection<org.apache.olingo.commons.api.edm.geo.Polygon> getManyGeomPolygon();
+    org.apache.olingo.ext.proxy.api.PrimitiveCollection<org.apache.olingo.commons.api.edm.geo.Polygon> getManyGeomPolygon();
 
-    void setManyGeomPolygon(java.util.Collection<org.apache.olingo.commons.api.edm.geo.Polygon> _manyGeomPolygon);
+    void setManyGeomPolygon(org.apache.olingo.ext.proxy.api.PrimitiveCollection<org.apache.olingo.commons.api.edm.geo.Polygon> _manyGeomPolygon);
     
 
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialCollectionTypes_SimpleCollection.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialCollectionTypes_SimpleCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialCollectionTypes_SimpleCollection.java
index 4ddc43a..7edc037 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialCollectionTypes_SimpleCollection.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialCollectionTypes_SimpleCollection.java
@@ -26,7 +26,7 @@ import java.util.Collection;
 
 
 public interface AllSpatialCollectionTypes_SimpleCollection extends 
-    org.apache.olingo.ext.proxy.api.EntityCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypes_Simple, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypes_SimpleCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypes_SimpleCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypes_Simple> {
+    org.apache.olingo.ext.proxy.api.StruncturedCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypes_Simple, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypes_SimpleCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypes_SimpleCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypes_Simple> {
 
   Object getAnnotation(Class<? extends AbstractTerm> term);
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialTypesCollection.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialTypesCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialTypesCollection.java
index 479e3e5..5679a2a 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialTypesCollection.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/AllSpatialTypesCollection.java
@@ -26,7 +26,7 @@ import java.util.Collection;
 
 
 public interface AllSpatialTypesCollection extends 
-    org.apache.olingo.ext.proxy.api.EntityCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialTypes, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialTypesCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialTypesCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialTypes> {
+    org.apache.olingo.ext.proxy.api.StruncturedCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialTypes, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialTypesCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialTypesCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialTypes> {
 
   Object getAnnotation(Class<? extends AbstractTerm> term);
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/BackOrderLine2Collection.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/BackOrderLine2Collection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/BackOrderLine2Collection.java
index 136256d..74657b1 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/BackOrderLine2Collection.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/BackOrderLine2Collection.java
@@ -26,7 +26,7 @@ import java.util.Collection;
 
 
 public interface BackOrderLine2Collection extends 
-    org.apache.olingo.ext.proxy.api.EntityCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLine2, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLine2Collection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLine2Collection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLine2> {
+    org.apache.olingo.ext.proxy.api.StruncturedCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLine2, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLine2Collection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLine2Collection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLine2> {
 
   Object getAnnotation(Class<? extends AbstractTerm> term);
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/BackOrderLineCollection.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/BackOrderLineCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/BackOrderLineCollection.java
index dbb7476..467e826 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/BackOrderLineCollection.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/BackOrderLineCollection.java
@@ -26,7 +26,7 @@ import java.util.Collection;
 
 
 public interface BackOrderLineCollection extends 
-    org.apache.olingo.ext.proxy.api.EntityCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLine, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLineCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLineCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLine> {
+    org.apache.olingo.ext.proxy.api.StruncturedCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLine, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLineCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLineCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLine> {
 
   Object getAnnotation(Class<? extends AbstractTerm> term);
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/CarCollection.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/CarCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/CarCollection.java
index 45219db..51b58b3 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/CarCollection.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/CarCollection.java
@@ -26,7 +26,7 @@ import java.util.Collection;
 
 
 public interface CarCollection extends 
-    org.apache.olingo.ext.proxy.api.EntityCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Car, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.CarCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.CarCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Car> {
+    org.apache.olingo.ext.proxy.api.StruncturedCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Car, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.CarCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.CarCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Car> {
 
   Object getAnnotation(Class<? extends AbstractTerm> term);
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ComputerCollection.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ComputerCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ComputerCollection.java
index be9873b..0418251 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ComputerCollection.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ComputerCollection.java
@@ -26,7 +26,7 @@ import java.util.Collection;
 
 
 public interface ComputerCollection extends 
-    org.apache.olingo.ext.proxy.api.EntityCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Computer, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ComputerCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ComputerCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Computer> {
+    org.apache.olingo.ext.proxy.api.StruncturedCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Computer, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ComputerCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ComputerCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Computer> {
 
   Object getAnnotation(Class<? extends AbstractTerm> term);
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ComputerDetail.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ComputerDetail.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ComputerDetail.java
index 4dd1511..48f9d6f 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ComputerDetail.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ComputerDetail.java
@@ -148,9 +148,9 @@ public interface ComputerDetail
                 fcNSPrefix = "",
                 fcNSURI = "",
                 fcKeepInContent = false)
-    java.util.Collection<java.lang.String> getSpecificationsBag();
+    org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getSpecificationsBag();
 
-    void setSpecificationsBag(java.util.Collection<java.lang.String> _specificationsBag);
+    void setSpecificationsBag(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _specificationsBag);
     
     
     @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PurchaseDate", 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ComputerDetailCollection.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ComputerDetailCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ComputerDetailCollection.java
index 3276e0d..f39f97a 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ComputerDetailCollection.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ComputerDetailCollection.java
@@ -26,7 +26,7 @@ import java.util.Collection;
 
 
 public interface ComputerDetailCollection extends 
-    org.apache.olingo.ext.proxy.api.EntityCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ComputerDetail, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ComputerDetailCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ComputerDetailCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ComputerDetail> {
+    org.apache.olingo.ext.proxy.api.StruncturedCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ComputerDetail, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ComputerDetailCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ComputerDetailCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ComputerDetail> {
 
   Object getAnnotation(Class<? extends AbstractTerm> term);
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ContactDetails.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ContactDetails.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ContactDetails.java
index dfb97ea..1be6da0 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ContactDetails.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ContactDetails.java
@@ -30,16 +30,16 @@ public interface ContactDetails
 
 
     @org.apache.olingo.ext.proxy.api.annotations.Property(name = "EmailBag", type = "Edm.String", nullable = false)
-    java.util.Collection<java.lang.String> getEmailBag();
+    org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getEmailBag();
 
-    void setEmailBag(java.util.Collection<java.lang.String> _emailBag);
+    void setEmailBag(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _emailBag);
 
     
 
     @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AlternativeNames", type = "Edm.String", nullable = false)
-    java.util.Collection<java.lang.String> getAlternativeNames();
+    org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getAlternativeNames();
 
-    void setAlternativeNames(java.util.Collection<java.lang.String> _alternativeNames);
+    void setAlternativeNames(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _alternativeNames);
 
     
 
@@ -65,9 +65,9 @@ public interface ContactDetails
         
 
     @org.apache.olingo.ext.proxy.api.annotations.Property(name = "MobilePhoneBag", type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone", nullable = false)
-    java.util.Collection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Phone> getMobilePhoneBag();
+    org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.PhoneCollection getMobilePhoneBag();
 
-    void setMobilePhoneBag(java.util.Collection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Phone> _mobilePhoneBag);
+    void setMobilePhoneBag(org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.PhoneCollection _mobilePhoneBag);
 
         
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ContractorCollection.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ContractorCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ContractorCollection.java
index 38b1c65..b2bc6f1 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ContractorCollection.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ContractorCollection.java
@@ -26,7 +26,7 @@ import java.util.Collection;
 
 
 public interface ContractorCollection extends 
-    org.apache.olingo.ext.proxy.api.EntityCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Contractor, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ContractorCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ContractorCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Contractor> {
+    org.apache.olingo.ext.proxy.api.StruncturedCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Contractor, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ContractorCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ContractorCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Contractor> {
 
   Object getAnnotation(Class<? extends AbstractTerm> term);
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/Customer.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/Customer.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/Customer.java
index fca91e8..32e4a54 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/Customer.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/Customer.java
@@ -171,9 +171,9 @@ public interface Customer
                 fcNSPrefix = "",
                 fcNSURI = "",
                 fcKeepInContent = false)
-    java.util.Collection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ContactDetails> getBackupContactInfo();
+    org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ContactDetailsCollection getBackupContactInfo();
 
-    void setBackupContactInfo(java.util.Collection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ContactDetails> _backupContactInfo);
+    void setBackupContactInfo(org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ContactDetailsCollection _backupContactInfo);
     
     
     @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Auditing", 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/acc5b5ce/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/CustomerCollection.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/CustomerCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/CustomerCollection.java
index 69ccede..f7089a4 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/CustomerCollection.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/CustomerCollection.java
@@ -26,7 +26,7 @@ import java.util.Collection;
 
 
 public interface CustomerCollection extends 
-    org.apache.olingo.ext.proxy.api.EntityCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Customer, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.CustomerCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.CustomerCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Customer> {
+    org.apache.olingo.ext.proxy.api.StruncturedCollectionQuery<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Customer, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.CustomerCollection, org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.CustomerCollection>, org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Customer> {
 
   Object getAnnotation(Class<? extends AbstractTerm> term);