protected final void generate() { // for the collectionType customization to take effect, the field needs to be strongly typed, // not just List<Foo>. field = outline.implClass.field( JMod.PROTECTED, listT, prop.getName(false) ); if(eagerInstanciation) field.init(newCoreList()); annotate(field); // generate the rest of accessors generateAccessors(); }
private JExpression newCoreList() { return JExpr._new(getCoreListType()); }
@Override protected JType getType(final Aspect aspect) { if (Aspect.IMPLEMENTATION.equals(aspect)) { return super.getType(aspect); } return codeModel.ref(Serializable.class); } }
/** * Generates statement(s) so that the successive {@link Accessor#ref(boolean)} with * true will always return a non-null list. * * This is useful to avoid generating redundant internal getter. */ protected final void fixNullRef(JBlock block) { block._if(field.eq(JExpr._null()))._then() .assign(field,newCoreList()); }
private void generateInternalGetter() { internalGetter = outline.implClass.method(JMod.PROTECTED,listT,"_get"+prop.getName(true)); if(!eagerInstanciation) { // if eagerly instanciated, the field can't be null fixNullRef(internalGetter.body()); } internalGetter.body()._return(field); }
/** * Annotate the field according to the recipes given as {@link CPropertyInfo}. */ @Override protected void annotate( JAnnotatable field ) { super.annotate(field); if (prop instanceof CReferencePropertyInfo) { CReferencePropertyInfo pref = (CReferencePropertyInfo)prop; if (pref.isDummy()) { annotateDummy(field); } } }
/** * Generates statement(s) so that the successive {@link Accessor#ref(boolean)} with * true will always return a non-null list. * * This is useful to avoid generating redundant internal getter. */ protected final void fixNullRef(JBlock block) { block._if(field.eq(JExpr._null()))._then() .assign(field,newCoreList()); }
private void generateInternalGetter() { internalGetter = outline.implClass.method(JMod.PROTECTED,listT,"_get"+prop.getName(true)); if(!eagerInstanciation) { // if eagerly instanciated, the field can't be null fixNullRef(internalGetter.body()); } internalGetter.body()._return(field); }
/** * Annotate the field according to the recipes given as {@link CPropertyInfo}. */ @Override protected void annotate( JAnnotatable field ) { super.annotate(field); if (prop instanceof CReferencePropertyInfo) { CReferencePropertyInfo pref = (CReferencePropertyInfo)prop; if (pref.isDummy()) { annotateDummy(field); } } }
protected final void generate() { // for the collectionType customization to take effect, the field needs to be strongly typed, // not just List<Foo>. field = outline.implClass.field( JMod.PROTECTED, listT, prop.getName(false) ); if(eagerInstanciation) field.init(newCoreList()); annotate(field); // generate the rest of accessors generateAccessors(); }
@Override protected JType getType(final Aspect aspect) { if (Aspect.IMPLEMENTATION.equals(aspect)) { return super.getType(aspect); } return codeModel.ref(Serializable.class); } }
/** * Generates statement(s) so that the successive {@link Accessor#ref(boolean)} with * true will always return a non-null list. * * This is useful to avoid generating redundant internal getter. */ protected final void fixNullRef(JBlock block) { block._if(field.eq(JExpr._null()))._then() .assign(field,newCoreList()); }
private void generateInternalGetter() { internalGetter = outline.implClass.method(JMod.PROTECTED,listT,"_get"+prop.getName(true)); if(!eagerInstanciation) { // if eagerly instanciated, the field can't be null fixNullRef(internalGetter.body()); } internalGetter.body()._return(field); }
/** * Annotate the field according to the recipes given as {@link CPropertyInfo}. */ @Override protected void annotate( JAnnotatable field ) { super.annotate(field); if (prop instanceof CReferencePropertyInfo) { CReferencePropertyInfo pref = (CReferencePropertyInfo)prop; if (pref.isDummy()) { annotateDummy(field); } } }
private JExpression newCoreList() { return JExpr._new(getCoreListType()); }
protected final void generate() { // for the collectionType customization to take effect, the field needs to be strongly typed, // not just List<Foo>. field = outline.implClass.field( JMod.PROTECTED, listT, prop.getName(false) ); if(eagerInstanciation) field.init(newCoreList()); annotate(field); // generate the rest of accessors generateAccessors(); }
@Override protected JType getType(final Aspect aspect) { if (Aspect.IMPLEMENTATION.equals(aspect)) { return super.getType(aspect); } return codeModel.ref(Serializable.class); } }
/** * Generates statement(s) so that the successive {@link Accessor#ref(boolean)} with * true will always return a non-null list. * * This is useful to avoid generating redundant internal getter. */ protected final void fixNullRef(JBlock block) { block._if(field.eq(JExpr._null()))._then() .assign(field,newCoreList()); }
private void generateInternalGetter() { internalGetter = outline.implClass.method(JMod.PROTECTED,listT,"_get"+prop.getName(true)); if(!eagerInstanciation) { // if eagerly instanciated, the field can't be null fixNullRef(internalGetter.body()); } internalGetter.body()._return(field); }
/** * Annotate the field according to the recipes given as {@link CPropertyInfo}. */ @Override protected void annotate( JAnnotatable field ) { super.annotate(field); if (prop instanceof CReferencePropertyInfo) { CReferencePropertyInfo pref = (CReferencePropertyInfo)prop; if (pref.isDummy()) { annotateDummy(field); } } }