< prev index next >
src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/TypeInfo.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 31,42 ****
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.xml.namespace.QName;
!
! import com.sun.xml.internal.bind.v2.model.nav.Navigator;
/**
* A reference to a JAXB-bound type.
*
* <p>
--- 31,41 ----
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.xml.namespace.QName;
! import javax.xml.bind.annotation.XmlElementWrapper;
/**
* A reference to a JAXB-bound type.
*
* <p>
*** 73,82 ****
--- 72,83 ----
private boolean isGlobalElement = true;
private TypeInfo parentCollectionType;
+ private TypeInfo wrapperType;
+
private Type genericType;
private boolean nillable = true;
public TypeInfo(QName tagName, Type type, Annotation... annotations) {
*** 170,196 ****
return new StringBuilder("TypeInfo: Type = ").append(type)
.append(", tag = ").append(tagName).toString();
}
public TypeInfo getItemType() {
- // System.out.println("????? TypeInfo " + type);
if (type instanceof Class && ((Class)type).isArray() && !byte[].class.equals(type)) {
Type componentType = ((Class)type).getComponentType();
Type genericComponentType = null;
if (genericType!= null && genericType instanceof GenericArrayType) {
GenericArrayType arrayType = (GenericArrayType) type;
genericComponentType = arrayType.getGenericComponentType();
componentType = arrayType.getGenericComponentType();
}
TypeInfo ti =new TypeInfo(tagName, componentType, annotations);
if (genericComponentType != null) ti.setGenericType(genericComponentType);
return ti;
}
// if (type instanceof Class && java.util.Collection.class.isAssignableFrom((Class)type)) {
Type t = (genericType != null)? genericType : type;
Type base = Utils.REFLECTION_NAVIGATOR.getBaseClass(t, Collection.class);
if ( base != null) {
return new TypeInfo(tagName, Utils.REFLECTION_NAVIGATOR.getTypeArgument(base,0), annotations);
}
return null;
}
}
--- 171,201 ----
return new StringBuilder("TypeInfo: Type = ").append(type)
.append(", tag = ").append(tagName).toString();
}
public TypeInfo getItemType() {
if (type instanceof Class && ((Class)type).isArray() && !byte[].class.equals(type)) {
Type componentType = ((Class)type).getComponentType();
Type genericComponentType = null;
if (genericType!= null && genericType instanceof GenericArrayType) {
GenericArrayType arrayType = (GenericArrayType) type;
genericComponentType = arrayType.getGenericComponentType();
componentType = arrayType.getGenericComponentType();
}
TypeInfo ti =new TypeInfo(tagName, componentType, annotations);
if (genericComponentType != null) ti.setGenericType(genericComponentType);
+ for(Annotation anno : annotations) if (anno instanceof XmlElementWrapper) ti.wrapperType = this;
return ti;
}
// if (type instanceof Class && java.util.Collection.class.isAssignableFrom((Class)type)) {
Type t = (genericType != null)? genericType : type;
Type base = Utils.REFLECTION_NAVIGATOR.getBaseClass(t, Collection.class);
if ( base != null) {
return new TypeInfo(tagName, Utils.REFLECTION_NAVIGATOR.getTypeArgument(base,0), annotations);
}
return null;
}
+
+ public TypeInfo getWrapperType() {
+ return wrapperType;
+ }
}
< prev index next >