Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package net.sf.alchim.codeplus.spoonprocessor;
 
This template defines the needed template code for matching and/or generating field accesses through getters and setters:

Based:
on Spoon FieldAccess example
public class StupidGetSetTemplate<_FieldType_> implements Template {
    @Parameter
    @Parameter("_field_")
    
name of the field
    String __field_;
    @Parameter
    
name of the field with the first letter uppercased
    String _Field_;
    @SuppressWarnings("unchecked")
    @Local
    public StupidGetSetTemplate(CtTypeReference typeString field) {
         = type;
         = field;
        char[] chars = field.toCharArray();
        chars[0] = Character.toUpperCase(chars[0]);
         = new String(chars);
    }
    @Local
    _FieldType_ _field_;
    public _FieldType_ get_Field_() {
        return ;
    }
    public void set_Field_(_FieldType_ v) {
         = v;
    }
New to GrepCode? Check out our FAQ X