protected void generateExtraSerInitializers(ClassInfo info, Class superclassType, Property[] props, Class[] propTypes, IndentedWriter iw) throws IOException { if (BeangenUtils.hasBoundProperties( props )) iw.println("this.pcs = new PropertyChangeSupport( this );"); if (BeangenUtils.hasConstrainedProperties( props )) iw.println("this.vcs = new VetoableChangeSupport( this );"); }
public void generate(ClassInfo info, Class superclassType, Property[] props, Class[] propTypes, IndentedWriter iw) throws IOException { BeangenUtils.writeExplicitDefaultConstructor( ctor_modifiers, info, iw); } }
protected void writePropertySetter( Property prop, Class propType ) throws IOException { String stn = prop.getSimpleTypeName(); String pfx = ("boolean".equals( stn ) ? "is" : "get" ); String setVal = this.getSetterDefensiveCopyExpression( prop, propType ); if (setVal == null) setVal = prop.getName(); String getExpression = ("innerBean." + pfx + BeangenUtils.capitalize( prop.getName() ) + "()"); String setStatement = ("innerBean.set" + BeangenUtils.capitalize( prop.getName() ) + "( " + setVal + " );"); BeangenUtils.writePropertySetterWithGetExpressionSetStatement(prop, getExpression, setStatement, iw); } }
public static void writePropertySetter( Property prop, String setterDefensiveCopyExpression, IndentedWriter iw ) throws IOException { String setVal = setterDefensiveCopyExpression; if (setVal == null) setVal = prop.getName(); String usualGetExpression = ("this." + prop.getName()); String usualSetStatement = ("this." + prop.getName() + " = " + setVal + ';'); writePropertySetterWithGetExpressionSetStatement(prop, usualGetExpression, usualSetStatement, iw); }
BeangenUtils.writePropertyMember( masked[i], iw ); iw.println(); BeangenUtils.writePropertyGetter( masked[i], iw ); iw.println(); BeangenUtils.writePropertySetter( masked[i], iw ); for (int i = 0; i < num_props; ++i) String capName = BeangenUtils.capitalize( props[i].getName() ); iw.println("out.set" + capName + "( this." + (propTypes[i] == boolean.class ? "is" : "get") + capName + "() );"); for (int i = 0; i < num_props; ++i) String capName = BeangenUtils.capitalize( props[i].getName() ); iw.println("this.set" + capName + "( msb." + (propTypes[i] == boolean.class ? "is" : "get") + capName + "() );");
public void generate(ClassInfo info, Class superclassType, Property[] props, Class[] propTypes, IndentedWriter iw) throws IOException { int num_props = props.length; Property[] masked = new Property[ num_props ]; for (int i = 0; i < num_props; ++i) masked[i] = new SimplePropertyMask( props[i] ); iw.println("protected static class SimpleStateBean implements ExportedState"); iw.println("{"); iw.upIndent(); for (int i = 0; i < num_props; ++i) { masked[i] = new SimplePropertyMask( props[i] ); BeangenUtils.writePropertyMember( masked[i], iw ); iw.println(); BeangenUtils.writePropertyGetter( masked[i], iw ); iw.println(); BeangenUtils.writePropertySetter( masked[i], iw ); } iw.downIndent(); iw.println("}"); } }
private String extractorExpr( Property prop, Class propType ) { if ( propType.isPrimitive() ) { String castType = BeangenUtils.capitalize( prop.getSimpleTypeName() ); String valueMethod = prop.getSimpleTypeName() + "Value()"; if ( propType == char.class) castType = "Character"; else if ( propType == int.class) castType = "Integer"; return "((" + castType + ") pds[i].getReadMethod().invoke( bean, NOARGS ))." + valueMethod; } else return "(" + prop.getSimpleTypeName() + ") pds[i].getReadMethod().invoke( bean, NOARGS )"; } }
iw.print(" void set" + BeangenUtils.capitalize( prop.getName() ) + "( " + prop.getSimpleTypeName() + ' ' + prop.getName() + " )"); if ( prop.isConstrained() ) iw.println(" throws PropertyVetoException"); iw.upIndent(); if ( changeMarked( prop ) )
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 + "; }"); }
BeangenUtils.writeArgList(subProps, true, iw); iw.println(" )"); iw.println("{");
boolean constrainedProperties() { return BeangenUtils.hasConstrainedProperties( props ); }
boolean boundProperties() { return BeangenUtils.hasBoundProperties( props ); }
protected void writePropertySetter( Property prop, Class propType ) throws IOException BeangenUtils.writePropertySetter( prop, this.getSetterDefensiveCopyExpression( prop, propType ), iw );
public void generate(ClassInfo info, Class superclassType, Property[] props, Class[] propTypes, IndentedWriter iw) throws IOException { int num_props = props.length; Property[] masked = new Property[ num_props ]; for (int i = 0; i < num_props; ++i) masked[i] = new SimplePropertyMask( props[i] ); iw.println("protected static class SimpleStateBean implements ExportedState"); iw.println("{"); iw.upIndent(); for (int i = 0; i < num_props; ++i) { masked[i] = new SimplePropertyMask( props[i] ); BeangenUtils.writePropertyMember( masked[i], iw ); iw.println(); BeangenUtils.writePropertyGetter( masked[i], iw ); iw.println(); BeangenUtils.writePropertySetter( masked[i], iw ); } iw.downIndent(); iw.println("}"); } }
private String extractorExpr( Property prop, Class propType ) { if ( propType.isPrimitive() ) { String castType = BeangenUtils.capitalize( prop.getSimpleTypeName() ); String valueMethod = prop.getSimpleTypeName() + "Value()"; if ( propType == char.class) castType = "Character"; else if ( propType == int.class) castType = "Integer"; return "((" + castType + ") pds[i].getReadMethod().invoke( bean, NOARGS ))." + valueMethod; } else return "(" + prop.getSimpleTypeName() + ") pds[i].getReadMethod().invoke( bean, NOARGS )"; } }
public static void writePropertySetter( Property prop, String setterDefensiveCopyExpression, IndentedWriter iw ) throws IOException { String setVal = setterDefensiveCopyExpression; if (setVal == null) setVal = prop.getName(); String usualGetExpression = ("this." + prop.getName()); String usualSetStatement = ("this." + prop.getName() + " = " + setVal + ';'); writePropertySetterWithGetExpressionSetStatement(prop, usualGetExpression, usualSetStatement, iw); }
iw.print(" void set" + BeangenUtils.capitalize( prop.getName() ) + "( " + prop.getSimpleTypeName() + ' ' + prop.getName() + " )"); if ( prop.isConstrained() ) iw.println(" throws PropertyVetoException"); iw.upIndent(); if ( changeMarked( prop ) )
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 + "; }"); }
BeangenUtils.writeArgList(subProps, true, iw); iw.println(" )"); iw.println("{");
boolean constrainedProperties() { return BeangenUtils.hasConstrainedProperties( props ); }