com.sun.xml.internal.bind.v2.model.core.PropertyInfo Java Examples

The following examples show how to use com.sun.xml.internal.bind.v2.model.core.PropertyInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XmlSchemaGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Builds content model writer for the specified property.
 */
private Tree buildPropertyContentModel(PropertyInfo<T,C> p) {
    switch(p.kind()) {
    case ELEMENT:
        return handleElementProp((ElementPropertyInfo<T,C>)p);
    case ATTRIBUTE:
        // attribuets are handled later
        return null;
    case REFERENCE:
        return handleReferenceProp((ReferencePropertyInfo<T,C>)p);
    case MAP:
        return handleMapProp((MapPropertyInfo<T,C>)p);
    case VALUE:
        // value props handled above in writeClass()
        assert false;
        throw new IllegalStateException();
    default:
        assert false;
        throw new IllegalStateException();
    }
}
 
Example #2
Source File: ModelBuilder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Getting parametrized classes of {@code JAXBElement<...>} property
 * @param p property which parametrized types we will try to get
 * @return null - if it's not JAXBElement property, or it's not parametrized, and array of parametrized classes in other case
 */
private Class[] getParametrizedTypes(PropertyInfo p) {
    try {
        Type pType = ((RuntimePropertyInfo) p).getIndividualType();
        if (pType instanceof ParameterizedType) {
            ParameterizedType prmzdType = (ParameterizedType) pType;
            if (prmzdType.getRawType() == JAXBElement.class) {
                Type[] actualTypes = prmzdType.getActualTypeArguments();
                Class[] result = new Class[actualTypes.length];
                for (int i = 0; i < actualTypes.length; i++) {
                    result[i] = (Class) actualTypes[i];
                }
                return result;
            }
        }
    } catch (Exception e) {
        logger.log(Level.FINE, "Error in ModelBuilder.getParametrizedTypes. " + e.getMessage());
    }
    return null;
}
 
Example #3
Source File: XmlSchemaGenerator.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Process the given PropertyInfo looking for references to namespaces that
 * are foreign to the given namespace.  Any foreign namespace references
 * found are added to the given namespaces dependency list and an &lt;import>
 * is generated for it.
 *
 * @param p the PropertyInfo
 */
private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) {
    for (TypeInfo<T, C> t : p.ref()) {
        if ((t instanceof ClassInfo) && (processingDepth > 0)) {
            java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties();
            for (PropertyInfo subp : l) {
                processForeignNamespaces(subp, --processingDepth);
            }
        }
        if (t instanceof Element) {
            addDependencyTo(((Element) t).getElementName());
        }
        if (t instanceof NonElement) {
            addDependencyTo(((NonElement) t).getTypeName());
        }
    }
}
 
Example #4
Source File: ModelBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Getting parametrized classes of {@code JAXBElement<...>} property
 * @param p property which parametrized types we will try to get
 * @return null - if it's not JAXBElement property, or it's not parametrized, and array of parametrized classes in other case
 */
private Class[] getParametrizedTypes(PropertyInfo p) {
    try {
        Type pType = ((RuntimePropertyInfo) p).getIndividualType();
        if (pType instanceof ParameterizedType) {
            ParameterizedType prmzdType = (ParameterizedType) pType;
            if (prmzdType.getRawType() == JAXBElement.class) {
                Type[] actualTypes = prmzdType.getActualTypeArguments();
                Class[] result = new Class[actualTypes.length];
                for (int i = 0; i < actualTypes.length; i++) {
                    result[i] = (Class) actualTypes[i];
                }
                return result;
            }
        }
    } catch (Exception e) {
        logger.log(Level.FINE, "Error in ModelBuilder.getParametrizedTypes. " + e.getMessage());
    }
    return null;
}
 
Example #5
Source File: ModelBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Getting parametrized classes of {@code JAXBElement<...>} property
 * @param p property which parametrized types we will try to get
 * @return null - if it's not JAXBElement property, or it's not parametrized, and array of parametrized classes in other case
 */
