java类javax.xml.bind.annotation.XmlEnum的实例源码

EnumLeafInfoImpl.java 文件源码 项目:OpenJSharp 阅读 26 收藏 0 点赞 0 评论 0
/**
 * @param clazz
 * @param type
 *      clazz and type should both point to the enum class
 *      that this {@link EnumLeafInfo} represents.
 *      Because of the type parameterization we have to take them separately.
 */
public EnumLeafInfoImpl(ModelBuilder<T,C,F,M> builder,
                        Locatable upstream, C clazz, T type ) {
    super(builder,upstream);
    this.clazz = clazz;
    this.type = type;

    elementName = parseElementName(clazz);

    // compute the type name
    // TODO: I guess it must be allowed for enums to have @XmlElement
    typeName = parseTypeName(clazz);

    // locate the base type.
    // this can be done eagerly because there shouldn't be no cycle.
    XmlEnum xe = builder.reader.getClassAnnotation(XmlEnum.class, clazz, this);
    if(xe!=null) {
        T base = builder.reader.getClassValue(xe, "value");
        baseType = builder.getTypeInfo(base,this);
    } else {
        baseType = builder.getTypeInfo(builder.nav.ref(String.class),this);
    }
}
EnumLeafInfoImpl.java 文件源码 项目:openjdk-jdk10 阅读 26 收藏 0 点赞 0 评论 0
/**
 * @param clazz
 * @param type
 *      clazz and type should both point to the enum class
 *      that this {@link EnumLeafInfo} represents.
 *      Because of the type parameterization we have to take them separately.
 */
public EnumLeafInfoImpl(ModelBuilder<T,C,F,M> builder,
                        Locatable upstream, C clazz, T type ) {
    super(builder,upstream);
    this.clazz = clazz;
    this.type = type;

    elementName = parseElementName(clazz);

    // compute the type name
    // TODO: I guess it must be allowed for enums to have @XmlElement
    typeName = parseTypeName(clazz);

    // locate the base type.
    // this can be done eagerly because there shouldn't be no cycle.
    XmlEnum xe = builder.reader.getClassAnnotation(XmlEnum.class, clazz, this);
    if(xe!=null) {
        T base = builder.reader.getClassValue(xe, "value");
        baseType = builder.getTypeInfo(base,this);
    } else {
        baseType = builder.getTypeInfo(builder.nav.ref(String.class),this);
    }
}
EnumLeafInfoImpl.java 文件源码 项目:openjdk9 阅读 25 收藏 0 点赞 0 评论 0
/**
 * @param clazz
 * @param type
 *      clazz and type should both point to the enum class
 *      that this {@link EnumLeafInfo} represents.
 *      Because of the type parameterization we have to take them separately.
 */
public EnumLeafInfoImpl(ModelBuilder<T,C,F,M> builder,
                        Locatable upstream, C clazz, T type ) {
    super(builder,upstream);
    this.clazz = clazz;
    this.type = type;

    elementName = parseElementName(clazz);

    // compute the type name
    // TODO: I guess it must be allowed for enums to have @XmlElement
    typeName = parseTypeName(clazz);

    // locate the base type.
    // this can be done eagerly because there shouldn't be no cycle.
    XmlEnum xe = builder.reader.getClassAnnotation(XmlEnum.class, clazz, this);
    if(xe!=null) {
        T base = builder.reader.getClassValue(xe, "value");
        baseType = builder.getTypeInfo(base,this);
    } else {
        baseType = builder.getTypeInfo(builder.nav.ref(String.class),this);
    }
}
EnumLeafInfoImpl.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 29 收藏 0 点赞 0 评论 0
/**
 * @param clazz
 * @param type
 *      clazz and type should both point to the enum class
 *      that this {@link EnumLeafInfo} represents.
 *      Because of the type parameterization we have to take them separately.
 */
