[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] Types of objects returned by IQueryable

I did some research in the code and I didn't find any query that asks for both keys and descriptors. An easier way to get an explicit type would be to retain the IRepository as an IQueryable and let the IArtifactRepository query return keys only. A special method can be added to return an IQueryable for the descriptors, i.e.

public interface IRepository<T> extends IQueryable<T>

public interfact IArtifactRepository extends IRepository<IArtifactKey> {
  IQueryable<IArtifactDescriptor> getQueryableDescriptors();
}

- thomas


On 2009-12-21 15:49, Thomas Hallgren wrote:
Hi,
Aside from the IArtifactRepository, is there any IQueryable that has an iterator that can return objects of different types?


The reason I ask is that it would be beneficial to think about the IQueryable in terms of generics (even if we don't use them currently). I.e.:

public interface IQueryable<T> {
   Iterator<T> iterator();
}

The IQuery and IQueryResult could then also be made to act on specific types:

public interface IQuery<T> {
  IQueryResult<T> perform(Iterator<T> iterator);
}

public interface IQueryResult<T> {
  Iterator<T> iterator();
  ...
}

etc.

The reason I ask, is that we would then need to reconsider the decision to make the IRepository extend the IQueryable and instead do something like:

public interface IArtifactRepository extends IRepository {
  IQueryable<IArtifactKey> getQueryableKeys();

  IQueryable<IArtifactDescriptor> getQueryableDescriptors();
  ...
}

public interface IMetadataRepository extends IRepository {
  IQueryable<IInstallableUnits> getQueryable();
}

Sure, that would eliminate the ability to write a query that processes both keys and descriptors, but do we really need that?

One reason I bring this up is that I'm thinking about how to make an IQueryable capable of providing indexes. An index is easier to express if it is connected to a specific type.

Are we still planning to do Java 5 generics in the API?

- thomas

_______________________________________________
p2-dev mailing list
p2-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/p2-dev