/** * return the Java type for the given type reference in the model. */ private JType resolve(CTypeRef typeRef,Aspect a) { return outline.parent().resolve(typeRef,a); }
ClassOutlineImpl( BeanGenerator _parent, CClassInfo _target, JDefinedClass exposedClass, JDefinedClass _implClass, JClass _implRef ) { super(_target,exposedClass,_implRef,_implClass); this._parent = _parent; _package().classes.add(this); }
protected boolean checkForSuperClassFields(final ClassOutlineImpl classOutline, final Map<String, List<JFieldVar>> classFields) { if (classOutline.getSuperClass() == null) { return false; } final String key = classOutline.getSuperClass().implClass.name(); final List<JFieldVar> fields = classFields.get(key); return fields == null || fields.isEmpty(); } }
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) { // add isSetXXX and unsetXXX. MethodWriter writer = outline.createMethodWriter(); JCodeModel codeModel = outline.parent().getCodeModel(); FieldAccessor acc = core.create(JExpr._this()); if( generateIsSetMethod ) { // [RESULT] boolean isSetXXX() JExpression hasSetValue = acc.hasSetValue(); if( hasSetValue==null ) { // this field renderer doesn't support the isSet/unset methods generation. // issue an error throw new UnsupportedOperationException(); } writer.declareMethod(codeModel.BOOLEAN,"isSet"+this.prop.getName(true)) .body()._return( hasSetValue ); } if( generateUnSetMethod ) { // [RESULT] void unsetXXX() acc.unsetValues( writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() ); } }
protected JMethod createGetter() { final MethodWriter writer = outline.createMethodWriter(); final JMethod getter = writer.declareMethod(propertyListType, getGetterName()); final JBlock body = getter.body(); fix(body); body._return(propertyField); return getter; }
/** * Generates the minimum {@link JDefinedClass} skeleton * without filling in its body. */ private ClassOutlineImpl generateClassDef(CClassInfo bean) { ImplStructureStrategy.Result r = model.strategy.createClasses(this,bean); JClass implRef; if( bean.getUserSpecifiedImplClass()!=null ) { // create a place holder for a user-specified class. JDefinedClass usr; try { usr = codeModel._class(bean.getUserSpecifiedImplClass()); // but hide that file so that it won't be generated. usr.hide(); } catch( JClassAlreadyExistsException e ) { // it's OK for this to collide. usr = e.getExistingClass(); } usr._extends(r.implementation); implRef = usr; } else implRef = r.implementation; return new ClassOutlineImpl(this,bean,r.exposed,r.implementation,implRef); }
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) { // add isSetXXX and unsetXXX. MethodWriter writer = outline.createMethodWriter(); JCodeModel codeModel = outline.parent().getCodeModel(); FieldAccessor acc = core.create(JExpr._this()); if( generateIsSetMethod ) { // [RESULT] boolean isSetXXX() JExpression hasSetValue = acc.hasSetValue(); if( hasSetValue==null ) { // this field renderer doesn't support the isSet/unset methods generation. // issue an error throw new UnsupportedOperationException(); } writer.declareMethod(codeModel.BOOLEAN,"isSet"+this.prop.getName(true)) .body()._return( hasSetValue ); } if( generateUnSetMethod ) { // [RESULT] void unsetXXX() acc.unsetValues( writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() ); } }
protected JMethod createGetter() { final MethodWriter writer = outline.createMethodWriter(); final JMethod getter = writer.declareMethod(propertyListType, getGetterName()); final JBlock body = getter.body(); fix(body); body._return(propertyField); return getter; }
/** * Generates the minimum {@link JDefinedClass} skeleton * without filling in its body. */ private ClassOutlineImpl generateClassDef(CClassInfo bean) { ImplStructureStrategy.Result r = model.strategy.createClasses(this,bean); JClass implRef; if( bean.getUserSpecifiedImplClass()!=null ) { // create a place holder for a user-specified class. JDefinedClass usr; try { usr = codeModel._class(bean.getUserSpecifiedImplClass()); // but hide that file so that it won't be generated. usr.hide(); } catch( JClassAlreadyExistsException e ) { // it's OK for this to collide. usr = e.getExistingClass(); } usr._extends(r.implementation); implRef = usr; } else implRef = r.implementation; return new ClassOutlineImpl(this,bean,r.exposed,r.implementation,implRef); }
/** * return the Java type for the given type reference in the model. */ private JType resolve(CTypeRef typeRef,Aspect a) { return outline.parent().resolve(typeRef,a); } }
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) { // add isSetXXX and unsetXXX. MethodWriter writer = outline.createMethodWriter(); JCodeModel codeModel = outline.parent().getCodeModel(); FieldAccessor acc = core.create(JExpr._this()); if( generateIsSetMethod ) { // [RESULT] boolean isSetXXX() JExpression hasSetValue = acc.hasSetValue(); if( hasSetValue==null ) { // this field renderer doesn't support the isSet/unset methods generation. // issue an error throw new UnsupportedOperationException(); } writer.declareMethod(codeModel.BOOLEAN,"isSet"+this.prop.getName(true)) .body()._return( hasSetValue ); } if( generateUnSetMethod ) { // [RESULT] void unsetXXX() acc.unsetValues( writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() ); } }
protected JMethod createSetter() { final JMethod setter; final MethodWriter writer = outline.createMethodWriter(); setter = writer.declareMethod(codeModel.VOID, getSetterName()); final JVar value = writer.addParameter(propertyListType, "value"); final JBlock body = setter.body(); body.assign(wrappedPropertyField, JExpr._null()); body.assign(wrappingPropertyField, JExpr._null()); body.assign(propertyField, value); fix(body); return setter; }
ClassOutlineImpl( BeanGenerator _parent, CClassInfo _target, JDefinedClass exposedClass, JDefinedClass _implClass, JClass _implRef ) { super(_target,exposedClass,_implRef,_implClass); this._parent = _parent; _package().classes.add(this); }
/** * Generates the minimum {@link JDefinedClass} skeleton * without filling in its body. */ private ClassOutlineImpl generateClassDef(CClassInfo bean) { ImplStructureStrategy.Result r = model.strategy.createClasses(this, bean); JClass implRef; if (bean.getUserSpecifiedImplClass() != null) { // create a place holder for a user-specified class. JDefinedClass usr; try { usr = codeModel._class(bean.getUserSpecifiedImplClass()); // but hide that file so that it won't be generated. usr.hide(); } catch (JClassAlreadyExistsException e) { // it's OK for this to collide. usr = e.getExistingClass(); } usr._extends(r.implementation); implRef = usr; } else { implRef = r.implementation; } return new ClassOutlineImpl(this, bean, r.exposed, r.implementation, implRef); }
/** * return the Java type for the given type reference in the model. */ private JType resolve(CTypeRef typeRef,Aspect a) { return outline.parent().resolve(typeRef,a); }
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) { // add isSetXXX and unsetXXX. MethodWriter writer = outline.createMethodWriter(); JCodeModel codeModel = outline.parent().getCodeModel(); FieldAccessor acc = core.create(JExpr._this()); if( generateIsSetMethod ) { // [RESULT] boolean isSetXXX() JExpression hasSetValue = acc.hasSetValue(); if( hasSetValue==null ) { // this field renderer doesn't support the isSet/unset methods generation. // issue an error throw new UnsupportedOperationException(); } writer.declareMethod(codeModel.BOOLEAN,"isSet"+this.prop.getName(true)) .body()._return( hasSetValue ); } if( generateUnSetMethod ) { // [RESULT] void unsetXXX() acc.unsetValues( writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() ); } }
protected JMethod createSetter() { final JMethod setter; final MethodWriter writer = outline.createMethodWriter(); setter = writer.declareMethod(codeModel.VOID, getSetterName()); final JVar value = writer.addParameter(propertyListType, "value"); final JBlock body = setter.body(); body.assign(wrappedPropertyField, JExpr._null()); body.assign(wrappingPropertyField, JExpr._null()); body.assign(propertyField, value); fix(body); return setter; }
ClassOutlineImpl( BeanGenerator _parent, CClassInfo _target, JDefinedClass exposedClass, JDefinedClass _implClass, JClass _implRef ) { super(_target,exposedClass,_implRef,_implClass); this._parent = _parent; _package().classes.add(this); }
/** * Generates the minimum {@link JDefinedClass} skeleton * without filling in its body. */ private ClassOutlineImpl generateClassDef(CClassInfo bean) { ImplStructureStrategy.Result r = model.strategy.createClasses(this, bean); JClass implRef; if (bean.getUserSpecifiedImplClass() != null) { // create a place holder for a user-specified class. JDefinedClass usr; try { usr = codeModel._class(bean.getUserSpecifiedImplClass()); // but hide that file so that it won't be generated. usr.hide(); } catch (JClassAlreadyExistsException e) { // it's OK for this to collide. usr = e.getExistingClass(); } usr._extends(r.implementation); implRef = usr; } else { implRef = r.implementation; } return new ClassOutlineImpl(this, bean, r.exposed, r.implementation, implRef); }
/** * return the Java type for the given type reference in the model. */ private JType resolve(CTypeRef typeRef,Aspect a) { return outline.parent().resolve(typeRef,a); }