public static CtMethod generateSetter(CtField field, String interceptorAccess) throws NotFoundException, CannotCompileException
  {
    String setterName = "set" + capitalize(field.getName());
    
    CtMethod setter = CtNewMethod.setter( setterName, field );
    
    if(interceptorAccess != null)
      setter.setBody( interceptorAccess + "." + setterName + "($$);" );
    
    field.getDeclaringClass().addMethod(setter);

    return setter;
  }
public static CtMethod generateSetter(CtField field, String interceptorAccess) throws NotFoundException, CannotCompileException
  {
    String setterName = "set" + capitalize(field.getName());
    
    CtMethod setter = CtNewMethod.setter( setterName, field );
    
    if(interceptorAccess != null)
      setter.setBody( interceptorAccess + "." + setterName + "($$);" );
    
    field.getDeclaringClass().addMethod(setter);

    return setter;
  }
public static CtMethod generateSetter ( CtField field , String interceptorAccess ) throws NotFoundException , CannotCompileException { String setterName = "set" + capitalize ( field . getName ( ) ) ; CtMethod setter = CtNewMethod . setter ( setterName , field ) ; if ( interceptorAccess != null ) setter . setBody ( interceptorAccess + "." + setterName + "($$);" ) ; field . getDeclaringClass ( ) . addMethod ( setter ) ; return setter ; }
Generates a setter for the field (get<FieldName>) and adds it to the declaring class.

@param field
@return
@throws NotFoundException
@throws CannotCompileException
Generates a setter for the field ( get<FieldName > ) and adds it to the declaring class .