use of com.sun.codemodel.JDefinedClass in project Activiti by Activiti.
the class WSDLImporter method importStructure.
private void importStructure(Mapping mapping) {
QName qname = mapping.getElement();
JDefinedClass theClass = (JDefinedClass) mapping.getType().getTypeClass();
SimpleStructureDefinition structure = (SimpleStructureDefinition) this.structures.get(this.namespace + qname.getLocalPart());
Map<String, JFieldVar> fields = theClass.fields();
int index = 0;
for (Entry<String, JFieldVar> entry : fields.entrySet()) {
Class<?> fieldClass = ReflectUtil.loadClass(entry.getValue().type().boxify().fullName());
structure.setFieldName(index, entry.getKey(), fieldClass);
index++;
}
}
use of com.sun.codemodel.JDefinedClass in project drill by apache.
the class ClassGenerator method createNestedClass.
/**
* Creates {@link #innerClassGenerator} with inner class
* if {@link #hasMaxIndexValue()} returns {@code true}.
*
* @return true if splitting happened.
*/
private boolean createNestedClass() {
if (hasMaxIndexValue()) {
// all new fields will be declared in the class from innerClassGenerator
if (innerClassGenerator == null) {
try {
JDefinedClass innerClazz = clazz._class(JMod.PRIVATE, clazz.name() + "0");
innerClassGenerator = new ClassGenerator<>(codeGenerator, mappings, sig, evaluationVisitor, innerClazz, model, optionManager);
} catch (JClassAlreadyExistsException e) {
throw new DrillRuntimeException(e);
}
oldBlocks = blocks;
innerClassGenerator.index = index;
innerClassGenerator.maxIndex += index;
// blocks from the inner class should be used
setupInnerClassBlocks();
return true;
}
return innerClassGenerator.createNestedClass();
}
return false;
}
Aggregations