/** * @return Returns the java type as a Class. * For a generic, return the raw type. For something * truly exotic, return null. */ public Class<?> getTypeClass() { return TypeUtil.getTypeRelatedClass(typeClass); }
/** * @return Returns the java type as a Class. * For a generic, return the raw type. For something * truly exotic, return null. */ public Class<?> getTypeClass() { return TypeUtil.getTypeRelatedClass(typeClass); }
/** * If a Type is a class, return it as a class. * If it is a ParameterizedType, return the raw type as a class. * Otherwise return null. * @param type * @return */ public static Class<?> getTypeRelatedClass(Type type) { Class<?> directClass = getTypeClass(type, false); if (directClass != null) { return directClass; } if (type instanceof ParameterizedType) { ParameterizedType pType = (ParameterizedType) type; return getTypeRelatedClass(pType.getRawType()); } if (type instanceof GenericArrayType) { GenericArrayType gat = (GenericArrayType) type; Type compType = gat.getGenericComponentType(); Class<?> arrayBaseType = getTypeRelatedClass(compType); // believe it or not, this seems to be the only way to get the // Class object for an array of primitive type. Object instance = Array.newInstance(arrayBaseType, 0); return instance.getClass(); } return null; } }
/** * If a Type is a class, return it as a class. * If it is a ParameterizedType, return the raw type as a class. * Otherwise return null. * @param type * @return */ public static Class<?> getTypeRelatedClass(Type type) { Class<?> directClass = getTypeClass(type, false); if (directClass != null) { return directClass; } if (type instanceof ParameterizedType) { ParameterizedType pType = (ParameterizedType) type; return getTypeRelatedClass(pType.getRawType()); } if (type instanceof GenericArrayType) { GenericArrayType gat = (GenericArrayType) type; Type compType = gat.getGenericComponentType(); Class<?> arrayBaseType = getTypeRelatedClass(compType); // believe it or not, this seems to be the only way to get the // Class object for an array of primitive type. Object instance = Array.newInstance(arrayBaseType, 0); return instance.getClass(); } return null; } }
protected QName createMapQName(TypeClassInfo info, AegisType keyType, AegisType valueType) { String name = keyType.getSchemaType().getLocalPart() + '2' + valueType.getSchemaType().getLocalPart(); Class<?> cls = TypeUtil.getTypeRelatedClass(info.getType()); name += cls.getSimpleName(); // TODO: Get namespace from XML? return new QName(tm.getMappingIdentifierURI(), name); }
protected QName createMapQName(TypeClassInfo info, AegisType keyType, AegisType valueType) { String name = keyType.getSchemaType().getLocalPart() + '2' + valueType.getSchemaType().getLocalPart(); Class<?> cls = TypeUtil.getTypeRelatedClass(info.getType()); name += cls.getSimpleName(); // TODO: Get namespace from XML? return new QName(tm.getMappingIdentifierURI(), name); }
Class<?> clazz = TypeUtil.getTypeRelatedClass(paramType); if (clazz == null) { return createObjectType();
Class<?> typeClass = TypeUtil.getTypeRelatedClass(info.getType()); if (typeClass.getPackage().getName().startsWith("java")) { name = tm.getTypeQName(typeClass);
Class<?> clazz = TypeUtil.getTypeRelatedClass(paramType); if (clazz == null) { return createObjectType();
Class<?> typeClass = TypeUtil.getTypeRelatedClass(info.getType()); if (typeClass.getPackage().getName().startsWith("java")) { name = tm.getTypeQName(typeClass);
@Override public AegisType createEnumType(TypeClassInfo info) { EnumType type = new EnumType(); type.setSchemaType(createQName(TypeUtil.getTypeRelatedClass(info.getType()))); type.setTypeClass(info.getType()); type.setTypeMapping(getTypeMapping()); return type; }
@Override public AegisType createEnumType(TypeClassInfo info) { EnumType type = new EnumType(); type.setSchemaType(createQName(TypeUtil.getTypeRelatedClass(info.getType()))); type.setTypeClass(info.getType()); type.setTypeMapping(getTypeMapping()); return type; }
info.setMappedName(createQName(parameter, DOMUtils.getAttributeValueEmptyNull(parameter, "mappedName"))); Class<?> relatedClass = TypeUtil.getTypeRelatedClass(info.getType());
info.setMappedName(createQName(parameter, DOMUtils.getAttributeValueEmptyNull(parameter, "mappedName"))); Class<?> relatedClass = TypeUtil.getTypeRelatedClass(info.getType());
Element mapping = findMapping(info.getType()); List<Element> mappings = findMappings(info.getType()); Class<?> relatedClass = TypeUtil.getTypeRelatedClass(info.getType());
Element mapping = findMapping(info.getType()); List<Element> mappings = findMappings(info.getType()); Class<?> relatedClass = TypeUtil.getTypeRelatedClass(info.getType());
@Override public AegisType createDefaultType(TypeClassInfo info) { QName typeName = info.getTypeName(); Class<?> relatedClass = TypeUtil.getTypeRelatedClass(info.getType()); if (typeName == null) { typeName = createQName(relatedClass); } AnnotatedTypeInfo typeInfo = new AnnotatedTypeInfo( getTypeMapping(), relatedClass, typeName.getNamespaceURI(), getConfiguration()); typeInfo.setExtensibleElements(annotationReader.isExtensibleElements( relatedClass, getConfiguration().isDefaultExtensibleElements())); typeInfo.setExtensibleAttributes(annotationReader.isExtensibleAttributes( relatedClass, getConfiguration().isDefaultExtensibleAttributes())); typeInfo.setDefaultMinOccurs(getConfiguration().getDefaultMinOccurs()); typeInfo.setDefaultNillable(getConfiguration().isDefaultNillable()); BeanType type = new BeanType(typeInfo); type.setTypeMapping(getTypeMapping()); type.setSchemaType(typeName); return type; }
@Override public AegisType createDefaultType(TypeClassInfo info) { QName typeName = info.getTypeName(); Class<?> relatedClass = TypeUtil.getTypeRelatedClass(info.getType()); if (typeName == null) { typeName = createQName(relatedClass); } AnnotatedTypeInfo typeInfo = new AnnotatedTypeInfo( getTypeMapping(), relatedClass, typeName.getNamespaceURI(), getConfiguration()); typeInfo.setExtensibleElements(annotationReader.isExtensibleElements( relatedClass, getConfiguration().isDefaultExtensibleElements())); typeInfo.setExtensibleAttributes(annotationReader.isExtensibleAttributes( relatedClass, getConfiguration().isDefaultExtensibleAttributes())); typeInfo.setDefaultMinOccurs(getConfiguration().getDefaultMinOccurs()); typeInfo.setDefaultNillable(getConfiguration().isDefaultNillable()); BeanType type = new BeanType(typeInfo); type.setTypeMapping(getTypeMapping()); type.setSchemaType(typeName); return type; }
public AegisType createTypeForClass(TypeClassInfo info) { Class<?> javaClass = TypeUtil.getTypeRelatedClass(info.getType()); AegisType result = null; boolean newType = true;
public AegisType createTypeForClass(TypeClassInfo info) { Class<?> javaClass = TypeUtil.getTypeRelatedClass(info.getType()); AegisType result = null; boolean newType = true;