From commits-return-10010-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Wed Nov 27 18:38:40 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 3F750180675 for ; Wed, 27 Nov 2019 19:38:40 +0100 (CET) Received: (qmail 5626 invoked by uid 500); 27 Nov 2019 18:38:39 -0000 Mailing-List: contact commits-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list commits@groovy.apache.org Received: (qmail 5609 invoked by uid 99); 27 Nov 2019 18:38:39 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Nov 2019 18:38:39 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 685CE8B691; Wed, 27 Nov 2019 18:38:39 +0000 (UTC) Date: Wed, 27 Nov 2019 18:38:40 +0000 To: "commits@groovy.apache.org" Subject: [groovy] 01/01: GROOVY-9207: fixed links in core-metaprogramming MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: emilles@apache.org In-Reply-To: <157487991922.7031.2709724107487358681@gitbox.apache.org> References: <157487991922.7031.2709724107487358681@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: groovy X-Git-Refname: refs/heads/GROOVY-9207 X-Git-Reftype: branch X-Git-Rev: 5f7d2fc6f57803f70b9fae58d0b50a7748bb5369 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20191127183839.685CE8B691@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. emilles pushed a commit to branch GROOVY-9207 in repository https://gitbox.apache.org/repos/asf/groovy.git commit 5f7d2fc6f57803f70b9fae58d0b50a7748bb5369 Author: Eric Milles AuthorDate: Wed Nov 27 12:38:13 2019 -0600 GROOVY-9207: fixed links in core-metaprogramming --- src/spec/doc/core-metaprogramming.adoc | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/spec/doc/core-metaprogramming.adoc b/src/spec/doc/core-metaprogramming.adoc index a26b222..1690315 100644 --- a/src/spec/doc/core-metaprogramming.adoc +++ b/src/spec/doc/core-metaprogramming.adoc @@ -32,7 +32,7 @@ In Groovy we work with three kinds of objects: POJO, POGO and Groovy Interceptor - POJO - A regular Java object whose class can be written in Java or any other language for the JVM. - POGO - A Groovy object whose class is written in Groovy. It extends `java.lang.Object` and implements the gapi:groovy.lang.GroovyObject[] interface by default. -- Groovy Interceptor - A Groovy object that implements the gapi:groovy.lang.GroovyInterceptable[] interface and has method-interception capability which is discussed in the <> section. +- Groovy Interceptor - A Groovy object that implements the gapi:groovy.lang.GroovyInterceptable[] interface and has method-interception capability which is discussed in the <<_groovyinterceptable,GroovyInterceptable>> section. For every method call Groovy checks whether the object is a POJO or a POGO. For POJOs, Groovy fetches its `MetaClass` from the gapi:groovy.lang.MetaClassRegistry[] and delegates method invocation to it. For POGOs, Groovy takes more steps, as illustrated in the following figure: @@ -63,7 +63,7 @@ public interface GroovyObject { ==== invokeMethod -This method is primarily intended to be used in conjunction with the <> +This method is primarily intended to be used in conjunction with the <<_groovyinterceptable,GroovyInterceptable>> interface or an object's `MetaClass` where it will intercept all method calls. It is also invoked when the method called is not present on a Groovy object. Here is a simple example using an @@ -75,7 +75,7 @@ include::{projectdir}/src/spec/test/metaprogramming/GroovyObjectTest.groovy[tags ---- However, the use of `invokeMethod` to intercept missing methods is discouraged. In cases where the intent is to only -intercept method calls in the case of a failed method dispatch use <> +intercept method calls in the case of a failed method dispatch use <<_methodmissing,methodMissing>> instead. ==== get/setProperty @@ -110,7 +110,7 @@ someObject.metaClass = new OwnMetaClassImplementation() ---- [NOTE] -You can find an additional example in the <> topic. +You can find an additional example in the <<_groovyinterceptable,GroovyInterceptable>> topic. === get/setAttribute @@ -161,7 +161,7 @@ class GORM { } ---- -Notice how, if we find a method to invoke, we then dynamically register a new method on the fly using <>. +Notice how, if we find a method to invoke, we then dynamically register a new method on the fly using <>. This is so that the next time the same method is called it is more efficient. This way of using `methodMissing` does not have the overhead of `invokeMethod` _and_ is not expensive from the second call on. @@ -190,7 +190,7 @@ performance. === static methodMissing -Static variant of `methodMissing` method can be added via the <> +Static variant of `methodMissing` method can be added via the <> or can be implemented at the class level with `$static_methodMissing` method. [source,groovy] @@ -200,7 +200,7 @@ include::{projectdir}/src/spec/test/metaprogramming/StaticPropertyMissingAndMeth === static propertyMissing -Static variant of `propertyMissing` method can be added via the <> +Static variant of `propertyMissing` method can be added via the <> or can be implemented at the class level with `$static_propertyMissing` method. [source,groovy] @@ -244,7 +244,7 @@ include::{projectdir}/src/spec/test/metaprogramming/InterceptionThroughMetaClass ---- [NOTE] -Additional information about `MetaClass` can be found in the <> section. +Additional information about `MetaClass` can be found in the <<_metaclasses,MetaClasses>> section. [[categories]] === Categories @@ -358,8 +358,7 @@ 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 -<>. +There is a distinct section on `@Category` in the <>. === Metaclasses @@ -864,8 +863,7 @@ and what are the disadvantages of this technique. Groovy comes with various AST transformations covering different needs: reducing boilerplate (code generation), implementing design patterns (delegation, ...), logging, declarative concurrency, cloning, safer scripting, tweaking the compilation, implementing Swing patterns, testing and eventually managing dependencies. If none of those AST transformations cover -your needs, you can still implement your own, as show in section <>. +your needs, you can still implement your own, as show in section <>. AST transformations can be separated into two categories: @@ -2661,29 +2659,29 @@ Here, the `add` method will have final parameters but the `mult` method will rem [[xform-AnnotationCollector]] ===== `@groovy.transform.AnnotationCollector` -`@AnnotationCollector` allows the creation of meta-annotations, which are described in a <>. +`@AnnotationCollector` allows the creation of meta-annotations, which are described in a <<_meta_annotations,dedicated section>>. [[xform-TypeChecked]] ===== `@groovy.transform.TypeChecked` -`@TypeChecked` activates compile-time type checking on your Groovy code. See <> for details. +`@TypeChecked` activates compile-time type checking on your Groovy code. See <> for details. [[xform-CompileStatic]] ===== `@groovy.transform.CompileStatic` -`@CompileStatic` activates static compilation on your Groovy code. See <> for details. +`@CompileStatic` activates static compilation on your Groovy code. See <> for details. [[xform-CompileDynamic]] ===== `@groovy.transform.CompileDynamic` -`@CompileDynamic` disables static compilation on parts of your Groovy code. See <> for details. +`@CompileDynamic` disables static compilation on parts of your Groovy code. See <> for details. [[xform-DelegatesTo]] ===== `@groovy.lang.DelegatesTo` `@DelegatesTo` is not, technically speaking, an AST transformation. It is aimed at documenting code and helping the compiler in case you are using <> or <>. The annotation is described thoroughly in the -<> of this guide. +<> of this guide. [[xform-SelfType]] ===== `@groovy.transform.SelfType` @@ -3059,7 +3057,7 @@ Global AST transformation are similar to local one with a major difference: they they are applied _globally_, that is to say on each class being compiled. It is therefore very important to limit their use to last resort, because it can have a significant impact on the compiler performance. -Following the example of the <>, imagine that we would like to trace all +Following the example of the <>, imagine that we would like to trace all methods, and not only those which are annotated with `@WithLogging`. Basically, we need this code to behave the same as the one annotated with `@WithLogging` before: