/** * If only one global {@link XSElementDecl} is refering to {@link XSType}, * return that element, otherwise null. */ private @Nullable XSElementDecl getSoleElementReferer(@NotNull XSType t) { Set<XSComponent> referer = builder.getReferer(t); XSElementDecl sole = null; for (XSComponent r : referer) { if(r instanceof XSElementDecl) { XSElementDecl x = (XSElementDecl) r; if(!x.isGlobal()) // local element references can be ignored, as their names are either given // by the property, or by the JAXBElement (for things like mixed contents) continue; if(sole==null) sole=x; else return null; // more than one } else { // if another type refers to this type, that means // this type has a sub-type, so type substitution is possible now. return null; } } return sole; }
/** * If only one global {@link XSElementDecl} is refering to {@link XSType}, * return that element, otherwise null. */ private @Nullable XSElementDecl getSoleElementReferer(@NotNull XSType t) { Set<XSComponent> referer = builder.getReferer(t); XSElementDecl sole = null; for (XSComponent r : referer) { if(r instanceof XSElementDecl) { XSElementDecl x = (XSElementDecl) r; if(!x.isGlobal()) // local element references can be ignored, as their names are either given // by the property, or by the JAXBElement (for things like mixed contents) continue; if(sole==null) sole=x; else return null; // more than one } else { // if another type refers to this type, that means // this type has a sub-type, so type substitution is possible now. return null; } } return sole; }
/** * If only one global {@link XSElementDecl} is refering to {@link XSType}, * return that element, otherwise null. */ private @Nullable XSElementDecl getSoleElementReferer(@NotNull XSType t) { Set<XSComponent> referer = builder.getReferer(t); XSElementDecl sole = null; for (XSComponent r : referer) { if(r instanceof XSElementDecl) { XSElementDecl x = (XSElementDecl) r; if(!x.isGlobal()) // local element references can be ignored, as their names are either given // by the property, or by the JAXBElement (for things like mixed contents) continue; if(sole==null) sole=x; else return null; // more than one } else { // if another type refers to this type, that means // this type has a sub-type, so type substitution is possible now. return null; } } return sole; }
/** * If only one global {@link XSElementDecl} is refering to {@link XSType}, * return that element, otherwise null. */ private @Nullable XSElementDecl getSoleElementReferer(@NotNull XSType t) { Set<XSComponent> referer = builder.getReferer(t); XSElementDecl sole = null; for (XSComponent r : referer) { if(r instanceof XSElementDecl) { XSElementDecl x = (XSElementDecl) r; if(!x.isGlobal()) // local element references can be ignored, as their names are either given // by the property, or by the JAXBElement (for things like mixed contents) continue; if(sole==null) sole=x; else return null; // more than one } else { // if another type refers to this type, that means // this type has a sub-type, so type substitution is possible now. return null; } } return sole; }
/** * If only one global {@link XSElementDecl} is refering to {@link XSType}, * return that element, otherwise null. */ private @Nullable XSElementDecl getSoleElementReferer(@NotNull XSType t) { Set<XSComponent> referer = builder.getReferer(t); XSElementDecl sole = null; for (XSComponent r : referer) { if(r instanceof XSElementDecl) { XSElementDecl x = (XSElementDecl) r; if(!x.isGlobal()) // local element references can be ignored, as their names are either given // by the property, or by the JAXBElement (for things like mixed contents) continue; if(sole==null) sole=x; else return null; // more than one } else { // if another type refers to this type, that means // this type has a sub-type, so type substitution is possible now. return null; } } return sole; }