diff options
Diffstat (limited to 'website/features/experimental')
-rw-r--r-- | website/features/experimental/Accessors.html | 116 | ||||
-rw-r--r-- | website/features/experimental/Builder.html | 141 | ||||
-rw-r--r-- | website/features/experimental/Delegate.html | 100 | ||||
-rw-r--r-- | website/features/experimental/ExtensionMethod.html | 116 | ||||
-rw-r--r-- | website/features/experimental/FieldDefaults.html | 91 | ||||
-rw-r--r-- | website/features/experimental/Wither.html | 111 | ||||
-rw-r--r-- | website/features/experimental/index.html | 71 | ||||
-rw-r--r-- | website/features/experimental/onX.html | 88 |
8 files changed, 0 insertions, 834 deletions
diff --git a/website/features/experimental/Accessors.html b/website/features/experimental/Accessors.html deleted file mode 100644 index 20590a07..00000000 --- a/website/features/experimental/Accessors.html +++ /dev/null @@ -1,116 +0,0 @@ -<!DOCTYPE html> -<html><head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="stylesheet" type="text/css" href="../../logi/reset.css" /> - <link rel="stylesheet" type="text/css" href="../features.css" /> - <link rel="shortcut icon" href="../../favicon.ico" type="image/x-icon" /> - <meta name="description" content="Spice up your java" /> - <title>EXPERIMENTAL - @Accessors</title> -</head><body><div id="pepper"> - <div class="minimumHeight"></div> - <div class="meat"> - <div class="header"><a href="../../index.html">Project Lombok</a></div> - <h1>@Accessors</h1> - <div class="byline">A more fluent API for getters and setters.</div> - <div class="since"> - <h3>Since</h3> - <p> - @Accessors was introduced as experimental feature in lombok v0.11.0. - </p> - </div> - <div class="experimental"> - <h3>Experimental</h3> - <p> - Experimental because: - <ul> - <li>We may want to roll these features into a more complete property support concept.</li> - <li>New feature - community feedback requested.</li> - </ul> - Current status: <em>positive</em> - Currently we feel this feature may move out of experimental status with no or minor changes soon. - </div> - <div class="overview"> - <h3>Overview</h3> - <p> - The <code>@Accessors</code> annotation is used to configure how lombok generates and looks for getters and setters. - </p><p> - By default, lombok follows the <em>bean specification</em> for getters and setters: The getter for a field named <code>pepper</code> - is <code>getPepper</code> for example. However, some might like to break with the <em>bean specification</em> in order to end up with - nicer looking APIs. <code>@Accessors</code> lets you do this. - </p><p> - Some programmers like to use a prefix for their fields, i.e. they write <code>fPepper</code> instead of <code>pepper</code>. - We <em>strongly</em> discourage doing this, as you can't unit test the validity of your prefixes, and refactor scripts may turn fields - into local variables or method names. Furthermore, your tools (such as your editor) can take care of rendering the identifier in a - certain way if you want this information to be instantly visible. Nevertheless, you can list the prefixes that your project uses via - <code>@Accessors</code> as well. - </p><p> - <code>@Accessors</code> therefore has 3 options:<ul> - <li><code>fluent</code> - A boolean. If <em>true</em>, the getter for <code>pepper</code> is just <code>pepper()</code>, and the - setter is <code>pepper(T newValue)</code>. Furthermore, unless specified, <code>chain</code> defaults to <em>true</em>.<br /> - Default: <em>false</em>.</li> - <li><code>chain</code> - A boolean. If <em>true</em>, generated setters return <code>this</code> instead of <code>void</code>.<br /> - Default: <em>false</em>, unless <code>fluent=true</code>, then Default: <em>true</em>.</li> - <li><code>prefix</code> - A list of strings. If present, fields must be prefixed with any of these prefixes. Each field name is - compared to each prefix in the list in turn, and if a match is found, the prefix is stripped out to create the base name for - the field. It is legal to include an empty string in the list, which will always match. For characters which are letters, the - character following the prefix must not be a lowercase letter, i.e. <code>pepper</code> is not a match even to prefix <code>p</code>, - but <code>pEpper</code> would be (and would mean the base name of this field is <code>epper</code>).</li> - </p><p> - The <code>@Accessors</code> annotation is legal on types and fields; the annotation that applies is the one on the field if present, - otherwise the one on the class. When a <code>@Accessors</code> annotation on a field is present, any <code>@Accessors</code> annotation - also present on that field's type is ignored. - </p> - </div> - <div class="snippets"> - <div class="pre"> - <h3>With Lombok</h3> - <div class="snippet">@HTML_PRE@</div> - </div> - <div class="sep"></div> - <div class="post"> - <h3>Vanilla Java</h3> - <div class="snippet">@HTML_POST@</div> - </div> - </div> - <div style="clear: left;"></div> - <div class="overview confKeys"> - <h3>Supported configuration keys:</h3> - <dl> - <dt><code>lombok.accessors.chain</code> = [<code>true</code> | <code>false</code>] (default: false)</dt> - <dd>If set to <code>true</code>, any class that either doesn't have an <code>@Accessors</code> annotation, or it does, but that annotation does not have an explicit value for the <code>chain</code> parameter, will act as if <code>@Accessors(chain = true)</code> is present.</dd> - <dt><code>lombok.accessors.fluent</code> = [<code>true</code> | <code>false</code>] (default: false)</dt> - <dd>If set to <code>true</code>, any class that either doesn't have an <code>@Accessors</code> annotation, or it does, but that annotation does not have an explicit value for the <code>fluent</code> parameter, will act as if <code>@Accessors(fluent = true)</code> is present.</dd> - <dt><code>lombok.accessors.prefix</code> += <em>a field prefix</em> (default: empty list)</dt> - <dd>This is a list property; entries can be added with the <code>+=</code> operator. Inherited prefixes from parent config files can be removed with the <code>-=</code> operator. Any class that either doesn't have an <code>@Accessors</code> annotation, or it does, but that annotation does not have an explicit value for the <code>prefix</code> parameter, will act as if <code>@Accessors(prefix = {<em>prefixes listed in configuration</em>})</code> is present.</dd> - <dt><code>lombok.accessors.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)</dt> - <dd>Lombok will flag any usage of <code>@Accessors</code> as a warning or error if configured.</dd> - </dl> - </div> - <div class="overview"> - <h3>Small print</h3><div class="smallprint"> - <p> - The nearest <code>@Accessors</code> annotation is also used for the various methods in lombok that look for getters, such as - <code>@EqualsAndHashCode</code>. - </p><p> - If a prefix list is provided and a field does not start with one of them, that field is skipped entirely by lombok, and - a warning will be generated. - </p> - </div> - </div> - <div class="footer"> - <a href="index.html">Back to experimental features</a> | <a href="Builder.html">Previous feature (@Builder)</a> | <a href="ExtensionMethod.html">Next feature (@ExtensionMethod)</a><br /> - <a href="../../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2009-2014 The Project Lombok Authors, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span> - </div> - <div style="clear: both;"></div> - </div> -</div> -<script type="text/javascript"> - var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); - document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); -</script> -<script type="text/javascript"> - try { - var pageTracker = _gat._getTracker("UA-9884254-1"); - pageTracker._trackPageview(); - } catch(err) {} -</script> -</body></html> diff --git a/website/features/experimental/Builder.html b/website/features/experimental/Builder.html deleted file mode 100644 index a8e21b9a..00000000 --- a/website/features/experimental/Builder.html +++ /dev/null @@ -1,141 +0,0 @@ -<!DOCTYPE html> -<html><head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="stylesheet" type="text/css" href="../../logi/reset.css" /> - <link rel="stylesheet" type="text/css" href="../features.css" /> - <link rel="shortcut icon" href="../../favicon.ico" type="image/x-icon" /> - <meta name="description" content="Spice up your java" /> - <title>EXPERIMENTAL - @Builder</title> -</head><body><div id="pepper"> - <div class="minimumHeight"></div> - <div class="meat"> - <div class="header"><a href="../../index.html">Project Lombok</a></div> - <h1>@Builder</h1> - <div class="byline">... and Bob's your uncle: No-hassle fancy-pants APIs for object creation!</div> - <div class="since"> - <h3>Since</h3> - <p> - @Builder was introduced as experimental feature in lombok v0.12.0. - </p> - </div> - <div class="experimental"> - <h3>Experimental</h3> - <p> - Experimental because: - <ul> - <li>New feature - community feedback requested.</li> - </ul> - Current status: <em>sure thing</em> - This feature will move to the core package soon. - </div> - <div class="overview"> - <h3>Overview</h3> - <p> - The <code>@Builder</code> annotation produces complex builder APIs for your classes. - </p><p> - <code>@Builder</code> lets you automatically produce the code required to have your class be instantiable with code such as:<br /> - <code>Person.builder().name("Adam Savage").city("San Francisco").worksAt("Mythbusters").build();</code> - </p><p> - <code>@Builder</code> can be placed on a class, or on a constructor, or on a static method. While the "on a class" and "on a constructor" - mode are the most common use-case, <code>@Builder</code> is most easily explained with the "static method" use-case. - </p><p> - A static method annotated with <code>@Builder</code> (from now on called the <em>target</em>) causes the following 7 things to be generated:<ul> - <li>An inner static class named <code><em>Foo</em>Builder</code>, with the same type arguments as the static method (called the <em>builder</em>).</li> - <li>In the <em>builder</em>: One private non-static non-final field for each parameter of the <em>target</em>.</li> - <li>In the <em>builder</em>: A package private no-args empty constructor.</li> - <li>In the <em>builder</em>: A 'setter'-like method for each parameter of the <em>target</em>: It has the same type as that parameter and the same name. - It returns the builder itself, so that the setter calls can be chained, as in the above example.</li> - <li>In the <em>builder</em>: A <code>build()</code> method which calls the static method, passing in each field. It returns the same type that the - <em>target</em> returns.</li> - <li>In the <em>builder</em>: A sensible <code>toString()</code> implementation.</li> - <li>In the class containing the <em>target</em>: A <code>builder()</code> method, which creates a new instance of the <em>builder</em>.</li> - </ul> - Each listed generated element will be silently skipped if that element already exists (disregarding parameter counts and looking only at names). This - includes the <em>builder</em> itself: If that class already exists, lombok will simply start injecting fields and methods inside this already existing - class, unless of course the fields / methods to be injected already exist. You may not put any other method (or constructor) generating lombok annotation - on a builder class though; for example, you can not put <code>@EqualsAndHashCode</code> on the builder class. - </p><p> - Now that the "static method" mode is clear, putting a <code>@Builder</code> annotation on a constructor functions similarly; effectively, - constructors are just static methods that have a special syntax to invoke them: Their 'return type' is the class they construct, and their - type parameters are the same as the type parameters of the class itself. - </p><p> - Finally, applying <code>@Builder</code> to a class is as if you added <code>@AllArgsConstructor(access = AccessLevel.PACKAGE)</code> to the class and applied the - <code>@Builder</code> annotation to this all-args-constructor. This only works if you haven't written any explicit constructors yourself. If you do have an - explicit constructor, put the <code>@Builder</code> annotation on the constructor instead of on the class. - </p><p> - The name of the builder class is <code><em>Foobar</em>Builder</code>, where <em>Foobar</em> is the simplified, title-cased form of the return type of the - <em>target</em> - that is, the name of your type for <code>@Builder</code> on constructors and types, and the name of the return type for <code>@Builder</code> - on static methods. For example, if <code>@Builder</code> is applied to a class named <code>com.yoyodyne.FancyList<T></code>, then the builder name will be - <code>FancyListBuilder<T></code>. If <code>@Builder</code> is applied to a static method that returns <code>void</code>, the builder will be named - <code>VoidBuilder</code>. - </p><p> - The configurable aspects of builder are:<ul> - <li>The <em>builder's class name</em> (default: return type + 'Builder')</li> - <li>The <em>build()</em> method's name (default: <code>"build"</code>)</li> - <li>The <em>builder()</em> method's name (default: <code>"builder"</code>)</li> - <li>The 'fluent' nature of the generated 'setter'-like methods. A fluent 'setter' is named just <code>fieldName()</code>, a non-fluent one is named <code>setFieldName()</code>. (default: <code>true</code>)</li> - <li>The 'chain' nature of the generated 'setter'-like methods. A chainable 'setter' returns the builder object itself, letting you chain 'set' calls. A non-chainable setter returns <code>void</code>. (default: <code>true</code>)</li> - </ul> - Example usage where all options are changed from their defaults:<br /> - <code>@Builder(builderClassName = "HelloWorldBuilder", buildMethodName = "execute", builderMethodName = "helloWorld", fluent = false, chain = false)</code><br /> - </p> - </div> - <div class="snippets"> - <div class="pre"> - <h3>With Lombok</h3> - <div class="snippet">@HTML_PRE@</div> - </div> - <div class="sep"></div> - <div class="post"> - <h3>Vanilla Java</h3> - <div class="snippet">@HTML_POST@</div> - </div> - </div> - <div style="clear: left;"></div> - <div class="overview confKeys"> - <h3>Supported configuration keys:</h3> - <dl> - <dt><code>lombok.builder.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)</dt> - <dd>Lombok will flag any usage of <code>@Builder</code> as a warning or error if configured.</dd> - </dl> - </div> - <div class="overview"> - <h3>Small print</h3><div class="smallprint"> - <p> - Another strategy for fluent APIs is that the programmer using your library statically imports your 'builder' method. In this case, you might want to name your builder - method equal to your type's name. So, the builder method for a class called <code>Person</code> would become <code>person()</code>. This is nicer if the builder method - is statically imported. - </p><p> - If the return type of your target static method is a type parameter (such as <code>T</code>), lombok will enforce an explicit builder class name. - </p><p> - You don't HAVE to use <code>@Builder</code> to build anything; you can for example put it on a static method that has lots of parameter to improve the API of it. - In this case, we suggest you use <code>buildMethodName = </code> to rename the build method to <code>execute()</code> instead. - </p><p> - The builder class will NOT get an auto-generated implementation of <code>hashCode</code> or <code>equals</code> methods! These would suggest that it is sensible to use - instances of a builder as keys in a set or map. However, that's not a sensible thing to do. Hence, no <code>hashCode</code> or <code>equals</code>. - </p><p> - Generics are sorted out for you. - </p><p> - If an explicit constructor is present, but <code>@Builder</code> is placed on the class, then the builder will be generated as if an explicit constructor is present with the - same arguments list as what <code>@AllArgsConstructor</code> would produce. If this constructor does not exist, a compile time error will result. Usually you should just either let - lombok make this constructor (delete your constructor from the source), or, move the <code>@Builder</code> annotation to the constructor. - </p> - </div> - </div> - <div class="footer"> - <a href="index.html">Back to experimental features</a> | <span class="disabled">Previous feature</span> | <a href="Accessors.html">Next feature (@Accessors)</a><br /> - <a href="../../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2009-2014 The Project Lombok Authors, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span> - </div> - <div style="clear: both;"></div> - </div> -</div> -<script type="text/javascript"> - var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); - document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); -</script> -<script type="text/javascript"> - try { - var pageTracker = _gat._getTracker("UA-9884254-1"); - pageTracker._trackPageview(); - } catch(err) {} -</script> -</body></html> diff --git a/website/features/experimental/Delegate.html b/website/features/experimental/Delegate.html deleted file mode 100644 index bd4fc393..00000000 --- a/website/features/experimental/Delegate.html +++ /dev/null @@ -1,100 +0,0 @@ -<!DOCTYPE html> -<html><head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="stylesheet" type="text/css" href="../../logi/reset.css" /> - <link rel="stylesheet" type="text/css" href="../features.css" /> - <link rel="shortcut icon" href="../../favicon.ico" type="image/x-icon" /> - <meta name="description" content="Spice up your java" /> - <title>@Delegate</title> -</head><body><div id="pepper"> - <div class="minimumHeight"></div> - <div class="meat"> - <div class="header"><a href="../../index.html">Project Lombok</a></div> - <h1>@Delegate</h1> - <div class="byline">Don't lose your composition.</div> - <div class="since"> - <h3>Since</h3> - <p> - @Delegate was introduced as feature in lombok v0.10. It was moved to the experimental package in lombok v1.14; the old version from the main lombok package is now deprecated. - </p> - </div> - <div class="experimental"> - <h3>Experimental</h3> - <p> - Experimental because: - <ul> - <li>Not used that much</li> - <li>Difficult to support for edge cases, such as recursive delegation.</li> - <li>API is rather unfriendly; it would be a lot nicer if you can simply implement some methods and let <code>@Delegate</code> generate delegates for whatever you didn't manually implement, but due to issues with generics erasure this also can't be made to work without caveats. - </ul> - Current status: <em>negative</em> - Currently we feel this feature will not move out of experimental status anytime soon, and support for this feature may be dropped if future versions of javac or ecj make it difficult to continue to maintain the feature. - </div> - <div class="overview"> - <h3>Overview</h3> - <p> - Any field or no-argument method can be annotated with <code>@Delegate</code> to let lombok generate delegate methods that forward the call to this field (or the result of invoking this method). - </p><p> - Lombok delegates all <code>public</code> methods of the field's type (or method's return type), as well as those of its supertypes except for all - methods declared in <code>java.lang.Object</code>. - </p><p> - You can pass any number of classes into the <code>@Delegate</code> annotation's <code>types</code> parameter. - If you do that, then lombok will delegate all <code>public</code> methods in those types (and their supertypes, except <code>java.lang.Object</code>) instead of looking at the field/method's type. - </p><p> - All public non-<code>Object</code> methods that are part of the calculated type(s) are copied, whether or not you also wrote implementations for those methods. That would thus result in duplicate method errors. You can avoid these - by using the <code>@Delegate(excludes=SomeType.class)</code> parameter to exclude all public methods in the excluded type(s), and their supertypes. - </p><p> - To have very precise control over what is delegated and what isn't, write private inner interfaces with method signatures, then specify these - private inner interfaces as types in <code>@Delegate(types=PrivateInnerInterfaceWithIncludesList.class, excludes=SameForExcludes.class)</code>. - </p> - </div> - <div class="snippets"> - <div class="pre"> - <h3>With Lombok</h3> - <div class="snippet">@HTML_PRE@</div> - </div> - <div class="sep"></div> - <div class="post"> - <h3>Vanilla Java</h3> - <div class="snippet">@HTML_POST@</div> - </div> - </div> - <div style="clear: left;"></div> - <div class="overview confKeys"> - <h3>Supported configuration keys:</h3> - <dl> - <dt><code>lombok.delegate.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)</dt> - <dd>Lombok will flag any usage of <code>@Delegate</code> as a warning or error if configured.</dd> - </dl> - </div> - <div class="overview"> - <h3>Small print</h3><div class="smallprint"> - <p> - When passing classes to the annotation's <code>types</code> or <code>excludes</code> parameter, you cannot include generics. - This is a limitation of java. Use private inner interfaces or classes that extend the intended type including the - generics parameter to work around this problem. - </p><p> - When passing classes to the annotation, these classes do not need to be supertypes of the field. See the example. - </p><p> - <code>@Delegate</code> cannot be used on static fields or methods. - </p><p> - <code>@Delegate</code> cannot be used when the calculated type(s) to delegate / exclude themselves contain <code>@Delegate</code> annotations; in other words, <code>@Delegate</code> will error if you attempt to use it recursively. - </div> - </div> - <div class="footer"> - <a href="index.html">Back to experimental features</a> | <a href="FieldDefaults.html">Previous feature (@FieldDefaults)</a> | <a href="Wither.html">Next feature (@Wither)</a><br /> - <a href="../../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2010-2013 The Project Lombok Authors, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span> - </div> - <div style="clear: both;"></div> - </div> -</div> -<script type="text/javascript"> - var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); - document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); -</script> -<script type="text/javascript"> - try { - var pageTracker = _gat._getTracker("UA-9884254-1"); - pageTracker._trackPageview(); - } catch(err) {} -</script> -</body></html> diff --git a/website/features/experimental/ExtensionMethod.html b/website/features/experimental/ExtensionMethod.html deleted file mode 100644 index 58aaf1b3..00000000 --- a/website/features/experimental/ExtensionMethod.html +++ /dev/null @@ -1,116 +0,0 @@ -<!DOCTYPE html> -<html><head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="stylesheet" type="text/css" href="../../logi/reset.css" /> - <link rel="stylesheet" type="text/css" href="../features.css" /> - <link rel="shortcut icon" href="../../favicon.ico" type="image/x-icon" /> - <meta name="description" content="Spice up your java" /> - <title>EXPERIMENTAL - @ExtensionMethod</title> -</head><body><div id="pepper"> - <div class="minimumHeight"></div> - <div class="meat"> - <div class="header"><a href="../../index.html">Project Lombok</a></div> - <h1>@ExtensionMethod</h1> - <div class="byline">Annoying API? Fix it yourself: Add new methods to existing types!</div> - <div class="since"> - <h3>Since</h3> - <p> - @ExtensionMethod was introduced as experimental feature in lombok v0.11.2. - </p> - </div> - <div class="experimental"> - <h3>Experimental</h3> - <p> - Experimental because: - <ul> - <li>High-impact on code style</li> - <li>Really would like to ship with utility methods to expand common classes, but so far lombok doesn't have a good distribution method for such runtime dependencies</li> - <li>Affects quite a bit of eclipse, and auto-complete e.d. do not work yet in netbeans</li> - <li>Should @ExtensionMethod be legal on methods? Should it be legal on packages?</li> - </ul> - Current status: <em>positive</em> - Currently we feel this feature may move out of experimental status with no or minor changes soon. - </div> - <div class="overview"> - <h3>Overview</h3> - <p> - You can make a class containing a bunch of <code>public</code>, <code>static</code> methods which all take at least 1 - parameter. These methods will extend the type of the first parameter, as if they were instance methods, using the - <code>@ExtensionMethod</code> feature. - </p> - </p><p> - For example, if you create <code>public static String toTitleCase(String in) { ... }</code>, you can use the - <code>@ExtensionMethod</code> feature to make it look like the <code>java.lang.String</code> class has a method named - <code>toTitleCase</code>, which has no arguments. The first argument of the static method fills the role of <code>this</code> - in instance methods. - </p><p> - All methods that are <code>public</code>, <code>static</code>, and have at least 1 argument whose type is not primitive, are - considered extension methods, and each will be injected into the namespace of the type of the first parameter as if they were - instance methods. As in the above example, a call that looks like: <code>foo.toTitleCase()</code> is replaced with - <code>ClassContainingYourExtensionMethod.toTitleCase(foo);</code>. Note that it is actually not an instant - <code>NullPointerException</code> if <code>foo</code> is null - it is passed like any other parameter. - </p><p> - You can pass any number of classes to the <code>@ExtensionMethod</code> annotation; they will all be searched for - extension methods. These extension methods apply for any code that is in the annotated class. - </p><p> - Lombok does not (currently) have any runtime dependencies which means lombok does not (currently) ship with any useful - extension methods so you'll have to make your own. However, here's one that might spark your imagination: - <pre>public class ObjectExtensions { - public static <T> or(T object, T ifNull) { - return object != null ? object : ifNull; - } -}</pre> - With the above class, if you add <code>@ExtensionMethod(ObjectExtensions.class)</code> to your class definition, you can write: - <pre>String x = null; -System.out.println(x.or("Hello, World!"));</pre> - The above code will not fail with a <code>NullPointerException</code>; it will actually output <code>Hello, World!</code> - </p> - </div> - <div class="snippets"> - <div class="pre"> - <h3>With Lombok</h3> - <div class="snippet">@HTML_PRE@</div> - </div> - <div class="sep"></div> - <div class="post"> - <h3>Vanilla Java</h3> - <div class="snippet">@HTML_POST@</div> - </div> - </div> - <div style="clear: left;"></div> - <div class="overview confKeys"> - <h3>Supported configuration keys:</h3> - <dl> - <dt><code>lombok.extensionMethod.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)</dt> - <dd>Lombok will flag any usage of <code>@ExtensionMethod</code> as a warning or error if configured.</dd> - </dl> - </div> - <div class="overview"> - <h3>Small print</h3><div class="smallprint"> - <p> - Calls are rewritten to a call to the extension method; the static method itself is not inlined. Therefore, the - extension method must be present both at compile and at runtime. - </p><p> - Generics is fully applied to figure out extension methods. i.e. if the first parameter of your extension method is - <code>List<? extends String></code>, then any expression that is compatible with that will have your extension method, - but other kinds of lists won't. So, a <code>List<Object></code> won't get it, but a <code>List<String></code> will. - </p> - </div> - </div> - <div class="footer"> - <a href="index.html">Back to experimental features</a> | <a href="Accessors.html">Previous feature (@Accessors)</a> | <a href="FieldDefaults.html">Next feature (@FieldDefaults)</a><br /> - <a href="../../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2009-2014 The Project Lombok Authors, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span> - </div> - <div style="clear: both;"></div> - </div> -</div> -<script type="text/javascript"> - var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); - document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); -</script> -<script type="text/javascript"> - try { - var pageTracker = _gat._getTracker("UA-9884254-1"); - pageTracker._trackPageview(); - } catch(err) {} -</script> -</body></html> diff --git a/website/features/experimental/FieldDefaults.html b/website/features/experimental/FieldDefaults.html deleted file mode 100644 index 12ea7d80..00000000 --- a/website/features/experimental/FieldDefaults.html +++ /dev/null @@ -1,91 +0,0 @@ -<!DOCTYPE html> -<html><head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="stylesheet" type="text/css" href="../../logi/reset.css" /> - <link rel="stylesheet" type="text/css" href="../features.css" /> - <link rel="shortcut icon" href="../../favicon.ico" type="image/x-icon" /> - <meta name="description" content="Spice up your java" /> - <title>EXPERIMENTAL - @FieldDefaults</title> -</head><body><div id="pepper"> - <div class="minimumHeight"></div> - <div class="meat"> - <div class="header"><a href="../../index.html">Project Lombok</a></div> - <h1>@FieldDefaults</h1> - <div class="byline">New default field modifiers for the 21st century.</div> - <div class="since"> - <h3>Since</h3> - <p> - @FieldDefaults was introduced as experimental feature in lombok v0.11.4. - </p> - </div> - <div class="experimental"> - <h3>Experimental</h3> - <p> - Experimental because: - <ul> - <li>New feature; unsure if this busts enough boilerplate</li> - <li>Would be nice if you could stick this on the package-info.java package to set the default for all classes in that package</li> - <li>Part of the work on @Value, which is experimental</li> - </ul> - Current status: <em>positive</em> - Currently we feel this feature may move out of experimental status with no or minor changes soon. - </div> - <div class="overview"> - <h3>Overview</h3> - <p> - The <code>@FieldDefaults</code> annotation can add an access modifier (<code>public</code>, <code>private</code>, or <code>protected</code>) - to each field in the annotated class or enum. It can also add <code>final</code> to each field in the annotated class or enum. - </p> - </p><p> - To add <code>final</code> to each field, use <code>@FieldDefaults(makeFinal=true)</code>. Any non-final field which must remain nonfinal - can be annotated with <code>@NonFinal</code> (also in the <code>lombok.experimental</code> package). - </p><p> - To add an access modifier to each field, use <code>@FieldDefaults(level=AccessLevel.PRIVATE)</code>. Any field that does not already have an - access modifier (i.e. any field that looks like package private access) is changed to have the appropriate access modifier. Any package private - field which must remain package private can be annotated with <code>@PackagePrivate</code> (also in the <code>lombok.experimental</code> package). - </p> - </div> - <div class="snippets"> - <div class="pre"> - <h3>With Lombok</h3> - <div class="snippet">@HTML_PRE@</div> - </div> - <div class="sep"></div> - <div class="post"> - <h3>Vanilla Java</h3> - <div class="snippet">@HTML_POST@</div> - </div> - </div> - <div style="clear: left;"></div> - <div class="overview confKeys"> - <h3>Supported configuration keys:</h3> - <dl> - <dt><code>lombok.fieldDefaults.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)</dt> - <dd>Lombok will flag any usage of <code>@FieldDefaults</code> as a warning or error if configured.</dd> - </dl> - </div> - <div class="overview"> - <h3>Small print</h3><div class="smallprint"> - <p> - Like other lombok handlers that touch fields, any field whose name starts with a dollar (<code>$</code>) symbol is skipped entirely. - Such a field will not be modified at all. - </p> - </div> - </div> - <div class="footer"> - <a href="index.html">Back to experimental features</a> | <a href="ExtensionMethod.html">Previous feature (@ExtensionMethod)</a> | <a href="Delegate.html">Next feature (@Delegate)</a><br /> - <a href="../../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2009-2014 The Project Lombok Authors, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span> - </div> - <div style="clear: both;"></div> - </div> -</div> -<script type="text/javascript"> - var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); - document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); -</script> -<script type="text/javascript"> - try { - var pageTracker = _gat._getTracker("UA-9884254-1"); - pageTracker._trackPageview(); - } catch(err) {} -</script> -</body></html> diff --git a/website/features/experimental/Wither.html b/website/features/experimental/Wither.html deleted file mode 100644 index 9ca43a46..00000000 --- a/website/features/experimental/Wither.html +++ /dev/null @@ -1,111 +0,0 @@ -<!DOCTYPE html> -<html><head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="stylesheet" type="text/css" href="../../logi/reset.css" /> - <link rel="stylesheet" type="text/css" href="../features.css" /> - <link rel="shortcut icon" href="../../favicon.ico" type="image/x-icon" /> - <meta name="description" content="Spice up your java" /> - <title>EXPERIMENTAL - @ExtensionMethod</title> -</head><body><div id="pepper"> - <div class="minimumHeight"></div> - <div class="meat"> - <div class="header"><a href="../../index.html">Project Lombok</a></div> - <h1>@Wither</h1> - <div class="byline">Immutable 'setters' - methods that create a clone but with one changed field.</div> - <div class="since"> - <h3>Since</h3> - <p> - @Wither was introduced as experimental feature in lombok v0.11.4. - </p> - </div> - <div class="experimental"> - <h3>Experimental</h3> - <p> - Experimental because: - <ul> - <li>Still not sure that <code>@Wither</code> is an appropriate name for this feature.</li> - <li>Should there be an option to supply a way of cloning the input somehow?</li> - <li>Should the way that the clone is created by configurable?</li> - <li>Should we replace @Wither entirely with a builder class?</li> - </ul> - Current status: <em>neutral</em> - More feedback requires on the items in the above list before promotion to the main package is warranted. - </div> - <div class="overview"> - <h3>Overview</h3> - <p> - The next best alternative to a setter for an immutable property is to construct a clone of the object, but with a new value for this one field. - A method to generate this clone is precisely what <code>@Wither</code> generates: a <code>withFieldName(newValue)</code> method which produces a clone - except for the new value for the associated field. - </p><p> - For example, if you create <code>public class Point { private final int x, y; }</code>, setters make no sense because the fields - are final. <code>@Wither</code> can generate a <code>withX(int newXValue)</code> method for you which will return a new point with the supplied - value for <code>x</code> and the same value for <code>y</code>. - </p><p> - Like <a href="../GetterSetter.html"><code>@Setter</code></a>, you can specify an access level in case you want the generated wither to be something other than <code>public</code>:<br /> - <code>@Wither(level = AccessLevel.PROTECTED)</code>. Also like <a href="../GetterSetter.html"><code>@Setter</code></a>, you can also put a <code>@Wither</code> annotation on a type, which means - a 'wither' is generated for each field (even non-final fields). - </p><p> - To put annotations on the generated method, you can use <code>onMethod=@__({@AnnotationsHere})</code>; to put annotations on the only parameter of a generated wither method, you can use <code>onParam=@__({@AnnotationsHere})</code>. Be careful though! This is an experimental feature. For more details see the documentation on the <a href="onX.html">onX</a> feature. - </p><p> - <em>NEW in lombok v1.12.0:</em> javadoc on the field will now be copied to generated withers. Normally, all text is copied, and <code>@param</code> is <em>moved</em> to the wither, whilst <code>@return</code> lines are stripped from the wither's javadoc. Moved means: Deleted from the field's javadoc. It is also possible to define unique text for the wither's javadoc. To do that, you create a 'section' named <code>WITHER</code>. A section is a line in your javadoc containing 2 or more dashes, then the text 'WITHER', followed by 2 or more dashes, and nothing else on the line. If you use sections, <code>@return</code> and <code>@param</code> stripping / copying for that section is no longer done (move the <code>@param</code> line into the section). - </p> - </div> - <div class="snippets"> - <div class="pre"> - <h3>With Lombok</h3> - <div class="snippet">@HTML_PRE@</div> - </div> - <div class="sep"></div> - <div class="post"> - <h3>Vanilla Java</h3> - <div class="snippet">@HTML_POST@</div> - </div> - </div> - <div style="clear: left;"></div> - <div class="overview confKeys"> - <h3>Supported configuration keys:</h3> - <dl> - <dt><code>lombok.wither.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)</dt> - <dd>Lombok will flag any usage of <code>@Wither</code> as a warning or error if configured.</dd> - </dl> - </div> - <div class="overview"> - <h3>Small print</h3><div class="smallprint"> - <p> - Withers cannot be generated for static fields because that makes no sense. - </p><p> - When applying <code>@Wither</code> to a type, static fields and fields whose name start with a $ are skipped. - </p><p> - For generating the method names, the first character of the field, if it is a lowercase character, is title-cased, otherwise, it is left unmodified. - Then, <code>with</code> is prefixed. - </p><p> - No method is generated if any method already exists with the same name (case insensitive) and same parameter count. For example, <code>withX(int x)</code> - will not be generated if there's already a method <code>withX(String... x)</code> even though it is technically possible to make the method. This caveat - exists to prevent confusion. If the generation of a method is skipped for this reason, a warning is emitted instead. Varargs count as 0 to N parameters. - </p><p> - For <code>boolean</code> fields that start with <code>is</code> immediately followed by a title-case letter, nothing is prefixed to generate the wither name. - </p><p> - Any annotations named <code>@NonNull</code> (case insensitive) on the field are interpreted as: This field must not ever hold - <em>null</em>. Therefore, these annotations result in an explicit null check in the generated wither. Also, these - annotations (as well as any annotation named <code>@Nullable</code> or <code>@CheckForNull</code>) are copied to wither parameter. - </p> - </div> - </div> - <div class="footer"> - <a href="index.html">Back to experimental features</a> | <a href="Delegate.html">Previous feature (@Delegate)</a> | <a href="onX.html">Next feature (onX)</a><br /> - <a href="../../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2009-2014 The Project Lombok Authors, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span> - </div> - <div style="clear: both;"></div> - </div> -</div> -<script type="text/javascript"> - var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); - document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); -</script> -<script type="text/javascript"> - try { - var pageTracker = _gat._getTracker("UA-9884254-1"); - pageTracker._trackPageview(); - } catch(err) {} -</script> -</body></html> diff --git a/website/features/experimental/index.html b/website/features/experimental/index.html deleted file mode 100644 index f37712e0..00000000 --- a/website/features/experimental/index.html +++ /dev/null @@ -1,71 +0,0 @@ -<!DOCTYPE html> -<html><head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="stylesheet" type="text/css" href="../../logi/reset.css" /> - <link rel="stylesheet" type="text/css" href="../features.css" /> - <link rel="shortcut icon" href="../../favicon.ico" type="image/x-icon" /> - <meta name="description" content="Spice up your java" /> - <title>Lombok feature overview</title> -</head><body><div id="pepper"> - <div class="minimumHeight"></div> - <div class="meat"> - <div class="header"><a href="../../index.html">Project Lombok</a></div> - <h1>Lombok experimental features</h1> - <div class="index overview"> - Experimental features are available in your normal lombok installation, but are not as robustly supported as lombok's main features. - In particular, experimental features:<ul> - <li>Are not tested as well as the core features.</li> - <li>Do not get bugs fixed as quickly as core features.</li> - <li>May have APIs that will change, possibly drastically if we find a different, better way to solve the same problem.</li> - <li>May disappear entirely if the feature is too difficult to support or does bust enough boilerplate.</li> - </ul> - Features that receive positive community feedback and which seem to produce clean, flexible code will eventually become accepted - as a core feature and move out of the experimental package. - <dl> - <dt><a href="Builder.html"><code>@Builder</code></a></dt> - <dd>... and Bob's your uncle: No-hassle fancy-pants APIs for object creation!</dd> - <dt><a href="Accessors.html"><code>@Accessors</code></a></dt> - <dd>A more fluent API for getters and setters.</dd> - <dt><a href="ExtensionMethod.html"><code>@ExtensionMethod</code></a></dt> - <dd>Annoying API? Fix it yourself: Add new methods to existing types!</dd> - <dt><a href="FieldDefaults.html"><code>@FieldDefaults</code></a></dt> - <dd>New default field modifiers for the 21st century.</dd> - <dt><a href="Delegate.html"><code>@Delegate</code></a></dt> - <dd>Don't lose your composition.</dd> - <dt><a href="Wither.html"><code>@Wither</code></a></dt> - <dd>Immutable 'setters' - methods that create a clone but with one changed field.</dd> - <dt><a href="onX.html"><code>onMethod= / onConstructor= / onParam=</code></a></dt> - <dd>Sup dawg, we heard you like annotations, so we put annotations in your annotations so you can annotate while you're annotating.</dd> - </dl> - </div> - <div class="overview confKeys"> - <h3>Supported configuration keys:</h3> - <dl> - <dt><code>lombok.experimental.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)</dt> - <dd>Lombok will flag any usage of any of the features listed here as a warning or error if configured.</dd> - </dl> - </div> - <div class="index overview"> - <h3>Putting the "Ex" in "Experimental": promoted or deleted experimental features.</h3> - <dl> - <dt><a href="../Value.html"><code>@Value</code></a>: Promoted</dt> - <dd><code>@Value</code> has proven its value and has been moved to the main package.</li> - </dl> - </div> - <div class="footer"> - <a href="../../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2009-2014 The Project Lombok Authors, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span> - </div> - <div style="clear: both;"></div> - </div> -</div> -<script type="text/javascript"> - var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); - document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); -</script> -<script type="text/javascript"> - try { - var pageTracker = _gat._getTracker("UA-9884254-1"); - pageTracker._trackPageview(); - } catch(err) {} -</script> -</body></html> diff --git a/website/features/experimental/onX.html b/website/features/experimental/onX.html deleted file mode 100644 index ba2ead86..00000000 --- a/website/features/experimental/onX.html +++ /dev/null @@ -1,88 +0,0 @@ -<!DOCTYPE html> -<html><head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="stylesheet" type="text/css" href="../../logi/reset.css" /> - <link rel="stylesheet" type="text/css" href="../features.css" /> - <link rel="shortcut icon" href="../../favicon.ico" type="image/x-icon" /> - <meta name="description" content="Spice up your java" /> - <title>onX</title> -</head><body><div id="pepper"> - <div class="minimumHeight"></div> - <div class="meat"> - <div class="header"><a href="../../index.html">Project Lombok</a></div> - <h1>onX</h1> - <div class="byline">Sup dawg, we heard you like annotations, so we put annotations in your annotations so you can annotate while you're annotating.</div> - <div class="since"> - <h3>Since</h3> - <p> - onX was introduced as experimental feature in lombok v0.11.8. - </p> - </div> - <div class="experimental"> - <h3>Experimental</h3> - <p> - Experimental because: - <ul> - <li>Ugly syntax. The syntax of this feature is not optimal, but it is the least convoluted syntax that could possibly work (for now!)</li> - <li>Possibly java 9 will offer (much) better ways of supporting this feature.</li> - <li>Uncertainty: Future versions of javac may break this feature, and we may not be able to restore it.</li> - </ul> - Current status: <em>uncertain</em> - Currently we feel this feature cannot move out of experimental status. - </div> - <div class="overview"> - <h3>Overview</h3> - <p> - <strong>This feature is considered 'workaround status' - it exists in order to allow users of lombok that cannot work without this feature to have access to it anyway. If we find a better way to implement this feature, or some future java version introduces an alternative strategy, this feature can disappear without a reasonable deprecation period. Also, this feature may not work in future versions of javac. Use at your own discretion.</strong> - </p><p> - Most annotations that make lombok generate methods or constructors can be configured to also make lombok put custom annotations on elements in the generated code. - </p><p> - <code>@Getter</code>, <code>@Setter</code>, and <code>@Wither</code> support the <code>onMethod</code> option, which will put the listed annotations on the generated method. - </p><p> - <code>@AllArgsConstructor</code>, <code>@NoArgsConstructor</code>, and <code>@RequiredArgsConstructor</code> support the <code>onConstructor</code> option which will put the listed annotations on the generated constructor. - </p><p> - <code>@Setter</code> and <code>@Wither</code> support <code>onParam</code> in addition to <code>onMethod</code>; annotations listed will be put on the only parameter that the generated method has. <code>@EqualsAndHashCode</code> also supports <code>onParam</code>; the listed annotation(s) will be placed on the single parameter of the generated <code>equals</code> method, as well as any generated <code>canEqual</code> method. - </p><p> - The syntax is a little strange; to use any of the 3 <code>onX</code> features, you must wrap the annotations to be applied to the constructor / method / parameter in <code>@__(@AnnotationGoesHere)</code>. To apply multiple annotations, use <code>@__({@Annotation1, @Annotation2})</code>. The annotations can themselves obviously have parameters as well. - </p> - </div> - <div class="snippets"> - <div class="pre"> - <h3>With Lombok</h3> - <div class="snippet">@HTML_PRE@</div> - </div> - <div class="sep"></div> - <div class="post"> - <h3>Vanilla Java</h3> - <div class="snippet">@HTML_POST@</div> - </div> - </div> - <div style="clear: left;"></div> - <div class="overview"> - <h3>Small print</h3><div class="smallprint"> - <p> - The reason of the weird syntax is to make this feature work in javac 7 compilers; the <code>@__</code> type is an annotation reference to the annotation type <code>__</code> (double underscore) which doesn't actually exist; this makes javac 7 delay aborting the compilation process due to an error because it is possible an annotation processor will later create the <code>__</code> type. Instead, lombok applies the annotations and removes the references so that the error will never actually occur. The point is: The <code>__</code> type <em>must not exist</em>, otherwise the feature does not work. In the rare case that the <code>__</code> type does exist (and is imported or in the package), you can simply add more underscores. Technically any non-existent type would work, but to maintain consistency and readability and catch erroneous use, lombok considers it an error if the 'wrapper' annotation is anything but a series of underscores. - </p><p> - To reiterate: This feature can disappear at any time; if you use this feature, be prepared to adjust your code when we find a nicer way of implementing this feature, or, if a future version of javac forces us to remove this feature entirely with no alternative. - </p><p> - The <code>onX</code> parameter is not legal on any type-wide variant. For example, a <code>@Getter</code> annotation on a class does not support <code>onMethod</code>. - </p> - </div> - </div> - <div class="footer"> - <a href="index.html">Back to experimental features</a> | <a href="Wither.html">Previous feature (@Wither)</a> | <span class="disabled">Next feature</span><br /> - <a href="../../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 2009-2014 The Project Lombok Authors, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span> - </div> - <div style="clear: both;"></div> - </div> -</div> -<script type="text/javascript"> - var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); - document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); -</script> -<script type="text/javascript"> - try { - var pageTracker = _gat._getTracker("UA-9884254-1"); - pageTracker._trackPageview(); - } catch(err) {} -</script> -</body></html> |