方法指针只是一种方便的机制。
可以将方法指针当作调用对象方法的方便机制。
Think of the method pointer as a short-hand convenience mechanism for invoking methods along an object graph.
在清单10中,我使用了Groovy的方法指针来做这件坏事。
I've used Groovy's method Pointers for just this nefarious purpose in Listing 10.
现在,不要误会我:方法指针不是为了侵入代码或者获得对人们现金的引用!
Now, don't get me wrong: Method pointers aren't meant for hacking into code or obtaining references to people's cash!
关于方法指针,有意思的事情是:它们的使用可能就表明代码违反了迪米特法则。
The interesting thing about method Pointers is that their use can be an indication that the code violates the Law of Demeter.
每个元组的第一项是可调用对象(在这里是一个方法指针),第二项是 HTTP请求类型,这种请求类型可以调用该方法。
The first item in each tuple is a callable object (in this case a method pointer) and the second is a HTTP request type that the method should be called for.
然后,您可以将库装入到您的地址空间中并使用函数指针调用方法。
You could then load the library into your address space and call the methods using function Pointers.
方法实际上既可以声明为值也可以声明为指针类型。
Methods can actually be declared on both value and pointer types.
传递给JNI方法的指针都是有效的。
每个在GC堆中分配的对象有一个8字节的头(同步块+方法表指针)。
Each object allocated on the GC heap has an 8-byte overhead (sync block + method table pointer).
COM的客户程序通过获取指向一个对象接口的一个指针,并通过该指针来调用方法以实现与COM对象之间的互相作用,就好像对象驻留在客户程序的地址空间中一样。
A COM client interacts with a COM object by acquiring a pointer to one of the object's interfaces and invoking methods through that pointer, as if the object resides in the client's address space.
让我们通过该方法启动一个背景为白色的带指针时钟。
Let's start an analog clock with a wheat background using this method.
另一种方法是在ROLLBACK之后再次显式地打开游标,然后在ROLLBACK时把游标指针跳到读取的记录。
Another approach is to explicitly open the cursor again after ROLLBACK and skip the cursor pointer till the record read at the time of ROLLBACK.
最好地方法是为结构的副本创建指针,以替代闭包的使用。
The best one could do is to create a pointer to a copy of the structure, which defeats the purpose of having a closure.
我们现在知道了这是一个函数指针类型,它可以引用任何有一个int类型参数并且返回一个string类型的方法。
We now know that this represents a function pointer type that can refer to any method taking a single int argument and returning a string.
在pop方法中,在顶部指针递减之后,elements仍然会保留对将弹出堆栈的对象的引用。
In the pop method, after the top pointer is decremented, elements still maintains a reference to the object being popped off the stack.
当我们开始与库交流时,我们调用一个名为 newsession 的函数,它会返回一个空指针(这是组织事情的惯用方法)。
When we start talking to the library about something, we call a function called newsession that returns a void pointer (not an unusual way to organize things).
它由正在对其调用方法的GObject的指针、参数数组和关键字参数数组组成。
It is composed of a pointer to the GObject that the method is being called on, an array of arguments, and an array of keyword arguments.
如果一直都很留心,那么您可能已经注意到,JSRGroovy要求我使用新的&语法来创建subtractMoney方法的指针。
If you were paying careful attention you will have noted that JSR Groovy requires me to use the new & syntax to create a pointer to the method subtractMoney.
get_Document()方法取得的仅仅是一个接口指针。
What the get_Document() method provides is just a pointer to an interface.
一种快速但不正确的解决这个问题的方法是除去Leaf类并通过简单地将空指针放在Branch的left和right字段中来表示leaf节点。
The quick but incorrect way to remedy the problem would be to eliminate the Leaf class and represent Leaf nodes simply by putting null Pointers in the left and right fields of a Branch.
TSQLConnection组件有一个 ExecuteDirect方法,该方法可以执行不返回结果集合的SQL命令(也称为指针)。
The TSQLConnection component is equipped with an ExecuteDirect method to execute an SQL command that doesn't return a result set (also called cursor).
但是,这个方法将所选函数的指针复制到一个局部变量中,然后用function对象的call方法调用这个函数。而不是直接调用它。
However, the method copies a pointer to the selected function into a local variable, and then calls the function with the call method of the function object, rather than calling it directly.
使用指向CompositeContext的指针,可以调用下面的方法来获取指向服务的指针。
With the pointer to the CompositeContext, the following method can be invoked to obtain a pointer to service.
XMLStreamReader 就像一个指针,指在刚刚解析过的XML标记的后面,并提供了方法获得更多关于该标记的信息。
The XMLStreamReader acts as a cursor that points just beyond the most recently parsed XML token and provides methods for obtaining more information about it.
只要用要调用的方法替换 classname_function ,并用方法应该操作的对象指针替换object 。
Simply replace classname_function with the method to be called, and replace object with the object pointer upon which the method should operate.
接下来我们将了解更多有关使用指针和查询来筛选数据的方法。
We will see more about using cursors and queries to filter data next.
使用这种方法,应用程序沿着XML标记流移动指针,在每一步中检查解析器的状态来了解解析内容的更多信息。
Using this approach, the application advances a cursor over a stream of XML tokens, examining the parser state at every step to get more information about what was parsed.
使用这种方法,应用程序沿着XML标记流移动指针,在每一步中检查解析器的状态来了解解析内容的更多信息。
Using this approach, the application advances a cursor over a stream of XML tokens, examining the parser state at every step to get more information about what was parsed.
应用推荐