public EnumLeafInfoImpl(ModelBuilder<T,C,F,M> builder,
                        Locatable upstream, C clazz, T type ) {
    super(builder,upstream);
    this.clazz = clazz;
    this.type = type;

    elementName = parseElementName(clazz);

    // compute the type name
    // TODO: I guess it must be allowed for enums to have @XmlElement
    typeName = parseTypeName(clazz);

    // locate the base type.
    // this can be done eagerly because there shouldn't be no cycle.
    XmlEnum xe = builder.reader.getClassAnnotation(XmlEnum.class, clazz, this);
    if(xe!=null) {
        T base = builder.reader.getClassValue(xe, "value");
        baseType = builder.getTypeInfo(base,this);
    } else {
        baseType = builder.getTypeInfo(builder.nav.ref(String.class),this);
    }
}
SimpleMarshallerMappingsFromAnnotationsLoader.java 文件源码 项目:r01fb 阅读 23 收藏 0 点赞 0 评论 0
private static String _typeNormalizedDesc(final Class<?> type) {
    String dataTypeDesc = null;
    if (CollectionUtils.isMap(type)) {
        //@SuppressWarnings("unchecked")
        //Class<? extends Map<?,?>> mapType =  (Class<? extends Map<?,?>>)type;
        // Map:(java.lang.Object,java.lang.Object)
        dataTypeDesc = "Map:" + type.getName() + "(" + Object.class.getCanonicalName() + "," + Object.class.getCanonicalName() + ")";

    } else if (CollectionUtils.isCollection(type)) {
        //@SuppressWarnings("unchecked")
        //Class<? extends Collection<?>> colType =  (Class<? extends Collection<?>>)type;
        dataTypeDesc = "Collection:" + type.getName() + "(" + Object.class.getCanonicalName() + ")";    

    } else if (type.isEnum() || type.getAnnotation(XmlEnum.class) != null) {
        dataTypeDesc = "Enum(" + type.getName() + ")";

    } else {
        dataTypeDesc = type.getName();
    }
    return dataTypeDesc;
}
EnumLeafInfoImpl.java 文件源码 项目:infobip-open-jdk-8 阅读 29 收藏 0 点赞 0 评论 0
/**
 * @param clazz
 * @param type
 *      clazz and type should both point to the enum class
 *      that this {@link EnumLeafInfo} represents.
 *      Because of the type parameterization we have to take them separately.
 */
public EnumLeafInfoImpl(ModelBuilder<T,C,F,M> builder,
                        Locatable upstream, C clazz, T type ) {
    super(builder,upstream);
    this.clazz = clazz;
    this.type = type;

    elementName = parseElementName(clazz);

    // compute the type name
    // TODO: I guess it must be allowed for enums to have @XmlElement
    typeName = parseTypeName(clazz);

    // locate the base type.
    // this can be done eagerly because there shouldn't be no cycle.
    XmlEnum xe = builder.reader.getClassAnnotation(XmlEnum.class, clazz, this);
    if(xe!=null) {
        T base = builder.reader.getClassValue(xe, "value");
        baseType = builder.getTypeInfo(base,this);
    } else {
        baseType = builder.getTypeInfo(builder.nav.ref(String.class),this);
    }
}
EnumLeafInfoImpl.java 文件源码 项目:cxf-plus 阅读 32 收藏 0 点赞 0 评论 0
/**
 * @param clazz
 * @param type
 *      clazz and type should both point to the enum class
 *      that this {@link EnumLeafInfo} represents.
 *      Because of the type parameterization we have to take them separately.
 */
