1 package org.codehaus.xfire.aegis.type; 2 3 import java.beans.PropertyDescriptor; 4 import java.lang.reflect.Method; 5 6 import org.codehaus.xfire.XFireRuntimeException; 7 import org.codehaus.xfire.aegis.type.basic.BeanType; 8 9 public class DefaultTypeCreator extends AbstractTypeCreator 10 { 11 public TypeClassInfo createClassInfo(Method m, int index) 12 { 13 TypeClassInfo info = new TypeClassInfo(); 14 15 if(index >= 0) info.setTypeClass(m.getParameterTypes()[index]); 16 else info.setTypeClass(m.getReturnType()); 17 18 return info; 19 } 20 21 public TypeClassInfo createClassInfo(PropertyDescriptor pd) 22 { 23 return createBasicClassInfo(pd.getPropertyType()); 24 } 25 26 public Type createCollectionType(TypeClassInfo info) 27 { 28 if(info.getGenericType() == null) 29 { 30 throw new XFireRuntimeException("Cannot create mapping for " + 31 info.getTypeClass().getName() + 32 ", unspecified component type"); 33 } 34 35 return createCollectionType(info, (Class)info.getGenericType()); 36 } 37 38 public Type createDefaultType(TypeClassInfo info) 39 { 40 BeanType type = new BeanType(); 41 type.setSchemaType(createQName(info.getTypeClass())); 42 type.setTypeClass(info.getTypeClass()); 43 type.setTypeMapping(getTypeMapping()); 44 45 return type; 46 } 47 }