else
return null;
}
else if (type instanceof ParameterizedType) {
ParameterizedType ptype = (ParameterizedType) type;
Type rawType = ptype.getRawType();
if (rawType instanceof Class) {
Class rawClass = (Class) rawType;
if (Map.class.isAssignableFrom(rawClass)) {
Type[] args = ptype.getActualTypeArguments();
if (args.length != 2)
throw new JAXBException(L.l("unexpected number of generic arguments for Map<>: {0}", args.length));
Property keyProperty = createProperty(args[0], anyType);
Property valueProperty = createProperty(args[1], anyType);
return new MapProperty(rawClass, keyProperty, valueProperty);
}
if (Collection.class.isAssignableFrom(rawClass)) {
Type[] args = ptype.getActualTypeArguments();
if (args.length != 1)
throw new JAXBException(L.l("unexpected number of generic arguments for List<>: {0}", args.length));
Property componentProperty = createProperty(args[0], anyType);
if (xmlList) {
if (! (componentProperty instanceof CDataProperty))
throw new JAXBException(L.l("Elements annotated with @XmlList or @XmlValue must be simple XML types"));
CDataProperty cdataProperty = (CDataProperty) componentProperty;
return new XmlListCollectionProperty(cdataProperty, rawClass);
}
else if (List.class.isAssignableFrom(rawClass))
return new ListProperty(componentProperty);
else
return new CollectionProperty(componentProperty);
}
}
}
else if (type instanceof GenericArrayType) {
Type component = ((GenericArrayType) type).getGenericComponentType();
if (byte.class.equals(component))
return ByteArrayProperty.PROPERTY;
// XXX other component types?