public void generate(ClassInfo info, Class superclassType, Property[] props, Class[] propTypes, IndentedWriter iw) throws IOException { ClassInfo innerInfo = new SimpleClassInfo( info.getPackageName(), Modifier.PUBLIC | Modifier.STATIC, "UnmodifiableShadow", info.getSuperclassName(), info.getInterfaceNames(), info.getGeneralImports(), info.getSpecificImports() ); SimplePropertyBeanGenerator innerGen = new SimplePropertyBeanGenerator(); innerGen.setInner( true ); innerGen.setForceUnmodifiable( true ); innerGen.addExtension( bege ); innerGen.addExtension( ccge ); innerGen.generate( innerInfo, props, iw ); } }
protected void addInternalImports() { if (boundProperties()) { specificImports.add("java.beans.PropertyChangeEvent"); specificImports.add("java.beans.PropertyChangeSupport"); specificImports.add("java.beans.PropertyChangeListener"); } if (constrainedProperties()) { specificImports.add("java.beans.PropertyChangeEvent"); specificImports.add("java.beans.PropertyVetoException"); specificImports.add("java.beans.VetoableChangeSupport"); specificImports.add("java.beans.VetoableChangeListener"); } for (Iterator ii = generatorExtensions.iterator(); ii.hasNext(); ) { GeneratorExtension ge = (GeneratorExtension) ii.next(); specificImports.addAll( ge.extraSpecificImports() ); generalImports.addAll( ge.extraGeneralImports() ); } }
protected void writePropertyGetter( Property prop, Class propType ) throws IOException { BeangenUtils.writePropertyGetter( prop, this.getGetterDefensiveCopyExpression( prop, propType ), iw ); // String pfx = ("boolean".equals( prop.getSimpleTypeName() ) ? "is" : "get" ); // iw.print( CodegenUtils.getModifierString( prop.getGetterModifiers() ) ); // iw.println(' ' + prop.getSimpleTypeName() + ' ' + pfx + BeangenUtils.capitalize( prop.getName() ) + "()"); // String retVal = getGetterDefensiveCopyExpression( prop, propType ); // if (retVal == null) retVal = prop.getName(); // iw.println("{ return " + retVal + "; }"); }
protected PropertyBeanGenerator createInnerGenerator() { SimplePropertyBeanGenerator innerGenerator = new SimplePropertyBeanGenerator(); innerGenerator.setInner( true ); innerGenerator.addExtension( new SerializableExtension() ); CloneableExtension ce = new CloneableExtension(); ce.setExceptionSwallowing( true ); innerGenerator.addExtension( ce ); return innerGenerator; }
protected void writeCoreBody() throws IOException writeJavaBeansChangeSupport(); writePropertyVariables(); writeOtherVariables(); iw.println(); writeGetterSetterPairs(); if ( boundProperties() ) writeBoundPropertyEventSourceMethods(); if ( constrainedProperties() ) writeConstrainedPropertyEventSourceMethods(); writeInternalUtilityFunctions(); writeOtherFunctions(); writeOtherClasses();
public synchronized void generate( ClassInfo info, Property[] props, Writer w) throws IOException { this.info = info; this.props = props; Arrays.sort( props, BeangenUtils.PROPERTY_COMPARATOR ); this.iw = ( w instanceof IndentedWriter ? (IndentedWriter) w : new IndentedWriter(w)); this.generalImports = new TreeSet(); if ( info.getGeneralImports() != null ) generalImports.addAll( Arrays.asList( info.getGeneralImports() ) ); this.specificImports = new TreeSet(); if ( info.getSpecificImports() != null ) specificImports.addAll( Arrays.asList( info.getSpecificImports() ) ); this.interfaceNames = new TreeSet(); if ( info.getInterfaceNames() != null ) interfaceNames.addAll( Arrays.asList( info.getInterfaceNames() ) ); addInternalImports(); addInternalInterfaces(); resolveTypes(); if (! inner ) { writeHeader(); iw.println(); } writeClassDeclaration(); iw.println('{'); iw.upIndent(); writeCoreBody(); iw.downIndent(); iw.println('}'); }
SimplePropertyBeanGenerator g = new SimplePropertyBeanGenerator(); g.addExtension( new SerializableExtension() ); g.generate(info, props, fw ); fw.flush(); fw.close();
Writer w = new BufferedWriter( new FileWriter( outFile ) ); SimplePropertyBeanGenerator gen = new SimplePropertyBeanGenerator(); gen.setGeneratorName( BeangenDataSourceGenerator.class.getName() ); gen.addExtension( idse ); gen.addExtension( new C3P0ImplUtilsParentLoggerGeneratorExtension() ); gen.addExtension( tsge ); gen.addExtension( prex ); gen.addExtension( biitcge ); gen.addExtension( new WcpdsExtrasGeneratorExtension() ); gen.addExtension( new UnmodifiableShadowGeneratorExtension() ); gen.generate( parsed.getClassInfo(), parsed.getProperties(), w );
protected void writePropertySetter( Property prop, Class propType ) throws IOException BeangenUtils.writePropertySetter( prop, this.getSetterDefensiveCopyExpression( prop, propType ), iw );
protected void writeCoreBody() throws IOException writeJavaBeansChangeSupport(); writePropertyVariables(); writeOtherVariables(); iw.println(); writeGetterSetterPairs(); if ( boundProperties() ) writeBoundPropertyEventSourceMethods(); if ( constrainedProperties() ) writeConstrainedPropertyEventSourceMethods(); writeInternalUtilityFunctions(); writeOtherFunctions(); writeOtherClasses();
interfaceNames.addAll( Arrays.asList( info.getInterfaceNames() ) ); addInternalImports(); addInternalInterfaces(); resolveTypes(); writeHeader(); iw.println(); generateClassJavaDocComment(); writeClassDeclaration(); iw.println('{'); iw.upIndent(); writeCoreBody();
protected PropertyBeanGenerator createInnerGenerator() { SimplePropertyBeanGenerator innerGenerator = new SimplePropertyBeanGenerator(); innerGenerator.setInner( true ); innerGenerator.addExtension( new SerializableExtension() ); CloneableExtension ce = new CloneableExtension(); ce.setExceptionSwallowing( true ); innerGenerator.addExtension( ce ); return innerGenerator; }
SimplePropertyBeanGenerator g = new SimplePropertyBeanGenerator(); g.addExtension( new SerializableExtension() ); g.generate(info, props, fw ); fw.flush(); fw.close();
Writer w = new BufferedWriter( new FileWriter( outFile ) ); SimplePropertyBeanGenerator gen = new SimplePropertyBeanGenerator(); gen.setGeneratorName( BeangenDataSourceGenerator.class.getName() ); gen.addExtension( idse ); gen.addExtension( new C3P0ImplUtilsParentLoggerGeneratorExtension() ); gen.addExtension( tsge ); gen.addExtension( prex ); gen.addExtension( biitcge ); gen.addExtension( new WcpdsExtrasGeneratorExtension() ); gen.addExtension( new UnmodifiableShadowGeneratorExtension() ); gen.generate( parsed.getClassInfo(), parsed.getProperties(), w );
protected void writePropertySetter( Property prop, Class propType ) throws IOException BeangenUtils.writePropertySetter( prop, this.getSetterDefensiveCopyExpression( prop, propType ), iw );
protected void writeCoreBody() throws IOException writeJavaBeansChangeSupport(); writePropertyVariables(); writeOtherVariables(); iw.println(); writeGetterSetterPairs(); if ( boundProperties() ) writeBoundPropertyEventSourceMethods(); if ( constrainedProperties() ) writeConstrainedPropertyEventSourceMethods(); writeInternalUtilityFunctions(); writeOtherFunctions(); writeOtherClasses();
public synchronized void generate( ClassInfo info, Property[] props, Writer w) throws IOException { this.info = info; this.props = props; Arrays.sort( props, BeangenUtils.PROPERTY_COMPARATOR ); this.iw = ( w instanceof IndentedWriter ? (IndentedWriter) w : new IndentedWriter(w)); this.generalImports = new TreeSet(); if ( info.getGeneralImports() != null ) generalImports.addAll( Arrays.asList( info.getGeneralImports() ) ); this.specificImports = new TreeSet(); if ( info.getSpecificImports() != null ) specificImports.addAll( Arrays.asList( info.getSpecificImports() ) ); this.interfaceNames = new TreeSet(); if ( info.getInterfaceNames() != null ) interfaceNames.addAll( Arrays.asList( info.getInterfaceNames() ) ); addInternalImports(); addInternalInterfaces(); resolveTypes(); if (! inner ) { writeHeader(); iw.println(); } writeClassDeclaration(); iw.println('{'); iw.upIndent(); writeCoreBody(); iw.downIndent(); iw.println('}'); }
public void generate(ClassInfo info, Class superclassType, Property[] props, Class[] propTypes, IndentedWriter iw) throws IOException { ClassInfo innerInfo = new SimpleClassInfo( info.getPackageName(), Modifier.PUBLIC | Modifier.STATIC, "UnmodifiableShadow", info.getSuperclassName(), info.getInterfaceNames(), info.getGeneralImports(), info.getSpecificImports() ); SimplePropertyBeanGenerator innerGen = new SimplePropertyBeanGenerator(); innerGen.setInner( true ); innerGen.setForceUnmodifiable( true ); innerGen.addExtension( bege ); innerGen.addExtension( ccge ); innerGen.generate( innerInfo, props, iw ); } }
protected PropertyBeanGenerator createInnerGenerator() { SimplePropertyBeanGenerator innerGenerator = new SimplePropertyBeanGenerator(); innerGenerator.setInner( true ); innerGenerator.addExtension( new SerializableExtension() ); CloneableExtension ce = new CloneableExtension(); ce.setExceptionSwallowing( true ); innerGenerator.addExtension( ce ); return innerGenerator; }
SimplePropertyBeanGenerator g = new SimplePropertyBeanGenerator(); g.addExtension( new SerializableExtension() ); g.generate(info, props, fw ); fw.flush(); fw.close();