public static CtMethod generateGetter(CtField field, String interceptorAccess) throws NotFoundException, CannotCompileException
  {
    String getterName = "get" + capitalize(field.getName());
    
    CtMethod getter = CtNewMethod.getter( getterName, field );

    if(interceptorAccess != null)
      getter.setBody( interceptorAccess + "." + getterName + "($$);" );

    field.getDeclaringClass().addMethod(getter);

    return getter;
  }
public static CtMethod generateGetter(CtField field, String interceptorAccess) throws NotFoundException, CannotCompileException
  {
    String getterName = "get" + capitalize(field.getName());
    
    CtMethod getter = CtNewMethod.getter( getterName, field );

    if(interceptorAccess != null)
      getter.setBody( interceptorAccess + "." + getterName + "($$);" );

    field.getDeclaringClass().addMethod(getter);

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

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