private JFieldVar getReferencedField(JFieldVar field, ClassOutline classOutline) { QName qname = getFieldReferenceUseAnnotationQName(field, classOutline); CPropertyInfo propertyInfo = classOutline.target.getProperty(qname.getLocalPart()); if (propertyInfo == null) { throw new IllegalArgumentException("No property "+qname.getLocalPart()+" in "+classOutline.target); } return classOutline.implClass.fields().get(propertyInfo.getName(false)); }
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; }
public static String getFluentSetterMethodName(ClassOutline classOutline, JFieldVar field) { return classOutline.target.getProperty(field.name()).getName(false); }
public static String getMethodName(ClassOutline classOutline, JFieldVar field, String prefix) { CPropertyInfo prop = classOutline.target.getProperty(field.name()); if (prop == null) { throw new IllegalStateException("No property info for classOutline=" + classOutline.target.fullName() + ", field=" + field.name()+" of " + field.type()); } return prefix + prop.getName(true); }
Candidate(JDefinedClass candidateClass, CClassInfo candidateClassInfo, JFieldVar field, JDefinedClass fieldParametrizationClass, JDefinedClass fieldParametrisationImpl, JClass xmlElementDeclModelClass, JClass xmlSchemaModelClass) { this.candidateClass = candidateClass; this.field = field; this.fieldPropertyInfo = candidateClassInfo.getProperty(field.name()); this.fieldParametrisationClass = fieldParametrizationClass; this.fieldParametrisationImpl = fieldParametrisationImpl; this.valueObjectDisabled = addObjectFactoryForClass(candidateClass); this.fieldTargetNamespace = getTargetNamespace(candidateClassInfo, xmlSchemaModelClass); collectScopedElementInfos(xmlElementDeclModelClass); }
@NotNull private JDefinedClass createAnonListClass(JFieldVar field, ClassOutline classOutline) { JDefinedClass anonymous; try { CPropertyInfo propertyInfo = classOutline.target.getProperty(field.name()); anonymous = classOutline.implClass._class(JMod.PRIVATE | JMod.STATIC, "Anon" + propertyInfo.getName(true)); JDocComment comment = anonymous.javadoc(); comment.append("TODO Can't be anonymous because of NPE bug in CodeModel generator, will be fixed later."); } catch (JClassAlreadyExistsException ex) { throw new RuntimeException(ex.getMessage(), ex); } return anonymous; }
Candidate(JDefinedClass candidateClass, CClassInfo candidateClassInfo, JFieldVar field, JDefinedClass fieldParametrizationClass, JDefinedClass fieldParametrisationImpl, JClass xmlElementDeclModelClass, JClass xmlSchemaModelClass) { this.candidateClass = candidateClass; this.field = field; this.fieldPropertyInfo = candidateClassInfo.getProperty(field.name()); this.fieldParametrisationClass = fieldParametrizationClass; this.fieldParametrisationImpl = fieldParametrisationImpl; this.valueObjectDisabled = addObjectFactoryForClass(candidateClass); this.fieldTargetNamespace = getTargetNamespace(candidateClassInfo, xmlSchemaModelClass); collectScopedElementInfos(xmlElementDeclModelClass); }
private String getTargetNamespace(CClassInfo candidateClassInfo, JClass xmlSchemaModelClass) { XSDeclaration xsdDeclaration = getXsdDeclaration(candidateClassInfo.getProperty(field.name())); if (xsdDeclaration != null && !xsdDeclaration.getTargetNamespace().isEmpty()) { return xsdDeclaration.getTargetNamespace(); } else { // Default (mostly used) namespace is generated as annotation for the package, // see com.sun.tools.xjc.generator.bean.PackageOutlineImpl#calcDefaultValues() for (JDefinedClass objectFactoryClass : objectFactoryClasses.values()) { JAnnotationUse schemaAnnotation = getAnnotation(objectFactoryClass.getPackage(), xmlSchemaModelClass); JExpression elementFormDefault = getAnnotationMemberExpression(schemaAnnotation, "elementFormDefault"); if (elementFormDefault != null && generableToString(elementFormDefault).endsWith(".QUALIFIED")) { return generableToString(getAnnotationMemberExpression(schemaAnnotation, "namespace")); } } } return null; }
private String getTargetNamespace(CClassInfo candidateClassInfo, JClass xmlSchemaModelClass) { XSDeclaration xsdDeclaration = getXsdDeclaration(candidateClassInfo.getProperty(field.name())); if (xsdDeclaration != null && !xsdDeclaration.getTargetNamespace().isEmpty()) { return xsdDeclaration.getTargetNamespace(); } else { // Default (mostly used) namespace is generated as annotation for the package, // see com.sun.tools.xjc.generator.bean.PackageOutlineImpl#calcDefaultValues() for (JDefinedClass objectFactoryClass : objectFactoryClasses.values()) { JAnnotationUse schemaAnnotation = getAnnotation(objectFactoryClass.getPackage(), xmlSchemaModelClass); JExpression elementFormDefault = getAnnotationMemberExpression(schemaAnnotation, "elementFormDefault"); if (elementFormDefault != null && generableToString(elementFormDefault).endsWith(".QUALIFIED")) { return generableToString(getAnnotationMemberExpression(schemaAnnotation, "namespace")); } } } return null; }
public static BIDeclaration hasAnnotation(ClassOutline classOutline, JFieldVar field, QName qname) { CPropertyInfo propertyInfo = classOutline.target.getProperty(field.name()); if (propertyInfo == null || !(propertyInfo.getSchemaComponent() instanceof XSParticle)) { return null; } XSParticle particle = (XSParticle)propertyInfo.getSchemaComponent(); if (particle.getTerm() == null) { return null; } XSAnnotation annotation = particle.getTerm().getAnnotation(false); return hasAnnotation(annotation, qname); }
public static String getGetterMethodName(ClassOutline classOutline, JFieldVar field) { CPropertyInfo prop = classOutline.target.getProperty(field.name()); JType type = field.type(); Options options = classOutline.parent().getModel().options; JCodeModel codeModel = classOutline.parent().getCodeModel(); if (options.enableIntrospection) { return ((type.isPrimitive() && type.boxify().getPrimitiveType() == codeModel.BOOLEAN) ? "is" : "get") + prop.getName(true); } else { return (type.boxify().getPrimitiveType() == codeModel.BOOLEAN ? "is" : "get") + prop.getName(true); } }
CPropertyInfo field = cc.target.getProperty(fieldName); if(field==null) { outline.getErrorReceiver().error(cc.target.getLocator(),
CPropertyInfo field = cc.target.getProperty(fieldName); if(field==null) { outline.getErrorReceiver().error(cc.target.getLocator(),
CPropertyInfo field = cc.target.getProperty(fieldName); if(field==null) { outline.getErrorReceiver().error(cc.target.getLocator(),
CPropertyInfo field = cc.target.getProperty(fieldName); if(field==null) { outline.getErrorReceiver().error(cc.target.getLocator(),
CPropertyInfo field = cc.target.getProperty(fieldName); if(field==null) { outline.getErrorReceiver().error(cc.target.getLocator(),