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."); }
/** * Returns the super class of this class, if it has the * super class and it is also a JAXB-bound class. * Otherwise null. */ public final ClassOutline getSuperClass() { CClassInfo s = target.getBaseClass(); if(s==null) return null; return parent().getClazz(s); } }
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); } }
/** * Returns the super class of this class, if it has the * super class and it is also a JAXB-bound class. * Otherwise null. */ public final ClassOutline getSuperClass() { CClassInfo s = target.getBaseClass(); if(s==null) return null; return parent().getClazz(s); }
/** * Returns the super class of this class, if it has the * super class and it is also a JAXB-bound class. * Otherwise null. */ public final ClassOutline getSuperClass() { CClassInfo s = target.getBaseClass(); if(s==null) return null; return parent().getClazz(s); } }
/** * Returns the super class of this class, if it has the * super class and it is also a JAXB-bound class. * Otherwise null. */ public final ClassOutline getSuperClass() { CClassInfo s = target.getBaseClass(); if(s==null) return null; return parent().getClazz(s); }
/** * Returns the super class of this class, if it has the * super class and it is also a JAXB-bound class. * Otherwise null. */ public final ClassOutline getSuperClass() { CClassInfo s = target.getBaseClass(); if(s==null) return null; return parent().getClazz(s); }
private void addFieldQNames(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 = getCClassInfoQName(entry.getValue()); if (qname == null) {
/** * remove generated equals methods from classes which extends from prism containers/objects */ private void removeCustomGeneratedMethod(Outline outline) { 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 = getCClassInfoQName(entry.getValue()); if (qname == null || (!hasParentAnnotation(classOutline, A_PRISM_OBJECT) && !hasParentAnnotation(classOutline, A_PRISM_CONTAINER))) { continue; } JDefinedClass definedClass = classOutline.implClass; Iterator<JClass> iterator = definedClass._implements(); while (iterator.hasNext()) { JClass clazz = iterator.next(); if (clazz.equals(CLASS_MAP.get(Equals.class)) || clazz.equals(CLASS_MAP.get(HashCode.class))) { iterator.remove(); } } boolean isMidpointContainer = hasParentAnnotation(classOutline, A_PRISM_OBJECT); removeOldCustomGeneratedEquals(classOutline, isMidpointContainer); removeOldCustomGenerated(classOutline, isMidpointContainer, METHOD_HASH_CODE); removeOldCustomGenerated(classOutline, isMidpointContainer, METHOD_TO_STRING); } }
private void updateFields(Outline outline) { Map<JDefinedClass, List<JFieldVar>> allFieldsToBeRemoved = new HashMap<>(); Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet(); for (Map.Entry<NClass, CClassInfo> entry : set) { ClassOutline classOutline = outline.getClazz(entry.getValue()); JDefinedClass implClass = classOutline.implClass; Map<String, JFieldVar> fields = implClass.fields(); if (fields == null) { continue; } print("Updating fields and get/set methods: " + classOutline.implClass.fullName()); for (Map.Entry<String, JFieldVar> field : fields.entrySet()) { JFieldVar fieldVar = field.getValue(); // marks a:rawType fields with @Raw - this has to be executed for any bean, not only for prism containers if (hasAnnotation(classOutline, fieldVar, A_RAW_TYPE) != null) { annotateFieldAsRaw(fieldVar); } } if (isContainer(classOutline.implClass, outline)) { processContainerFields(classOutline, allFieldsToBeRemoved); } createFluentFieldMethods(classOutline, classOutline); print("Finished updating fields and get/set methods for " + classOutline.implClass.fullName()); } allFieldsToBeRemoved.forEach((jDefinedClass, jFieldVars) -> { jFieldVars.forEach(jDefinedClass::removeField); }); }
@Override public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) throws Exception { PluginImpl clonePlugin = new PluginImpl(); clonePlugin.run(outline, opt, errorHandler); Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet(); for (Map.Entry<NClass, CClassInfo> entry : set) { ClassOutline classOutline = outline.getClazz(entry.getValue()); if (isPrism(classOutline)) { removeConstructors(classOutline); removeCloneableMethod(classOutline); removePrivateStaticCopyMethods(classOutline); createCloneMethod(classOutline); } } return true; }
public Collection<FieldOutline> getTargetIdFieldsOutline(Mapping context, FieldOutline fieldOutline) { final CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo(); final Collection<? extends CTypeInfo> types = context.getGetTypes() .process(context, propertyInfo); final CTypeInfo type = CTypeInfoUtils.getCommonBaseTypeInfo(types); assert type != null; assert type instanceof CClass; if (type instanceof CClassInfo) { final ClassOutline targetClassOutline = fieldOutline.parent() .parent().getClazz((CClassInfo) type); return getIdFieldsOutline(targetClassOutline); } else { logger.error(MessageFormat .format("Field outline [{0}] references the type [{1}] which is not present in the XJC model " + "(it is probably a class reference due to episodic compilation). " + "Due to this reason Hyperjaxb3 cannot generate correct identifier column mapping. " + "Please customize your association manually. See also issue HJIII-51.", propertyInfo.getName(true), type.getType() .fullName())); return Collections.emptyList(); } }
public Collection<FieldOutline> getTargetIdFieldsOutline(Mapping context, FieldOutline fieldOutline) { final CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo(); final Collection<? extends CTypeInfo> types = context.getGetTypes() .process(context, propertyInfo); final CTypeInfo type = CTypeInfoUtils.getCommonBaseTypeInfo(types); assert type != null; assert type instanceof CClass; if (type instanceof CClassInfo) { final ClassOutline targetClassOutline = fieldOutline.parent() .parent().getClazz((CClassInfo) type); return getIdFieldsOutline(targetClassOutline); } else { logger.error(MessageFormat .format("Field outline [{0}] references the type [{1}] which is not present in the XJC model " + "(it is probably a class reference due to episodic compilation). " + "Due to this reason Hyperjaxb3 cannot generate correct identifier column mapping. " + "Please customize your association manually. See also issue HJIII-51.", propertyInfo.getName(true), type.getType() .fullName())); return Collections.emptyList(); } }
final CClassInfo fieldClassInfo = (CClassInfo) type; final ClassOutline fieldClassOutline = fieldOutline .parent().parent().getClazz(fieldClassInfo); allIgnored = allIgnored && isClassOutlineIgnored(context, fieldClassOutline);
final CClassInfo fieldClassInfo = (CClassInfo) type; final ClassOutline fieldClassOutline = fieldOutline .parent().parent().getClazz(fieldClassInfo); allIgnored = allIgnored && isClassOutlineIgnored(context, fieldClassOutline);