private Class[] getParametrizedTypes(PropertyInfo p) {
    try {
        Type pType = ((RuntimePropertyInfo) p).getIndividualType();
        if (pType instanceof ParameterizedType) {
            ParameterizedType prmzdType = (ParameterizedType) pType;
            if (prmzdType.getRawType() == JAXBElement.class) {
                Type[] actualTypes = prmzdType.getActualTypeArguments();
                Class[] result = new Class[actualTypes.length];
                for (int i = 0; i < actualTypes.length; i++) {
                    result[i] = (Class) actualTypes[i];
                }
                return result;
            }
        }
    } catch (Exception e) {
        logger.log(Level.FINE, "Error in ModelBuilder.getParametrizedTypes. " + e.getMessage());
    }
    return null;
}
 
Example #6
Source File: XmlSchemaGenerator.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Builds content model writer for the specified property.
 */
private Tree buildPropertyContentModel(PropertyInfo<T,C> p) {
    switch(p.kind()) {
    case ELEMENT:
        return handleElementProp((ElementPropertyInfo<T,C>)p);
    case ATTRIBUTE:
        // attribuets are handled later
        return null;
    case REFERENCE:
        return handleReferenceProp((ReferencePropertyInfo<T,C>)p);
    case MAP:
        return handleMapProp((MapPropertyInfo<T,C>)p);
    case VALUE:
        // value props handled above in writeClass()
        assert false;
        throw new IllegalStateException();
    default:
        assert false;
        throw new IllegalStateException();
    }
}
 
Example #7
Source File: XmlSchemaGenerator.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Process the given PropertyInfo looking for references to namespaces that
 * are foreign to the given namespace.  Any foreign namespace references
 * found are added to the given namespaces dependency list and an &lt;import>
 * is generated for it.
 *
 * @param p the PropertyInfo
 */
private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) {
    for (TypeInfo<T, C> t : p.ref()) {
        if ((t instanceof ClassInfo) && (processingDepth > 0)) {
            java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties();
            for (PropertyInfo subp : l) {
                processForeignNamespaces(subp, --processingDepth);
            }
        }
        if (t instanceof Element) {
            addDependencyTo(((Element) t).getElementName());
        }
        if (t instanceof NonElement) {
            addDependencyTo(((NonElement) t).getTypeName());
        }
    }
}
 
Example #8
Source File: XmlSchemaGenerator.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Process the given PropertyInfo looking for references to namespaces that
 * are foreign to the given namespace.  Any foreign namespace references
 * found are added to the given namespaces dependency list and an &lt;import>
 * is generated for it.
 *
 * @param p the PropertyInfo
 */
private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) {
    for (TypeInfo<T, C> t : p.ref()) {
        if ((t instanceof ClassInfo) && (processingDepth > 0)) {
            java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties();
            for (PropertyInfo subp : l) {
                processForeignNamespaces(subp, --processingDepth);
            }
        }
        if (t instanceof Element) {
            addDependencyTo(((Element) t).getElementName());
        }
        if (t instanceof NonElement) {
            addDependencyTo(((NonElement) t).getTypeName());
        }
    }
}
 
Example #9
Source File: XmlSchemaGenerator.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Builds content model writer for the specified property.
 */
private Tree buildPropertyContentModel(PropertyInfo<T,C> p) {
    switch(p.kind()) {
    case ELEMENT:
        return handleElementProp((ElementPropertyInfo<T,C>)p);
    case ATTRIBUTE:
        // attribuets are handled later
        return null;
    case REFERENCE:
        return handleReferenceProp((ReferencePropertyInfo<T,C>)p);
    case MAP:
        return handleMapProp((MapPropertyInfo<T,C>)p);
    case VALUE:
        // value props handled above in writeClass()
        assert false;
        throw new IllegalStateException();
    default:
        assert false;
        throw new IllegalStateException();
    }
}
 
Example #10
Source File: XmlSchemaGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Process the given PropertyInfo looking for references to namespaces that
 * are foreign to the given namespace.  Any foreign namespace references
 * found are added to the given namespaces dependency list and an &lt;import>
 * is generated for it.
 *
 * @param p the PropertyInfo
 */
