vendredi 21 octobre 2016

Expose tyoes of a class from the service without coupling the types/values with the caller/client

This is a very generic and design question, and hopefully fits into the stack overflow criterion.

I have a library that has an interface Type which statically declared 4 types of itself inside of it. The code looks like this:

public interface type
{
  String getType();
   public static final Type Type1 = new Type()...
   public static final Type Type2 = new Type()...
   public static final Type Type3 = new Type()...
   public static final Type Type4 = new Type()...
}

The Clients when calling the library passes a List of Type to the library in which Type is defined. Now I want to make it generic to allow client to pass any number of types and any types and not depend on the types exposed from the library.

What would be the best practice to remove this coupling between types exposed by the library and passed from the client?

Aucun commentaire:

Enregistrer un commentaire