public EnumLeafInfoImpl(ModelBuilder<T,C,F,M> builder,
                        Locatable upstream, C clazz, T type ) {
    super(builder,upstream);
    this.clazz = clazz;
    this.type = type;

    elementName = parseElementName(clazz);

    // compute the type name
    // TODO: I guess it must be allowed for enums to have @XmlElement
    typeName = parseTypeName(clazz);

    // locate the base type.
    // this can be done eagerly because there shouldn't be no cycle.
    XmlEnum xe = builder.reader.getClassAnnotation(XmlEnum.class, clazz, this);
    if(xe!=null) {
        T base = builder.reader.getClassValue(xe, "value");
        baseType = builder.getTypeInfo(base,this);
    } else {
        baseType = builder.getTypeInfo(builder.nav.ref(String.class),this);
    }
}
EnumLeafInfoImpl.java 文件源码 项目:OLD-OpenJDK8 阅读 23 收藏 0 点赞 0 评论 0
/**
 * @param clazz
 * @param type
 *      clazz and type should both point to the enum class
 *      that this {@link EnumLeafInfo} represents.
 *      Because of the type parameterization we have to take them separately.
 */
public EnumLeafInfoImpl(ModelBuilder<T,C,F,M> builder,
                        Locatable upstream, C clazz, T type ) {
    super(builder,upstream);
    this.clazz = clazz;
    this.type = type;

    elementName = parseElementName(clazz);

    // compute the type name
    // TODO: I guess it must be allowed for enums to have @XmlElement
    typeName = parseTypeName(clazz);

    // locate the base type.
    // this can be done eagerly because there shouldn't be no cycle.
    XmlEnum xe = builder.reader.getClassAnnotation(XmlEnum.class, clazz, this);
    if(xe!=null) {
        T base = builder.reader.getClassValue(xe, "value");
        baseType = builder.getTypeInfo(base,this);
    } else {
        baseType = builder.getTypeInfo(builder.nav.ref(String.class),this);
    }
}
EnumLeafInfoImpl.java 文件源码 项目:openjdk-icedtea7 阅读 24 收藏 0 点赞 0 评论 0
/**
 * @param clazz
 * @param type
 *      clazz and type should both point to the enum class
 *      that this {@link EnumLeafInfo} represents.
 *      Because of the type parameterization we have to take them separately.
 */