private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) {
    for (TypeInfo<T, C> t : p.ref()) {
        if ((t instanceof ClassInfo) && (processingDepth > 0)) {
            java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties();
            for (PropertyInfo subp : l) {
                processForeignNamespaces(subp, --processingDepth);
            }
        }
        if (t instanceof Element) {
            addDependencyTo(((Element) t).getElementName());
        }
        if (t instanceof NonElement) {
            addDependencyTo(((NonElement) t).getTypeName());
        }
    }
}
 
Example #11
Source File: ModelBuilder.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Getting parametrized classes of {@code JAXBElement<...>} property
 * @param p property which parametrized types we will try to get
 * @return null - if it's not JAXBElement property, or it's not parametrized, and array of parametrized classes in other case
 */
private Class[] getParametrizedTypes(PropertyInfo p) {
    try {
        Type pType = ((RuntimePropertyInfo) p).getIndividualType();
        if (pType instanceof ParameterizedType) {
            ParameterizedType prmzdType = (ParameterizedType) pType;
            if (prmzdType.getRawType() == JAXBElement.class) {
                Type[] actualTypes = prmzdType.getActualTypeArguments();
                Class[] result = new Class[actualTypes.length];
                for (int i = 0; i < actualTypes.length; i++) {
                    result[i] = (Class) actualTypes[i];
                }
                return result;
            }
        }
    } catch (Exception e) {
        logger.log(Level.FINE, "Error in ModelBuilder.getParametrizedTypes. " + e.getMessage());
    }
    return null;
}
 
Example #12
Source File: XmlSchemaGenerator.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Builds content model writer for the specified property.
 */
private Tree buildPropertyContentModel(PropertyInfo<T,C> p) {
    switch(p.kind()) {
    case ELEMENT:
        return handleElementProp((ElementPropertyInfo<T,C>)p);
    case ATTRIBUTE:
        // attribuets are handled later
        return null;
    case REFERENCE:
        return handleReferenceProp((ReferencePropertyInfo<T,C>)p);
    case MAP:
        return handleMapProp((MapPropertyInfo<T,C>)p);
    case VALUE:
        // value props handled above in writeClass()
        assert false;
        throw new IllegalStateException();
    default:
        assert false;
        throw new IllegalStateException();
    }
}
 
Example #13
Source File: XmlSchemaGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Process the given PropertyInfo looking for references to namespaces that
 * are foreign to the given namespace.  Any foreign namespace references
 * found are added to the given namespaces dependency list and an &lt;import>
 * is generated for it.
 *
 * @param p the PropertyInfo
 */
private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) {
    for (TypeInfo<T, C> t : p.ref()) {
        if ((t instanceof ClassInfo) && (processingDepth > 0)) {
            java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties();
            for (PropertyInfo subp : l) {
                processForeignNamespaces(subp, --processingDepth);
            }
        }
        if (t instanceof Element) {
            addDependencyTo(((Element) t).getElementName());
        }
        if (t instanceof NonElement) {
            addDependencyTo(((NonElement) t).getTypeName());
        }
    }
}
 
Example #14
Source File: ModelBuilder.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Getting parametrized classes of {@code JAXBElement<...>} property
 * @param p property which parametrized types we will try to get
 * @return null - if it's not JAXBElement property, or it's not parametrized, and array of parametrized classes in other case
 */
private Class[] getParametrizedTypes(PropertyInfo p) {
    try {
        Type pType = ((RuntimePropertyInfo) p).getIndividualType();
        if (pType instanceof ParameterizedType) {
            ParameterizedType prmzdType = (ParameterizedType) pType;
            if (prmzdType.getRawType() == JAXBElement.class) {
                Type[] actualTypes = prmzdType.getActualTypeArguments();
                Class[] result = new Class[actualTypes.length];
                for (int i = 0; i < actualTypes.length; i++) {
                    result[i] = (Class) actualTypes[i];
                }
                return result;
            }
        }
    } catch (Exception e) {
        logger.log(Level.FINE, "Error in ModelBuilder.getParametrizedTypes. " + e.getMessage());
    }
    return null;
}
 
