Annotation Type ResolveWith


  • @Documented
    @Retention(RUNTIME)
    @Target(TYPE)
    public @interface ResolveWith
    As credentials evolve we need to be able to map legacy credential types to newer common interfaces and implementations. For example code that requires a credential that holds a username and password should be looking for StandardUsernamePasswordCredentials, and existing legacy implementations of corresponding credential types should be using readResolve() to map down to that interface. But what happens to legacy code that is looking for the legacy type? By annotating the legacy type with ResolveWith we can provide the legacy code with the credentials it seeks while migrating those legacy types to the common parent. For example
         public class SSHUserPassCredential {
             // ...
             @Extension
             public static class DescriptorImpl extends CredentialsDescriptor {
                 // ...
             }
         }
     
    should be transformed into
         @ResolveWith(SSHUserPassCredentials.ResolverImpl.class)
         public class SSHUserPassCredential implements StandardUsernamePasswordCredentials {
             // ...
             public static class ResolverImpl extends CredentialsResolver {
                 // ...
             }
         }