public EnumLeafInfoImpl(ModelBuilder<T,C,F,M> builder,
                        Locatable upstream, C clazz, T type ) {
    super(builder,upstream);
    this.clazz = clazz;
    this.type = type;

    elementName = parseElementName(clazz);

    // compute the type name
    // TODO: I guess it must be allowed for enums to have @XmlElement
    typeName = parseTypeName(clazz);

    // locate the base type.
    // this can be done eagerly because there shouldn't be no cycle.
    XmlEnum xe = builder.reader.getClassAnnotation(XmlEnum.class, clazz, this);
    if(xe!=null) {
        T base = builder.reader.getClassValue(xe, "value");
        baseType = builder.getTypeInfo(base,this);
    } else {
        baseType = builder.getTypeInfo(builder.nav.ref(String.class),this);
    }
}
XmlEnumUtils.java 文件源码 项目:wso2-axis2 阅读 31 收藏 0 点赞 0 评论 0
private static Method getConversionMethod(Class cls) {
    // Look for forName method that is generated by JAXB.
    Method m = fromValueMethod(cls, String.class);
    if (m != null) {
        return m;
    }

    // If cannot find forName(String) then look for @XmlEnum value
    if (log.isDebugEnabled()) {
        log.debug("try looking for @XmlEnum ");
    }
    XmlEnum xmlEnum = (XmlEnum)
        cls.getAnnotation(XmlEnum.class);
    if (xmlEnum != null) {
        Class argClass = xmlEnum.value();
        m = fromValueMethod(cls, argClass);
        if (m !=null) {
            return m;
        }
        Class primitiveClass = getPrimitiveClass(argClass);
        if (primitiveClass != null) {
            m = fromValueMethod(cls, primitiveClass);
            if (m != null) {
                return m;
            }
        }
    }

    // Look for valueOf(String) method
    if (log.isDebugEnabled()) {
        log.debug("try looking for valueOf method ");
    }
    m = valueOfMethod(cls);
    if (m != null) {
        return m;
    }

    throw new IllegalArgumentException();
}
XmlEnumQuick.java 文件源码 项目:openjdk-icedtea7 阅读 23 收藏 0 点赞 0 评论 0
public XmlEnumQuick(Locatable upstream, XmlEnum core) {
    super(upstream);
    this.core = core;
}
XmlEnumQuick.java 文件源码 项目:OpenJSharp 阅读 21 收藏 0 点赞 0 评论 0
public XmlEnumQuick(Locatable upstream, XmlEnum core) {
    super(upstream);
    this.core = core;
}
XmlEnumQuick.java 文件源码 项目:OpenJSharp 阅读 23 收藏 0 点赞 0 评论 0
protected Quick newInstance(Locatable upstream, Annotation core) {
    return new XmlEnumQuick(upstream, ((XmlEnum) core));
}
XmlEnumQuick.java 文件源码 项目:OpenJSharp 阅读 23 收藏 0 点赞 0 评论 0
public Class<XmlEnum> annotationType() {
    return XmlEnum.class;
}
XmlEnumQuick.java 文件源码 项目:openjdk-jdk10 阅读 25 收藏 0 点赞 0 评论 0
public XmlEnumQuick(Locatable upstream, XmlEnum core) {
    super(upstream);
    this.core = core;
}
XmlEnumQuick.java 文件源码 项目:openjdk-jdk10 阅读 23 收藏 0 点赞 0 评论 0
protected Quick newInstance(Locatable upstream, Annotation core) {
    return new XmlEnumQuick(upstream, ((XmlEnum) core));
}
XmlEnumQuick.java 文件源码 项目:openjdk-jdk10 阅读 20 收藏 0 点赞 0 评论 0
public Class<XmlEnum> annotationType() {
    return XmlEnum.class;
}
XmlEnumQuick.java 文件源码 项目:openjdk9 阅读 23 收藏 0 点赞 0 评论 0
public XmlEnumQuick(Locatable upstream, XmlEnum core) {
    super(upstream);
    this.core = core;
}
XmlEnumQuick.java 文件源码 项目:openjdk9 阅读 21 收藏 0 点赞 0 评论 0
protected Quick newInstance(Locatable upstream, Annotation core) {
    return new XmlEnumQuick(upstream, ((XmlEnum) core));
}
XmlEnumQuick.java 文件源码 项目:openjdk9 阅读 28 收藏 0 点赞 0 评论 0
public Class<XmlEnum> annotationType() {
    return XmlEnum.class;
}
XmlEnumQuick.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 23 收藏 0 点赞 0 评论 0
public XmlEnumQuick(Locatable upstream, XmlEnum core) {
    super(upstream);
    this.core = core;
}
XmlEnumQuick.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 20 收藏 0 点赞 0 评论 0
protected Quick newInstance(Locatable upstream, Annotation core) {
    return new XmlEnumQuick(upstream, ((XmlEnum) core));
}
XmlEnumQuick.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 23 收藏 0 点赞 0 评论 0
public Class<XmlEnum> annotationType() {
    return XmlEnum.class;
}
SimpleMarshallerMappingsFromAnnotationsLoader.java 文件源码 项目:r01fb 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Obtiene la descripci�n del tipo de un field en un formato normalizado a partir de ciertos datos de la clase, el field, etc
 * @param type el tipo que contiene el field
 * @param field el field
 * @param actualFieldType el tipo de dato actual del field (resolviendo gen�ricos, etc)
 * @return
 */