Example #15
Source File: ModelBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Getting parametrized classes of {@code JAXBElement<...>} property
 * @param p property which parametrized types we will try to get
 * @return null - if it's not JAXBElement property, or it's not parametrized, and array of parametrized classes in other case
 */
private Class[] getParametrizedTypes(PropertyInfo p) {
    try {
        Type pType = ((RuntimePropertyInfo) p).getIndividualType();
        if (pType instanceof ParameterizedType) {
            ParameterizedType prmzdType = (ParameterizedType) pType;
            if (prmzdType.getRawType() == JAXBElement.class) {
                Type[] actualTypes = prmzdType.getActualTypeArguments();
                Class[] result = new Class[actualTypes.length];
                for (int i = 0; i < actualTypes.length; i++) {
                    result[i] = (Class) actualTypes[i];
                }
                return result;
            }
        }
    } catch (Exception e) {
        logger.log(Level.FINE, "Error in ModelBuilder.getParametrizedTypes. " + e.getMessage());
    }
    return null;
}
 
Example #16
Source File: XmlSchemaGenerator.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Process the given PropertyInfo looking for references to namespaces that
 * are foreign to the given namespace.  Any foreign namespace references
 * found are added to the given namespaces dependency list and an &lt;import>
 * is generated for it.
 *
 * @param p the PropertyInfo
 */
private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) {
    for (TypeInfo<T, C> t : p.ref()) {
        if ((t instanceof ClassInfo) && (processingDepth > 0)) {
            java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties();
            for (PropertyInfo subp : l) {
                processForeignNamespaces(subp, --processingDepth);
            }
        }
        if (t instanceof Element) {
            addDependencyTo(((Element) t).getElementName());
        }
        if (t instanceof NonElement) {
            addDependencyTo(((NonElement) t).getTypeName());
        }
    }
}
 
Example #17
Source File: XmlSchemaGenerator.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Builds content model writer for the specified property.
 */
private Tree buildPropertyContentModel(PropertyInfo<T,C> p) {
    switch(p.kind()) {
    case ELEMENT:
        return handleElementProp((ElementPropertyInfo<T,C>)p);
    case ATTRIBUTE:
        // attribuets are handled later
        return null;
    case REFERENCE:
        return handleReferenceProp((ReferencePropertyInfo<T,C>)p);
    case MAP:
        return handleMapProp((MapPropertyInfo<T,C>)p);
    case VALUE:
        // value props handled above in writeClass()
        assert false;
        throw new IllegalStateException();
    default:
        assert false;
        throw new IllegalStateException();
    }
}
 
Example #18
Source File: ClassInfoImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public final boolean hasValueProperty() {
ClassInfoImpl<T, C, F, M> bc = getBaseClass();
if(bc!=null && bc.hasValueProperty())
    return true;

for (PropertyInfo p : getProperties()) {
    if (p instanceof ValuePropertyInfo) return true;
}

return false;
}
 
Example #19
Source File: ClassInfoImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public PropertyInfo<T,C> getProperty(String name) {
    for( PropertyInfo<T,C> p: getProperties() ) {
        if(p.getName().equals(name))
            return p;
    }
    return null;
}
 
Example #20
Source File: ClassInfoImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public final boolean hasValueProperty() {
ClassInfoImpl<T, C, F, M> bc = getBaseClass();
if(bc!=null && bc.hasValueProperty())
    return true;

for (PropertyInfo p : getProperties()) {
    if (p instanceof ValuePropertyInfo) return true;
}

return false;
}
 
Example #21
Source File: XmlSchemaGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Examine the specified element ref and determine if a swaRef attribute needs to be generated
 */
