It's done the same way as what you are going for the Map below. You need to
write a @XmlJavaTypeAdapter thing to map the Credential to/from a concrete
class.
Most likely, in your case, the adapter would map Credential <-->
BaseCredential and you would then use XmlSeeAlso annotations to register the
concrete subtypes (PasswordCredential plus others).
Dan
On Tue August 11 2009 3:30:27 pm Suneet Shah wrote:
> Hello:
>
> How do you deal with or annotate interfaces in JAX-WS? I have the class
> below that has a variable of type "Credential". Credential in this case
> is an interface and is set using Spring's dependency injection. I have
> pasted below the code for the interface and the implementation classes.
> I am not sure what I should be annotating and how.:
>
> public class AuthenticationContextImpl implements Serializable,
> AuthenticationContext {
>
> private String authenticationType;
> private String resourceId;
> private Credential credential;
> private String domainId;
> private String principal;
> private String password;
> @XmlJavaTypeAdapter(ObjectMapAdapter.class)
> private Map<String,Object> authParam = new HashMap();
>
>
> Above Credential is an interface. I have an implement to the interface,
> but I am not sure how to deal with this.
>
> public interface Credential {
>
> }
>
> public abstract class BaseCredential implements Credential {
>
> public BaseCredential() {
>
> }
> }
>
>
> XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name = "PasswordCredential", propOrder = {
> "domainId",
> "principal",
> "password"
> })
> public class PasswordCredential extends BaseCredential {
>
> String domainId;
> String principal;
> String password;
>
> public PasswordCredential() {
>
> }
>
>
> Thanks
> Suneet
--
Daniel Kulp
[email protected]
http://www.dankulp.com/blog