Repository: groovy
Updated Branches:
  refs/heads/master 68d858b91 -> 70a40e182


fix a broken link plus some minor wording tweaks


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/70a40e18
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/70a40e18
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/70a40e18

Branch: refs/heads/master
Commit: 70a40e182a878b220cba17e8a36b56904ecaf5a6
Parents: 68d858b
Author: Paul King <pa...@asert.com.au>
Authored: Thu Oct 18 20:17:27 2018 +1000
Committer: Paul King <pa...@asert.com.au>
Committed: Thu Oct 18 20:17:47 2018 +1000

----------------------------------------------------------------------
 src/spec/doc/core-metaprogramming.adoc | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/70a40e18/src/spec/doc/core-metaprogramming.adoc
----------------------------------------------------------------------
diff --git a/src/spec/doc/core-metaprogramming.adoc 
b/src/spec/doc/core-metaprogramming.adoc
index 4e47196..eaf262d 100644
--- a/src/spec/doc/core-metaprogramming.adoc
+++ b/src/spec/doc/core-metaprogramming.adoc
@@ -26,6 +26,7 @@ The first allows altering the class model and the behavior of 
a program at runti
 at compile-time. Both have pros and cons that we will detail in this section.
 
 == Runtime metaprogramming
+
 With runtime metaprogramming we can postpone to runtime the decision to 
intercept, inject and even synthesize methods of classes and interfaces. For a 
deep understanding of Groovy's metaobject protocol (MOP) we need to understand 
Groovy objects and Groovy's method handling.
 In Groovy we work with three kinds of objects: POJO, POGO and Groovy 
Interceptors. Groovy allows metaprogramming for all types of objects but in a 
different manner.
 
@@ -357,15 +358,26 @@ Applying the `@Category` annotation has the advantage of 
being able to use insta
 first parameter. The target type class is given as an argument to the 
annotation instead.
 
 [NOTE]
-There is a distinct section on `@Category` in the 
<<core-metaprogramming.adoc#xform-Category,compile-time metaprogramming 
section>>.
+There is a distinct section on `@Category` in the
+<<core-metaprogramming.adoc#xform-Category,compile-time metaprogramming 
section>>.
 
 === Metaclasses
 
-As explained in other section, Metaclasses has a central role in the method 
resolution. For every method invocation from groovy code, Groovy will find the 
`MetaClass` for the given object and delegate the method resolution to the 
metaclass via 
gapid:groovy.lang.MetaClass#invokeMethod(java.lang.Class,java.lang.Object,java.lang.String,java.lang.Object,boolean,boolean)[MetaClass#invokeMethod]
 which should not be confused with 
gapid:groovy.lang.GroovyObject#invokeMethod(java.lang.String,java.lang.Object)[GroovyObject#invokeMethod].
+As explained earlier, Metaclasses play a central role in method resolution.
+For every method invocation from groovy code, Groovy will find the `MetaClass` 
for the given object
+and delegate the method resolution to the metaclass via
+gapid:groovy.lang.MetaClass#invokeMethod(java.lang.Class,java.lang.Object,java.lang.String,java.lang.Object,boolean,boolean)[MetaClass#invokeMethod]
+which should not be confused with
+gapid:groovy.lang.GroovyObject#invokeMethod(java.lang.String,java.lang.Object)[GroovyObject#invokeMethod]
+which happens to be a method that the metaclass may eventually call.
 
 
 ==== The default metaclass `MetaClassImpl`
-By default objects get an instance of `MetaClassImpl` that implements the 
default method lookup. This method lookup includes looking up of the method in 
the object class ("regular" method) but also if no method is found this way it 
will resort to calling `methodMissing` and ultimately 
gapid:groovy.lang.GroovyObject.html#invokeMethod(java.lang.String,java.lang.Object)[GroovyObject#invokeMethod]
+
+By default, objects get an instance of `MetaClassImpl` that implements the 
default method lookup.
+This method lookup includes looking up of the method in the object class 
("regular" method) but also if no
+method is found this way it will resort to calling `methodMissing` and 
ultimately
+gapid:groovy.lang.GroovyObject#invokeMethod(java.lang.String,java.lang.Object)[GroovyObject#invokeMethod]
 
 
 [source,groovy]
@@ -378,7 +390,6 @@ assert f.metaClass =~ /MetaClassImpl/
 ----
 
 
-
 ==== Custom metaclasses
 
 You can change the metaclass of any object or class and replace with a custom 
implementation of the `MetaClass` gapi:groovy.lang.MetaClass[interface]. 
Usually you will want to subclass one of the existing metaclasses 
`MetaClassImpl`, `DelegatingMetaClass`, `ExpandoMetaClass`, `ProxyMetaClass`, 
etc. otherwise you will need to implement the complete method lookup logic. 
Before using a new metaclass instance you should call  
gapid:groovy.lang.MetaClass#initialize()[] otherwise the metaclass may or may 
not behave as expected.

Reply via email to