globalBinding.markAsAcknowledged(); } else { gb.markAsAcknowledged(); getErrorReporter().error( gb.getLocation(), Messages.ERR_MULTIPLE_GLOBAL_BINDINGS); getErrorReporter().error( globalBinding.getLocation(), Messages.ERR_MULTIPLE_GLOBAL_BINDINGS_OTHER); globalBinding = new BIGlobalBinding(); BindInfo big = new BindInfo(); big.addDecl(globalBinding); model.strategy = globalBinding.getCodeGenerationStrategy(); model.rootClass = globalBinding.getSuperClass(); model.rootInterface = globalBinding.getSuperInterface(); particleBinder = globalBinding.isSimpleMode() ? new ExpressionParticleBinder() : new DefaultParticleBinder(); BISerializable serial = globalBinding.getSerializable(); if(serial!=null) { model.serializable = true; globalBinding.dispatchGlobalConversions(schemas); globalBinding.errorCheck();
public boolean canBeMappedToTypeSafeEnum( String nsUri, String localName ) { return canBeMappedToTypeSafeEnum(new QName(nsUri,localName)); }
/** * Moves global BIConversion to the right object. */ public void dispatchGlobalConversions( XSSchemaSet schema ) { // also set parent to the global conversions for( Map.Entry<QName,BIConversion> e : globalConversions.entrySet() ) { QName name = e.getKey(); BIConversion conv = e.getValue(); XSSimpleType st = schema.getSimpleType(name.getNamespaceURI(),name.getLocalPart()); if(st==null) { Ring.get(ErrorReceiver.class).error( getLocation(), Messages.ERR_UNDEFINED_SIMPLE_TYPE.format(name) ); continue; // abort } getBuilder().getOrCreateBindInfo(st).addDecl(conv); } }
.getFlattenClasses())) { logger.warn("According to the Java Persistence API specification, section 2.1, " + "entities must be top-level classes:\n"
if(facets.size() > builder.getGlobalBinding().getDefaultEnumMemberSizeCap()) { type.getName(), facets.size(), builder.getGlobalBinding().getDefaultEnumMemberSizeCap()); if( t.isGlobal() && builder.getGlobalBinding().canBeMappedToTypeSafeEnum(t) ) return true;
@Override public void postProcessModel(final Model model, final ErrorHandler errorHandler) { this.fixedAttributeAsConstantProperty = Ring.get(BGMBuilder.class).getGlobalBinding().getDefaultProperty().isConstantProperty(); }
private EnumMemberMode getEnumMemberMode() { return builder.getGlobalBinding().getEnumMemberMode(); }
.getFlattenClasses())) { logger.warn("According to the Java Persistence API specification, section 2.1, " + "entities must be top-level classes:\n"
/** * 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; }
private static BIProperty getDefault( BGMBuilder builder, XSComponent c ) { while(c!=null) { c = c.apply(defaultCustomizationFinder); if(c!=null) { BIProperty prop = builder.getBindInfo(c).get(BIProperty.class); if(prop!=null) return prop; } } // default to the global one return builder.getGlobalBinding().getDefaultProperty(); }
private EnumMemberMode getEnumMemberMode() { return builder.getGlobalBinding().getEnumMemberMode(); }
continue; gb.markAsAcknowledged(); if (!globalBinding.isEqual(gb)) { // see Issue 687 - this may happen with syntactically imported documents getErrorReporter().error( gb.getLocation(), Messages.ERR_MULTIPLE_GLOBAL_BINDINGS); getErrorReporter().error( globalBinding.getLocation(), Messages.ERR_MULTIPLE_GLOBAL_BINDINGS_OTHER); globalBinding = new BIGlobalBinding(); BindInfo big = new BindInfo(); big.addDecl(globalBinding); model.strategy = globalBinding.getCodeGenerationStrategy(); model.rootClass = globalBinding.getSuperClass(); model.rootInterface = globalBinding.getSuperInterface(); particleBinder = globalBinding.isSimpleMode() ? new ExpressionParticleBinder() : new DefaultParticleBinder(); BISerializable serial = globalBinding.getSerializable(); if(serial!=null) { model.serializable = true; globalBinding.dispatchGlobalConversions(schemas); globalBinding.errorCheck();
+ "] is a simple homogeneous collection property."); final CClassInfoParent parent = Ring.get(BGMBuilder.class).getGlobalBinding().getFlattenClasses() == LocalScoping.NESTED ? classInfo : classInfo.parent();
/** * Moves global BIConversion to the right object. */ public void dispatchGlobalConversions( XSSchemaSet schema ) { // also set parent to the global conversions for( Map.Entry<QName,BIConversion> e : globalConversions.entrySet() ) { QName name = e.getKey(); BIConversion conv = e.getValue(); XSSimpleType st = schema.getSimpleType(name.getNamespaceURI(),name.getLocalPart()); if(st==null) { Ring.get(ErrorReceiver.class).error( getLocation(), Messages.ERR_UNDEFINED_SIMPLE_TYPE.format(name) ); continue; // abort } getBuilder().getOrCreateBindInfo(st).addDecl(conv); } }
if(facets.size() > builder.getGlobalBinding().getDefaultEnumMemberSizeCap()) { type.getName(), facets.size(), builder.getGlobalBinding().getDefaultEnumMemberSizeCap()); if( t.isGlobal() && builder.getGlobalBinding().canBeMappedToTypeSafeEnum(t) ) return true;
public boolean canBeMappedToTypeSafeEnum( String nsUri, String localName ) { return canBeMappedToTypeSafeEnum(new QName(nsUri,localName)); }
private static BIProperty getDefault( BGMBuilder builder, XSComponent c ) { while(c!=null) { c = c.apply(defaultCustomizationFinder); if(c!=null) { BIProperty prop = builder.getBindInfo(c).get(BIProperty.class); if(prop!=null) return prop; } } // default to the global one return builder.getGlobalBinding().getDefaultProperty(); }
private EnumMemberMode getEnumMemberMode() { return builder.getGlobalBinding().getEnumMemberMode(); }
continue; gb.markAsAcknowledged(); if (!globalBinding.isEqual(gb)) { // see Issue 687 - this may happen with syntactically imported documents getErrorReporter().error( gb.getLocation(), Messages.ERR_MULTIPLE_GLOBAL_BINDINGS); getErrorReporter().error( globalBinding.getLocation(), Messages.ERR_MULTIPLE_GLOBAL_BINDINGS_OTHER); globalBinding = new BIGlobalBinding(); BindInfo big = new BindInfo(); big.addDecl(globalBinding); model.strategy = globalBinding.getCodeGenerationStrategy(); model.rootClass = globalBinding.getSuperClass(); model.rootInterface = globalBinding.getSuperInterface(); particleBinder = globalBinding.isSimpleMode() ? new ExpressionParticleBinder() : new DefaultParticleBinder(); BISerializable serial = globalBinding.getSerializable(); if(serial!=null) { model.serializable = true; globalBinding.dispatchGlobalConversions(schemas); globalBinding.errorCheck();
.getGlobalBinding().getFlattenClasses() == LocalScoping.NESTED ? classInfo : classInfo.parent();