vendredi 22 mai 2015

name of design pattern for below approach

I have open source code,my target was to add some functionality to this code without breaking the opensource structure. For example

class OpensourceClass{
       String getValue(){
         return "";
       }
   }

so I created a interface int class and a instance of that interface is introduced in opensource class

 class OpensourceClass{
       public static interface userImpl{
          String getValue();
       }

        private static userImpl obj;

      public static  void setUserImpl(userImpl ob){
          obj=ob;
      }
       String getValue(){
           if(userImpl)
              return userImpl.getValue();
             return "";
      }
    }

Just want to know which design pattern this.. Is it a strategy pattern.

Aucun commentaire:

Enregistrer un commentaire