public DefaultValueWriter createDefaultValueWriter(QName qname, boolean element) {
if (defaultValues == null) {
return null;
}
TypeAndAnnotation typeAnno = rawJaxbModelGenCode.getJavaType(qname);
if (element) {
Mapping mapping = rawJaxbModelGenCode.get(qname);
if (mapping != null) {
typeAnno = mapping.getType();
}
}
if (typeAnno != null && typeAnno.getTypeClass() instanceof JDefinedClass) {
JDefinedClass dc = (JDefinedClass)typeAnno.getTypeClass();
if (dc.isAbstract()) {
//no default values for abstract classes
typeAnno = null;
}
}
if (typeAnno != null) {
final JType type = typeAnno.getTypeClass();
return new JAXBDefaultValueWriter(type);
}
return null;
}