use of com.sun.tools.xjc.model.CPropertyInfo in project midpoint by Evolveum.
the class SchemaProcessor method getReferencedField.
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));
}
use of com.sun.tools.xjc.model.CPropertyInfo in project midpoint by Evolveum.
the class SchemaProcessor method createAnonListClass.
@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;
}
use of com.sun.tools.xjc.model.CPropertyInfo in project midpoint by Evolveum.
the class SchemaProcessor method isFieldReference.
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;
}
use of com.sun.tools.xjc.model.CPropertyInfo in project midpoint by Evolveum.
the class ProcessorUtils method hasAnnotation.
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);
}
use of com.sun.tools.xjc.model.CPropertyInfo in project midpoint by Evolveum.
the class ProcessorUtils method getGetterMethodName.
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);
}
}
Aggregations