src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/TypeInfo.java

changeset 368
0989ad8c0860
parent 286
f50545b5e2f1
child 450
b0c2840e2513
     1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/TypeInfo.java	Thu Apr 04 19:05:24 2013 -0700
     1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/TypeInfo.java	Tue Apr 09 14:51:13 2013 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -26,6 +26,7 @@
    1.11  package com.sun.xml.internal.ws.spi.db;
    1.12  
    1.13  import java.lang.annotation.Annotation;
    1.14 +import java.lang.reflect.GenericArrayType;
    1.15  import java.lang.reflect.Type;
    1.16  import java.util.Collection;
    1.17  import java.util.HashMap;
    1.18 @@ -117,8 +118,8 @@
    1.19      public TypeInfo toItemType() {
    1.20          // if we are to reinstitute this check, check JAXB annotations only
    1.21          // assert annotations.length==0;   // not designed to work with adapters.
    1.22 -
    1.23 -        Type base = Navigator.REFLECTION.getBaseClass(type, Collection.class);
    1.24 +        Type t = (genericType != null)? genericType : type;
    1.25 +        Type base = Navigator.REFLECTION.getBaseClass(t, Collection.class);
    1.26          if(base==null)
    1.27              return this;    // not a collection
    1.28  
    1.29 @@ -170,4 +171,27 @@
    1.30          return new StringBuilder("TypeInfo: Type = ").append(type)
    1.31                  .append(", tag = ").append(tagName).toString();
    1.32      }
    1.33 +
    1.34 +    public TypeInfo getItemType() {
    1.35 +//      System.out.println("????? TypeInfo " + type);
    1.36 +        if (type instanceof Class && ((Class)type).isArray() && !byte[].class.equals(type)) {
    1.37 +            Type componentType = ((Class)type).getComponentType();
    1.38 +            Type genericComponentType = null;
    1.39 +            if (genericType!= null && genericType instanceof GenericArrayType) {
    1.40 +                GenericArrayType arrayType = (GenericArrayType) type;
    1.41 +                genericComponentType = arrayType.getGenericComponentType();
    1.42 +                componentType = arrayType.getGenericComponentType();
    1.43 +            }
    1.44 +            TypeInfo ti =new TypeInfo(tagName, componentType, annotations);
    1.45 +            if (genericComponentType != null) ti.setGenericType(genericComponentType);
    1.46 +            return ti;
    1.47 +        }
    1.48 +//        if (type instanceof Class && java.util.Collection.class.isAssignableFrom((Class)type)) {
    1.49 +        Type t = (genericType != null)? genericType : type;
    1.50 +        Type base = Navigator.REFLECTION.getBaseClass(t, Collection.class);
    1.51 +        if ( base != null)  {
    1.52 +            return new TypeInfo(tagName, Navigator.REFLECTION.getTypeArgument(base,0), annotations);
    1.53 +        }
    1.54 +        return null;
    1.55 +    }
    1.56  }

mercurial