private String findBaseConversion(XSSimpleType owner) { // find the base simple type mapping. for( XSSimpleType st=owner; st!=null; st = st.getSimpleBaseType() ) { if( !WellKnownNamespace.XML_SCHEMA.equals(st.getTargetNamespace()) ) continue; // user-defined type String name = st.getName().intern(); for( String s : knownBases ) if(name.equalsIgnoreCase(s)) return s; } return null; }
private String findBaseConversion(XSSimpleType owner) { // find the base simple type mapping. for( XSSimpleType st=owner; st!=null; st = st.getSimpleBaseType() ) { if( !WellKnownNamespace.XML_SCHEMA.equals(st.getTargetNamespace()) ) continue; // user-defined type String name = st.getName().intern(); for( String s : knownBases ) if(name.equalsIgnoreCase(s)) return s; } return null; }
private String findBaseConversion(XSSimpleType owner) { // find the base simple type mapping. for( XSSimpleType st=owner; st!=null; st = st.getSimpleBaseType() ) { if( !WellKnownNamespace.XML_SCHEMA.equals(st.getTargetNamespace()) ) continue; // user-defined type String name = st.getName().intern(); for( String s : knownBases ) if(name.equalsIgnoreCase(s)) return s; } return null; }
private String findBaseConversion(XSSimpleType owner) { // find the base simple type mapping. for( XSSimpleType st=owner; st!=null; st = st.getSimpleBaseType() ) { if( !WellKnownNamespace.XML_SCHEMA.equals(st.getTargetNamespace()) ) continue; // user-defined type String name = st.getName().intern(); for( String s : knownBases ) if(name.equalsIgnoreCase(s)) return s; } return null; }
private String findBaseConversion(XSSimpleType owner) { // find the base simple type mapping. for( XSSimpleType st=owner; st!=null; st = st.getSimpleBaseType() ) { if( !WellKnownNamespace.XML_SCHEMA.equals(st.getTargetNamespace()) ) continue; // user-defined type String name = st.getName().intern(); for( String s : knownBases ) if(name.equalsIgnoreCase(s)) return s; } return null; }
/** * Returns true if the given simple type can be mapped to a * type-safe enum class. * * <p> * JAXB spec places a restrictrion as to what type can be * mapped to a type-safe enum. This method enforces this * constraint. */ public static boolean canBeMappedToTypeSafeEnum( XSSimpleType type ) { do { if( WellKnownNamespace.XML_SCHEMA.equals(type.getTargetNamespace()) ) { // type must be derived from one of these types String localName = type.getName(); if( localName!=null ) { if( localName.equals("anySimpleType") ) return false; // catch all case if( localName.equals("ID") || localName.equals("IDREF") ) return false; // not ID/IDREF // other allowed list if( builtinTypeSafeEnumCapableTypes.contains(localName) ) return true; } } type = type.getSimpleBaseType(); } while( type!=null ); return false; }
/** * Returns true if the given simple type can be mapped to a * type-safe enum class. * * <p> * JAXB spec places a restrictrion as to what type can be * mapped to a type-safe enum. This method enforces this * constraint. */ public static boolean canBeMappedToTypeSafeEnum( XSSimpleType type ) { do { if( WellKnownNamespace.XML_SCHEMA.equals(type.getTargetNamespace()) ) { // type must be derived from one of these types String localName = type.getName(); if( localName!=null ) { if( localName.equals("anySimpleType") ) return false; // catch all case if( localName.equals("ID") || localName.equals("IDREF") ) return false; // not ID/IDREF // other allowed list if( builtinTypeSafeEnumCapableTypes.contains(localName) ) return true; } } type = type.getSimpleBaseType(); } while( type!=null ); return false; }
/** * Returns true if the given simple type can be mapped to a * type-safe enum class. * * <p> * JAXB spec places a restrictrion as to what type can be * mapped to a type-safe enum. This method enforces this * constraint. */ public static boolean canBeMappedToTypeSafeEnum( XSSimpleType type ) { do { if( WellKnownNamespace.XML_SCHEMA.equals(type.getTargetNamespace()) ) { // type must be derived from one of these types String localName = type.getName(); if( localName!=null ) { if( localName.equals("anySimpleType") ) return false; // catch all case if( localName.equals("ID") || localName.equals("IDREF") ) return false; // not ID/IDREF // other allowed list if( builtinTypeSafeEnumCapableTypes.contains(localName) ) return true; } } type = type.getSimpleBaseType(); } while( type!=null ); return false; }
/** * Returns true if the given simple type can be mapped to a * type-safe enum class. * * <p> * JAXB spec places a restrictrion as to what type can be * mapped to a type-safe enum. This method enforces this * constraint. */ public static boolean canBeMappedToTypeSafeEnum( XSSimpleType type ) { do { if( WellKnownNamespace.XML_SCHEMA.equals(type.getTargetNamespace()) ) { // type must be derived from one of these types String localName = type.getName(); if( localName!=null ) { if( localName.equals("anySimpleType") ) return false; // catch all case if( localName.equals("ID") || localName.equals("IDREF") ) return false; // not ID/IDREF // other allowed list if( builtinTypeSafeEnumCapableTypes.contains(localName) ) return true; } } type = type.getSimpleBaseType(); } while( type!=null ); return false; }
/** * Returns true if the given simple type can be mapped to a * type-safe enum class. * * <p> * JAXB spec places a restrictrion as to what type can be * mapped to a type-safe enum. This method enforces this * constraint. */ public static boolean canBeMappedToTypeSafeEnum( XSSimpleType type ) { do { if( WellKnownNamespace.XML_SCHEMA.equals(type.getTargetNamespace()) ) { // type must be derived from one of these types String localName = type.getName(); if( localName!=null ) { if( localName.equals("anySimpleType") ) return false; // catch all case if( localName.equals("ID") || localName.equals("IDREF") ) return false; // not ID/IDREF // other allowed list if( builtinTypeSafeEnumCapableTypes.contains(localName) ) return true; } } type = type.getSimpleBaseType(); } while( type!=null ); return false; }
for( XSSimpleType t = type; t!=null; t=t.getSimpleBaseType() ) if( t.isGlobal() && builder.getGlobalBinding().canBeMappedToTypeSafeEnum(t) ) return true;
/** * Returns true if a type-safe enum should be created from * the given simple type by default without an explicit <jaxb:enum> customization. */ private boolean shouldBeMappedToTypeSafeEnumByDefault( XSRestrictionSimpleType type ) { // if not, there will be a problem wrt the class name of this type safe enum type. if( type.isLocal() ) return false; // if redefined, we should map the new definition, not the old one. if( type.getRedefinedBy()!=null ) return false; List<XSFacet> facets = type.getDeclaredFacets(XSFacet.FACET_ENUMERATION); if( facets.isEmpty() || facets.size()>builder.getGlobalBinding().getDefaultEnumMemberSizeCap() ) // if the type itself doesn't have the enumeration facet, // it won't be mapped to a type-safe enum. // // if there are too many facets, it's not very useful return false; if( !canBeMappedToTypeSafeEnum(type) ) // we simply can't map this to an enumeration return false; // check for collisions among constant names. if a collision will happen, // don't try to bind it to an enum. // return true only when this type is derived from one of the "enum base type". for( XSSimpleType t = type; t!=null; t=t.getSimpleBaseType() ) if( t.isGlobal() && builder.getGlobalBinding().canBeMappedToTypeSafeEnum(t) ) return true; return false; }
for( XSSimpleType t = type; t!=null; t=t.getSimpleBaseType() ) if( t.isGlobal() && builder.getGlobalBinding().canBeMappedToTypeSafeEnum(t) ) return true;
for( XSSimpleType t = type; t!=null; t=t.getSimpleBaseType() ) if( t.isGlobal() && builder.getGlobalBinding().canBeMappedToTypeSafeEnum(t) ) return true;
/** * Returns true if a type-safe enum should be created from * the given simple type by default without an explicit <jaxb:enum> customization. */ private boolean shouldBeMappedToTypeSafeEnumByDefault( XSRestrictionSimpleType type ) { // if not, there will be a problem wrt the class name of this type safe enum type. if( type.isLocal() ) return false; // if redefined, we should map the new definition, not the old one. if( type.getRedefinedBy()!=null ) return false; List<XSFacet> facets = type.getDeclaredFacets(XSFacet.FACET_ENUMERATION); if( facets.isEmpty() || facets.size()>builder.getGlobalBinding().getDefaultEnumMemberSizeCap() ) // if the type itself doesn't have the enumeration facet, // it won't be mapped to a type-safe enum. // // if there are too many facets, it's not very useful return false; if( !canBeMappedToTypeSafeEnum(type) ) // we simply can't map this to an enumeration return false; // check for collisions among constant names. if a collision will happen, // don't try to bind it to an enum. // return true only when this type is derived from one of the "enum base type". for( XSSimpleType t = type; t!=null; t=t.getSimpleBaseType() ) if( t.isGlobal() && builder.getGlobalBinding().canBeMappedToTypeSafeEnum(t) ) return true; return false; }