private static String _fieldTypeStandardDesc(final Class<?> type,
                                             final Field field,final Class<?> actualFieldType) {
    String dataTypeDesc = null;
    if (actualFieldType != Object.class && ReflectionUtils.isTypeDef(actualFieldType)) {
        // Definici�n de clase java
        dataTypeDesc = Class.class.getCanonicalName();  // "java.lang.Class";

    } else if (ReflectionUtils.isImplementing(actualFieldType,LanguageTexts.class) && !actualFieldType.equals(LanguageTextsI18NBundleBacked.class)) {
        //"Map:(r01f.locale.Language,java.lang.String)";
        dataTypeDesc = "Map:" + actualFieldType.getName() + "(" + Language.class.getCanonicalName() + "," + String.class.getCanonicalName() + ")";  

    } else if (CollectionUtils.isMap(actualFieldType)) {
        // Mapa
        Class<?> keyAndValueComponentTypes[] = _mapFieldKeyValueComponentTypes(type,field);
        if (keyAndValueComponentTypes != null && keyAndValueComponentTypes.length == 2) {
            String keyType = keyAndValueComponentTypes[0] != null ? keyAndValueComponentTypes[0].getName() 
                                                                  : Object.class.getCanonicalName(); //"java.lang.Object";
            String valueType = keyAndValueComponentTypes[1] != null ? keyAndValueComponentTypes[1].getName() 
                                                                    : Object.class.getCanonicalName(); //"java.lang.Object";
            dataTypeDesc = "Map:" + actualFieldType.getName() + "(" + keyType + "," + valueType + ")";
        } else {
            dataTypeDesc = "Map:" + actualFieldType.getName();
        }

    } else if (CollectionUtils.isCollection(actualFieldType)) {
        // Colecci�n
        Class<?> componentType = _collectionFieldComponentType(type,field);
        if (componentType != null) {
            dataTypeDesc = "Collection:" + actualFieldType.getName() + "(" + componentType.getName() + ")";
        } else {
            dataTypeDesc = "Collection:" + actualFieldType.getName();
        }

    } else if (CollectionUtils.isArray(actualFieldType)) {
        // Array
        dataTypeDesc = _collectionFieldComponentType(type,field).getName() + "[]";

    } else if (actualFieldType.isEnum() || actualFieldType.getAnnotation(XmlEnum.class) != null) {
        // Enumeraci�n
        dataTypeDesc = "Enum(" + actualFieldType.getName() + ")";

    } else if (!actualFieldType.isPrimitive() && !ReflectionUtils.isInstanciable(actualFieldType)) {
        // [C] Es un interfaz
        dataTypeDesc = field.getType().getName();

    } else {
        // [D] Tipo NO generico (el caso m�s normal)
        dataTypeDesc = actualFieldType.getName();
    }
    return dataTypeDesc;
}
XmlEnumQuick.java 文件源码 项目:infobip-open-jdk-8 阅读 27 收藏 0 点赞 0 评论 0
public XmlEnumQuick(Locatable upstream, XmlEnum core) {
    super(upstream);
    this.core = core;
}
XmlEnumQuick.java 文件源码 项目:infobip-open-jdk-8 阅读 24 收藏 0 点赞 0 评论 0
protected Quick newInstance(Locatable upstream, Annotation core) {
    return new XmlEnumQuick(upstream, ((XmlEnum) core));
}
XmlEnumQuick.java 文件源码 项目:infobip-open-jdk-8 阅读 23 收藏 0 点赞 0 评论 0
public Class<XmlEnum> annotationType() {
    return XmlEnum.class;
}
XmlEnumQuick.java 文件源码 项目:cxf-plus 阅读 20 收藏 0 点赞 0 评论 0
public XmlEnumQuick(Locatable upstream, XmlEnum core) {
    super(upstream);
    this.core = core;
}
XmlEnumQuick.java 文件源码 项目:cxf-plus 阅读 25 收藏 0 点赞 0 评论 0
protected Quick newInstance(Locatable upstream, Annotation core) {
    return new XmlEnumQuick(upstream, ((XmlEnum) core));
}
XmlEnumQuick.java 文件源码 项目:cxf-plus 阅读 22 收藏 0 点赞 0 评论 0
public Class<XmlEnum> annotationType() {
    return XmlEnum.class;
}


问题


面经


文章

微信
公众号

扫码关注公众号