private boolean generateSwaRefAdapter(PropertyInfo<T,C> prop) {
    final Adapter<T,C> adapter = prop.getAdapter();
    if (adapter == null) return false;
    final Object o = navigator.asDecl(SwaRefAdapter.class);
    if (o == null) return false;
    return (o.equals(adapter.adapterType));
}
 
Example #22
Source File: ClassInfoImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A {@link ClassInfo} can be referenced by {@link XmlIDREF} if
 * it has an ID property.
 */
public boolean canBeReferencedByIDREF() {
    for (PropertyInfo<T,C> p : getProperties()) {
        if(p.id()== ID.ID)
            return true;
    }
    ClassInfoImpl<T,C,F,M> base = getBaseClass();
    if(base!=null)
        return base.canBeReferencedByIDREF();
    else
        return false;
}
 
Example #23
Source File: ClassInfoImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A {@link ClassInfo} can be referenced by {@link XmlIDREF} if
 * it has an ID property.
 */
public boolean canBeReferencedByIDREF() {
    for (PropertyInfo<T,C> p : getProperties()) {
        if(p.id()== ID.ID)
            return true;
    }
    ClassInfoImpl<T,C,F,M> base = getBaseClass();
    if(base!=null)
        return base.canBeReferencedByIDREF();
    else
        return false;
}
 
Example #24
Source File: ClassInfoImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A {@link ClassInfo} can be referenced by {@link XmlIDREF} if
 * it has an ID property.
 */
public boolean canBeReferencedByIDREF() {
    for (PropertyInfo<T,C> p : getProperties()) {
        if(p.id()== ID.ID)
            return true;
    }
    ClassInfoImpl<T,C,F,M> base = getBaseClass();
    if(base!=null)
        return base.canBeReferencedByIDREF();
    else
        return false;
}
 
Example #25
Source File: XmlSchemaGenerator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Examine the specified element ref and determine if a swaRef attribute needs to be generated
 */
private boolean generateSwaRefAdapter(PropertyInfo<T,C> prop) {
    final Adapter<T,C> adapter = prop.getAdapter();
    if (adapter == null) return false;
    final Object o = navigator.asDecl(SwaRefAdapter.class);
    if (o == null) return false;
    return (o.equals(adapter.adapterType));
}
 
Example #26
Source File: XmlSchemaGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Examine the specified element ref and determine if a swaRef attribute needs to be generated
 */
private boolean generateSwaRefAdapter(PropertyInfo<T,C> prop) {
    final Adapter<T,C> adapter = prop.getAdapter();
    if (adapter == null) return false;
    final Object o = navigator.asDecl(SwaRefAdapter.class);
    if (o == null) return false;
    return (o.equals(adapter.adapterType));
}
 
Example #27
Source File: ClassInfoImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A {@link ClassInfo} can be referenced by {@link XmlIDREF} if
 * it has an ID property.
 */
public boolean canBeReferencedByIDREF() {
    for (PropertyInfo<T,C> p : getProperties()) {
        if(p.id()== ID.ID)
            return true;
    }
    ClassInfoImpl<T,C,F,M> base = getBaseClass();
    if(base!=null)
        return base.canBeReferencedByIDREF();
    else
        return false;
}
 
Example #28
Source File: ClassInfoImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public final boolean hasValueProperty() {
ClassInfoImpl<T, C, F, M> bc = getBaseClass();
if(bc!=null && bc.hasValueProperty())
    return true;

for (PropertyInfo p : getProperties()) {
    if (p instanceof ValuePropertyInfo) return true;
}

return false;
}
 
Example #29
Source File: ClassInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public final boolean hasValueProperty() {
ClassInfoImpl<T, C, F, M> bc = getBaseClass();
if(bc!=null && bc.hasValueProperty())
    return true;

for (PropertyInfo p : getProperties()) {
    if (p instanceof ValuePropertyInfo) return true;
}

return false;
}
 
Example #30
Source File: ClassInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public PropertyInfo<T,C> getProperty(String name) {
    for( PropertyInfo<T,C> p: getProperties() ) {
        if(p.getName().equals(name))
            return p;
    }
    return null;
}