Skip to main content

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

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



Back to the top