@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; }
private JDefinedClass resolveClass( final Context ctx ) throws SAXException { // The output class JDefinedClass cd = ctx.co.ref; if( StringUtils.isStringNotEmpty( ctx.className ) ) { cd = ctx.co.ref._package()._getClass( ctx.className ); if( cd == null ) { try { cd = ctx.co.ref._package()._class( ctx.className ); } catch( JClassAlreadyExistsException ex ) { throw new SAXException( ex.getMessage(), ex ); } } if( cd == null ) { throw new SAXException( "Unable to locate " + ctx.className ); } } return cd; }
@Override public boolean run(final Outline outline, final Options opt, final ErrorHandler errorHandler) throws SAXException { final PluginContext pluginContext = PluginContext.get(outline, opt, errorHandler); for (final ClassOutline classOutline : outline.getClasses()) { try { final GroupInterfacePlugin groupInterfacePlugin = pluginContext.findPlugin(GroupInterfacePlugin.class); if (groupInterfacePlugin != null) { ModifierGenerator.generateClass(pluginContext, new DefinedClassOutline(pluginContext, classOutline), this.modifierClassName, this.modifierClassName, groupInterfacePlugin.getGroupInterfacesForClass(pluginContext, classOutline.implClass.fullName()), this.modifierMethodName); } else { ModifierGenerator.generateClass(pluginContext, new DefinedClassOutline(pluginContext, classOutline), this.modifierClassName, this.modifierMethodName); } } catch (final JClassAlreadyExistsException e) { errorHandler.error(new SAXParseException(e.getMessage(), classOutline.target.getLocator())); } } return true; }
ModifierGenerator.generateInterface(this.pluginContext, interfaceOutline, modifierPlugin.modifierClassName, interfaceOutline.getSuperInterfaces(), modifierPlugin.modifierMethodName); } catch (JClassAlreadyExistsException e) { this.pluginContext.errorHandler.error(new SAXParseException(e.getMessage(), interfaceOutline.getSchemaComponent().getLocator())); ModifierGenerator.generateInterface(this.pluginContext, interfaceOutline, modifierPlugin.modifierClassName, interfaceOutline.getSuperInterfaces(), modifierPlugin.modifierMethodName); } catch (JClassAlreadyExistsException e) { this.pluginContext.errorHandler.error(new SAXParseException(e.getMessage(), interfaceOutline.getSchemaComponent().getLocator()));