/** * Reads fields of the super class and includes them * to name collision tests. */ void readSuperClass( CClassInfo base ) { for( ; base!=null; base=base.getBaseClass() ) { for( CPropertyInfo p : base.getProperties() ) occupiedLabels.put(p.getName(true),p); } } }
public ClassOutline getClassOutline(Outline outline, String fullName) { for (ClassOutline classOutline : outline.getClasses()) { if (classOutline.target.fullName().equals(fullName)) { return classOutline; } } return null; }
@Override public XSComponent getSchemaComponent() { return getSource().getSchemaComponent(); }
public CClassInfo getSubstitutionHead() { CClassInfo c=getBaseClass(); while(c!=null && !c.isElement()) c=c.getBaseClass(); return c; }
private QName getCClassInfoQName(CClassInfo info) { QName qname = info.getTypeName(); if (qname == null) { qname = info.getElementName(); } return qname; }
public static CTypeInfo getSuperType(CTypeInfo type) { if (type instanceof CClassInfo) { final CClassInfo classInfo = (CClassInfo) type; if (classInfo.getBaseClass() != null) { return classInfo.getBaseClass(); } else if (classInfo.getRefBaseClass() != null) { return classInfo.getRefBaseClass(); } else { return null; } } else { return null; } }
XmlTypeWriter xtw = cc.implClass.annotate2(XmlTypeWriter.class); writeTypeName(cc.target.getTypeName(), xtw, mostUsedNamespaceURI); Iterator<CClassInfo> subclasses = cc.target.listSubclasses(); if (subclasses.hasNext()) { XmlSeeAlsoWriter saw = cc.implClass.annotate2(XmlSeeAlsoWriter.class); while (subclasses.hasNext()) { CClassInfo s = subclasses.next(); if (target.isElement()) { String namespaceURI = target.getElementName().getNamespaceURI(); String localPart = target.getElementName().getLocalPart(); if (target.isOrdered()) { for (CPropertyInfo p : target.getProperties()) { if (!(p instanceof CAttributePropertyInfo)) { if (!((p instanceof CReferencePropertyInfo) && ((CReferencePropertyInfo) p).isDummy())) { xtw.propOrder(p.getName(false)); for (CPropertyInfo prop : target.getProperties()) { generateFieldDecl(cc, prop); if (target.declaresAttributeWildcard()) { generateAttributeWildcard(cc);
public static CPropertyInfo findPropertyWithCustomization(CClassInfo classInfo, final QName name) { for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { final CCustomizations customizations = getCustomizations(propertyInfo); final CPluginCustomization customization = customizations.find(name.getNamespaceURI(), name.getLocalPart()); if (customization != null) return propertyInfo; } return null; }
propertyInfo.getName(true) + ((CClassInfo) propertyInfo.parent()).model .getNameConverter().toPropertyName( element.getElementName() .getLocalPart()), CollectionMode.NOT_REPEATED, ID.NONE, propertyInfo.getExpectedMimeType(), if (!elementInfo.getSubstitutionMembers().isEmpty()) { logger.error("[" + ((CClassInfo) propertyInfo.parent()).getName() + "." + propertyInfo.getName(true) final QName elementName = classInfo.getElementName(); final QName typeName = classInfo.getTypeName(); final CTypeRef typeRef = new CTypeRef(classInfo, elementName, typeName, false, null); + ((CClassInfo) propertyInfo.parent()).getName() + "." + propertyInfo.getName(true)
Map<NClass, CClassInfo> beans = model.beans(); CClassInfoParent.Package packageParent = (CClassInfoParent.Package)classInfo.parent(); field.set(classInfo, new QName("http://www.dmg.org/PMML-4_3", "Node")); } catch(ReflectiveOperationException roe){ throw new RuntimeException(roe); List<CPropertyInfo> propertyInfos = classInfo.getProperties(); propertyInfos.sort(comparator); String publicName = propertyInfo.getName(true); String privateName = propertyInfo.getName(false); if(propertyInfo.isCollection()){
private Map<QName, List<QName>> getComplexTypeToElementName(ClassOutline classOutline) { Map<QName, List<QName>> complexTypeToElementName = new HashMap<>(); XSSchemaSet schemaSet = classOutline.target.getSchemaComponent().getRoot(); for (XSSchema schema : schemaSet.getSchemas()) { Map<String, XSElementDecl> elemDecls = schema.getElementDecls(); for (Entry<String, XSElementDecl> entry : elemDecls.entrySet()) { XSElementDecl decl = entry.getValue(); XSType xsType = decl.getType(); if (xsType.getName() == null) { continue; } QName type = new QName(xsType.getTargetNamespace(), xsType.getName()); List<QName> qnames = complexTypeToElementName.get(type); if (qnames == null) { qnames = new ArrayList<>(); complexTypeToElementName.put(type, qnames); } qnames.add(new QName(decl.getTargetNamespace(), decl.getName())); } } return complexTypeToElementName; }
private void addComplexType(Outline outline, Map<String, JFieldVar> namespaceFields) { Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet(); for (Map.Entry<NClass, CClassInfo> entry : set) { ClassOutline classOutline = outline.getClazz(entry.getValue()); QName qname = entry.getValue().getTypeName(); if (qname == null) { continue; } JFieldVar namespaceField = namespaceFields.get(qname.getNamespaceURI()); createQName(outline, classOutline.implClass, COMPLEX_TYPE_FIELD_NAME, qname, namespaceField, false, false); } }
private void updateObjectReferenceType(Outline outline) { ClassOutline objectReferenceOutline = null; for (Map.Entry<NClass, CClassInfo> entry : outline.getModel().beans().entrySet()) { QName qname = entry.getValue().getTypeName(); if (qname == null || !OBJECT_REFERENCE_TYPE.equals(qname)) { continue; objectReferenceOutline = outline.getClazz(entry.getValue()); break; definedClass._implements(CLASS_MAP.get(Referencable.class)); JVar reference = definedClass.field(JMod.PRIVATE, PrismReferenceValue.class, REFERENCE_VALUE_FIELD_NAME); JMethod getReference = definedClass.method(JMod.PUBLIC, PrismReferenceValue.class, METHOD_AS_REFERENCE_VALUE);
public static ClassOutline findClassOutline(Outline outline, QName type) { Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet(); for (Map.Entry<NClass, CClassInfo> entry : set) { ClassOutline classOutline = outline.getClazz(entry.getValue()); QName qname = entry.getValue().getTypeName(); if (!type.equals(qname)) { continue; } return classOutline; } throw new IllegalStateException("Object type class defined by qname '" + type + "' outline was not found."); }
private boolean isFieldReference(JFieldVar field, ClassOutline classOutline) { CPropertyInfo propertyInfo = classOutline.target.getProperty(field.name()); Collection<? extends CTypeInfo> collection = propertyInfo.ref(); if (collection == null || collection.isEmpty()) { return false; } CTypeInfo info = collection.iterator().next(); if (info instanceof CClassInfo) { CClassInfo classInfo = (CClassInfo) info; if (OBJECT_REFERENCE_TYPE.equals(classInfo.getTypeName())) { return true; } } return false; }
private void check( CClassInfo ci ) { List<CPropertyInfo> props = ci.getProperties(); Map<QName,CPropertyInfo> collisionTable = new HashMap<QName,CPropertyInfo>(); OUTER: for( int i=0; i<props.size(); i++ ) { CPropertyInfo p1 = props.get(i); if(p1.getName(true).equals("Class")) { errorReceiver.error(p1.locator,Messages.PROPERTY_CLASS_IS_RESERVED.format()); continue; } QName n = p1.collectElementNames(collisionTable); if(n!=null) { CPropertyInfo p2 = collisionTable.get(n); if (p2.getName(true).equals(n.toString()) || p2.getName(false).equals(n.toString())) { errorReceiver.error(p1.locator, Messages.DUPLICATE_ELEMENT.format(n)); errorReceiver.error(p2.locator, Messages.ERR_RELEVANT_LOCATION.format()); } } for( int j=i+1; j<props.size(); j++ ) { if(checkPropertyCollision(p1,props.get(j))) continue OUTER; } for( CClassInfo c=ci.getBaseClass(); c!=null; c=c.getBaseClass() ) { for( CPropertyInfo p2 : c.getProperties() ) if(checkPropertyCollision(p1,p2)) continue OUTER; } } }
protected Result createClasses( Outline outline, CClassInfo bean ) { JClassContainer parent = outline.getContainer( bean.parent(), Aspect.EXPOSED ); JDefinedClass intf = outline.getClassFactory().createInterface( parent, bean.shortName, bean.getLocator() ); parent = outline.getContainer(bean.parent(), Aspect.IMPLEMENTATION); JDefinedClass impl = outline.getClassFactory().createClass( parent, JMod.PUBLIC|(parent.isPackage()?0:JMod.STATIC)|(bean.isAbstract()?JMod.ABSTRACT:0), bean.shortName+"Impl", bean.getLocator() ); impl.annotate2(XmlAccessorTypeWriter.class).value(XmlAccessType.FIELD); impl._implements(intf); return new Result(intf,impl); }
JDefinedClass parent = (JDefinedClass) clazz.parentContainer(); JClassContainer grandParent = parent.parentContainer(); Map<String, JDefinedClass> classes; writeSummary("\tMoving inner class " + clazz.fullName() + " to class " + grandParentClass.fullName()); setPrivateField(clazz.mods(), "mods", Integer.valueOf(clazz.mods().getValue() & ~JMod.STATIC)); for (ClassOutline classOutline : outline.getClasses()) { if (classOutline.implClass == clazz) { XSComponent sc = classOutline.target.getSchemaComponent();
private void generateClassBody(Outline outline, ClassOutlineImpl cc) { final JCodeModel codeModel = outline.getCodeModel(); final Model model = outline.getModel(); CClassInfo target = cc.target; cc.implClass._implements(Serializable.class); if (model.serialVersionUID != null) { cc.implClass.field(JMod.PRIVATE | JMod.STATIC | JMod.FINAL, codeModel.LONG, "serialVersionUID", JExpr.lit(model.serialVersionUID)); for (CPropertyInfo prop : target.getProperties()) { generateFieldDecl(outline, cc, prop); assert !target.declaresAttributeWildcard();
@Override public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { for (final ClassOutline classOutline : outline.getClasses()) { for (final CPluginCustomization pluginCustomization : classOutline.target .getCustomizations()) { pluginCustomization.markAsAcknowledged(); } final CClassInfo classInfo = classOutline.target; logger.debug("Class:" + classInfo.getName()); for (final FieldOutline fieldOutline : classOutline .getDeclaredFields()) { final CPropertyInfo propertyInfo = fieldOutline .getPropertyInfo(); logger.debug("Property:" + propertyInfo.getName(true)); for (final CPluginCustomization pluginCustomization : fieldOutline .getPropertyInfo().getCustomizations()) { pluginCustomization.markAsAcknowledged(); } } } return true; }