Fix MatchBuilderPath documentation 16/93316/5
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 23 Oct 2020 21:58:58 +0000 (23:58 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 24 Oct 2020 14:23:43 +0000 (16:23 +0200)
We have a sentence trailing off, fix it up. Since we are introducing
a new pointer, update LambdaDecoder documentation. QueryExpression
gets a free pass on whitespace.

Change-Id: Ib5f66a80b99f5be18b5b9f41be4fd850435465f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/query/MatchBuilderPath.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/query/QueryExpression.java
binding/mdsal-binding-dom-adapter/src/main/java/org/opendaylight/mdsal/binding/dom/adapter/query/LambdaDecoder.java

index 66c2f5ac664dea1b5d7a8fe600cdc7d07dd6d78d..e753d58bc98d16aca3cf6de1aee2c6c5b1dcaf10 100644 (file)
@@ -169,12 +169,14 @@ public interface MatchBuilderPath<O extends DataObject, T extends DataObject> ex
     @FunctionalInterface
     public interface LeafReference<P, C> extends Serializable {
         /**
-         * Dummy method to express the method signature of a typical getter. This method
+         * Dummy method to express the method signature of a typical getter. Due to this match we can match any Java
+         * method reference which takes in {@code parent} and results in {@code child} -- expose the feature of using
+         * {@code Parent::getChild} method shorthand.
          *
          * @param parent Parent object
          * @return Leaf value
          * @deprecated This method is present only for technical realization of taking the method reference and should
-         *             never be involved directly.
+         *             never be involved directly. See {@code LambdaDecoder} for gory details.
          */
         @Deprecated(forRemoval = true)
         C dummyMethod(P parent);
index a9c68349f38acb216ead152c405c7e8a2ea2e3b7..84aec89827244908da460dcbfb7be0af7676ac28 100644 (file)
@@ -80,8 +80,6 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
  * The distinction here is made by selecting different root paths: the first will specify the entire {@code foo} list,
  * while the second will select a specific {@code foo} entry.
  *
- *
- *
  * @param <T> Result object type
  */
 @Beta
index 55edf22515ffd1d9d52d89ffff5e48d62570a6fe..d5d5cd43da5fca058f69de07d9f2db4e246db399 100644 (file)
@@ -14,11 +14,13 @@ import com.google.common.base.MoreObjects;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
+import java.io.Serializable;
 import java.lang.invoke.SerializedLambda;
 import java.lang.reflect.Method;
 import java.security.AccessController;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
+import java.util.function.Function;
 import org.opendaylight.mdsal.binding.api.query.MatchBuilderPath.LeafReference;
 import org.opendaylight.yangtools.concepts.Immutable;
 
@@ -28,8 +30,8 @@ import org.opendaylight.yangtools.concepts.Immutable;
  * to {@link LeafReference} lambdas.
  *
  * <p>
- * We then assume runtime is following guidance around {@link SerializedLambda}, thus Serializable lambdas have a
- * {@code writeReplace()} method and that it produces {@link SerializedLambda} -- which we use to get the information
+ * We then assume runtime is following guidance around {@link SerializedLambda}, thus {@link Serializable} lambdas have
+ * a {@code writeReplace()} method and it produces a {@link SerializedLambda} -- which we use to get the information
  * about what the lambda does at least in the single case we support.
  *
  * <p>
@@ -43,8 +45,11 @@ import org.opendaylight.yangtools.concepts.Immutable;
  *   <li>it creates additional implementation of the interface, bringing the system-wide total to 3, which can hurt
  *       JIT's decisions</li>
  * </ul>
+ * While that approach would certainly be feasible and would on top of plain {@link Function}, overall it would be
+ * messier, less type-safe and a perf-killer.
  */
 final class LambdaDecoder {
+    // FIXME: when we have JDK16: this should be a record
     static final class LambdaTarget implements Immutable {
         final String targetClass;
         final String targetMethod;