Repository: curator Updated Branches: refs/heads/CURATOR-397 6e21af2c5 -> c3db1810a
Abstraction for creating ZPaths with strongly typed parameters Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/c3db1810 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/c3db1810 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/c3db1810 Branch: refs/heads/CURATOR-397 Commit: c3db1810a10e442626ee0c2f759a3f61da19375a Parents: 6e21af2 Author: randgalt <randg...@apache.org> Authored: Tue May 2 00:12:02 2017 -0500 Committer: randgalt <randg...@apache.org> Committed: Tue May 2 00:12:02 2017 -0500 ---------------------------------------------------------------------- .../x/async/modeled/CuratorModelSpec.java | 32 +-------- .../apache/curator/x/async/modeled/ZPath.java | 33 ++++++++- .../modeled/details/CuratorModelSpecImpl.java | 17 +---- .../x/async/modeled/details/ZPathImpl.java | 12 +++- .../x/async/modeled/typed/TypedZPath.java | 70 ++++++++++++++++++++ .../x/async/modeled/typed/TypedZPath10.java | 51 ++++++++++++++ .../x/async/modeled/typed/TypedZPath2.java | 51 ++++++++++++++ .../x/async/modeled/typed/TypedZPath3.java | 51 ++++++++++++++ .../x/async/modeled/typed/TypedZPath4.java | 51 ++++++++++++++ .../x/async/modeled/typed/TypedZPath5.java | 51 ++++++++++++++ .../x/async/modeled/typed/TypedZPath6.java | 51 ++++++++++++++ .../x/async/modeled/typed/TypedZPath7.java | 51 ++++++++++++++ .../x/async/modeled/typed/TypedZPath8.java | 51 ++++++++++++++ .../x/async/modeled/typed/TypedZPath9.java | 51 ++++++++++++++ 14 files changed, 575 insertions(+), 48 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/c3db1810/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/CuratorModelSpec.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/CuratorModelSpec.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/CuratorModelSpec.java index f8dc972..ee1865b 100644 --- a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/CuratorModelSpec.java +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/CuratorModelSpec.java @@ -26,7 +26,6 @@ import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.data.ACL; import java.util.List; import java.util.Set; -import java.util.function.Supplier; public interface CuratorModelSpec<T> { @@ -60,37 +59,12 @@ public interface CuratorModelSpec<T> CuratorModelSpec<T> at(String child); /** - * Return a new CuratorModel instance with all the same options but applying to the given parameters of this CuratorModel's - * path via {@link org.apache.curator.x.async.modeled.ZPath#resolved(Object...)} + * Return a new CuratorModel instance with all the same options but using the given path. * - * @param parameters list of replacements. Must have be the same length as the number of - * parameter nodes in the path + * @param path new path * @return new Modeled Curator instance */ - CuratorModelSpec<T> resolved(Object... parameters); - - /** - * Return a new CuratorModel instance with all the same options but applying to the given parameters of this CuratorModel's - * path via {@link org.apache.curator.x.async.modeled.ZPath#resolved(Object...)} - * - * @param parameters list of replacements. Must have be the same length as the number of - * parameter nodes in the path - * @return new Modeled Curator instance - */ - CuratorModelSpec<T> resolved(List<Object> parameters); - - /** - * An "auto" resolving version of this CuratorModel. i.e. if any of the path names is - * the {@link org.apache.curator.x.async.modeled.ZPath#parameterNodeName()} the ZPath must be resolved. This method - * creates a new CuratorModelSpec that auto resolves by using the given parameter suppliers - * whenever needed. - * - * @param parameterSuppliers parameter suppliers - * @return new auto resolving ZNode - * @see #resolved(Object...) - * @see org.apache.curator.x.async.modeled.ZPath#parameterNodeName() - */ - CuratorModelSpec<T> resolving(List<Supplier<Object>> parameterSuppliers); + CuratorModelSpec<T> at(ZPath path); /** * Return the model's path http://git-wip-us.apache.org/repos/asf/curator/blob/c3db1810/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/ZPath.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/ZPath.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/ZPath.java index 1b10a40..bb251b1 100644 --- a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/ZPath.java +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/ZPath.java @@ -22,6 +22,7 @@ import org.apache.curator.x.async.modeled.details.ZPathImpl; import java.util.Arrays; import java.util.List; import java.util.function.Supplier; +import java.util.function.UnaryOperator; import java.util.regex.Pattern; /** @@ -48,7 +49,35 @@ public interface ZPath */ static ZPath parse(String fullPath) { - return ZPathImpl.parse(fullPath); + return ZPathImpl.parse(fullPath, s -> s); + } + + /** + * Take a ZNode string path and return a ZPath. Each part of the path + * that is <code>{id}</code> is replaced with {@link #parameterNodeName()}. + * E.g. <code>parseWithIds("/one/two/{id}/three/{id}")</code> is the equivalent + * of calling <code>ZPath.from("one", "two", parameterNodeName(), "three", parameterNodeName())</code> + * + * @param fullPath the path to parse + * @return ZPath + * @throws IllegalArgumentException if the path is invalid + */ + static ZPath parseWithIds(String fullPath) + { + return ZPathImpl.parse(fullPath, s -> s.equals("{id}") ? parameterNodeName() : s); + } + + /** + * Take a ZNode string path and return a ZPath + * + * @param fullPath the path to parse + * @param nameFilter each part of the path is passed through this filter + * @return ZPath + * @throws IllegalArgumentException if the path is invalid + */ + static ZPath parse(String fullPath, UnaryOperator<String> nameFilter) + { + return ZPathImpl.parse(fullPath, nameFilter); } /** @@ -106,7 +135,7 @@ public interface ZPath /** * Return the special node name that can be used for replacements at runtime - * via {@link #resolved(Object...)} + * via {@link #resolved(Object...)} when passed via the various <code>from()</code> methods * * @return name */ http://git-wip-us.apache.org/repos/asf/curator/blob/c3db1810/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/CuratorModelSpecImpl.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/CuratorModelSpecImpl.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/CuratorModelSpecImpl.java index 520d78d..1469222 100644 --- a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/CuratorModelSpecImpl.java +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/CuratorModelSpecImpl.java @@ -33,7 +33,6 @@ import org.apache.zookeeper.data.ACL; import java.util.List; import java.util.Objects; import java.util.Set; -import java.util.function.Supplier; public class CuratorModelSpecImpl<T> implements CuratorModelSpec<T>, SchemaValidator { @@ -69,21 +68,9 @@ public class CuratorModelSpecImpl<T> implements CuratorModelSpec<T>, SchemaValid } @Override - public CuratorModelSpec<T> resolved(Object... parameters) + public CuratorModelSpec<T> at(ZPath newPath) { - return new CuratorModelSpecImpl<>(path.resolved(parameters), serializer, createMode, aclList, createOptions, deleteOptions); - } - - @Override - public CuratorModelSpec<T> resolved(List<Object> parameters) - { - return new CuratorModelSpecImpl<>(path.resolved(parameters), serializer, createMode, aclList, createOptions, deleteOptions); - } - - @Override - public CuratorModelSpec<T> resolving(List<Supplier<Object>> parameterSuppliers) - { - return new CuratorModelSpecImpl<>(path.resolving(parameterSuppliers), serializer, createMode, aclList, createOptions, deleteOptions); + return new CuratorModelSpecImpl<>(newPath, serializer, createMode, aclList, createOptions, deleteOptions); } @Override http://git-wip-us.apache.org/repos/asf/curator/blob/c3db1810/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/ZPathImpl.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/ZPathImpl.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/ZPathImpl.java index 36c9d1a..f6c941a 100644 --- a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/ZPathImpl.java +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/ZPathImpl.java @@ -31,6 +31,7 @@ import java.util.List; import java.util.NoSuchElementException; import java.util.Objects; import java.util.function.Supplier; +import java.util.function.UnaryOperator; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -44,11 +45,18 @@ public class ZPathImpl implements ZPath private final boolean isResolved; private final List<Supplier<Object>> parameterSuppliers; - public static ZPath parse(String fullPath) + public static ZPath parse(String fullPath, UnaryOperator<String> nameFilter) { List<String> nodes = ImmutableList.<String>builder() .add(ZKPaths.PATH_SEPARATOR) - .addAll(Splitter.on(ZKPaths.PATH_SEPARATOR).omitEmptyStrings().splitToList(fullPath)) + .addAll( + Splitter.on(ZKPaths.PATH_SEPARATOR) + .omitEmptyStrings() + .splitToList(fullPath) + .stream() + .map(nameFilter) + .collect(Collectors.toList()) + ) .build(); nodes.forEach(ZPathImpl::validate); return new ZPathImpl(nodes, null, null); http://git-wip-us.apache.org/repos/asf/curator/blob/c3db1810/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath.java new file mode 100644 index 0000000..6897980 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath.java @@ -0,0 +1,70 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.curator.x.async.modeled.typed; + +import org.apache.curator.x.async.modeled.ZPath; + +/** + * <p> + * Abstraction that allows the construction of ZPaths using strongly type parameter replacements. + * For example, given a path such as "/root/registry/people/{id}" where "id" should be <code>PersonId</code>. + * </p> + * + * <p> + * <pre><code> + * TypedZPath<PersonId> typedPath = TypedZPath.from("/root/registry/people/{id}"); + * + * ... + * + * ZPath path = typedPath.resolved(personId); + * </pre></code> + * </p> + */ +public interface TypedZPath<T> +{ + /** + * Resolve into a ZPath using the given parameter + * + * @param p1 the parameter + * @return ZPath + */ + ZPath resolved(T p1); + + /** + * Return a TypedZPath using {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * + * @param fullPath path to pass to {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * @return TypedZPath + */ + static <T> TypedZPath<T> from(String fullPath) + { + return from(ZPath.parseWithIds(fullPath)); + } + + /** + * Return a TypedZPath + * + * @param path path to use + * @return TypedZPath + */ + static <T> TypedZPath<T> from(ZPath path) + { + return path::resolved; + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/c3db1810/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath10.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath10.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath10.java new file mode 100644 index 0000000..2decc50 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath10.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.curator.x.async.modeled.typed; + +import org.apache.curator.x.async.modeled.ZPath; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedZPath}, but with 10 parameters + */ +public interface TypedZPath10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> +{ + ZPath resolved(T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9, T10 p10); + + /** + * Return a TypedZPath using {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * + * @param fullPath path to pass to {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * @return TypedZPath + */ + static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> TypedZPath10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> from(String fullPath) + { + return from(ZPath.parseWithIds(fullPath)); + } + + /** + * Return a TypedZPath + * + * @param path path to use + * @return TypedZPath + */ + static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> TypedZPath10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> from(ZPath path) + { + return path::resolved; + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/c3db1810/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath2.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath2.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath2.java new file mode 100644 index 0000000..23aad80 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath2.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.curator.x.async.modeled.typed; + +import org.apache.curator.x.async.modeled.ZPath; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedZPath}, but with 2 parameters + */ +public interface TypedZPath2<T1, T2> +{ + ZPath resolved(T1 p1, T2 p2); + + /** + * Return a TypedZPath using {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * + * @param fullPath path to pass to {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * @return TypedZPath + */ + static <T1, T2> TypedZPath2<T1, T2> from(String fullPath) + { + return from(ZPath.parseWithIds(fullPath)); + } + + /** + * Return a TypedZPath + * + * @param path path to use + * @return TypedZPath + */ + static <T1, T2> TypedZPath2<T1, T2> from(ZPath path) + { + return path::resolved; + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/c3db1810/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath3.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath3.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath3.java new file mode 100644 index 0000000..a3fd53c --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath3.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.curator.x.async.modeled.typed; + +import org.apache.curator.x.async.modeled.ZPath; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedZPath}, but with 3 parameters + */ +public interface TypedZPath3<T1, T2, T3> +{ + ZPath resolved(T1 p1, T2 p2, T3 p3); + + /** + * Return a TypedZPath using {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * + * @param fullPath path to pass to {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * @return TypedZPath + */ + static <T1, T2, T3> TypedZPath3<T1, T2, T3> from(String fullPath) + { + return from(ZPath.parseWithIds(fullPath)); + } + + /** + * Return a TypedZPath + * + * @param path path to use + * @return TypedZPath + */ + static <T1, T2, T3> TypedZPath3<T1, T2, T3> from(ZPath path) + { + return path::resolved; + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/c3db1810/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath4.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath4.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath4.java new file mode 100644 index 0000000..11ac783 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath4.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.curator.x.async.modeled.typed; + +import org.apache.curator.x.async.modeled.ZPath; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedZPath}, but with 4 parameters + */ +public interface TypedZPath4<T1, T2, T3, T4> +{ + ZPath resolved(T1 p1, T2 p2, T3 p3, T4 p4); + + /** + * Return a TypedZPath using {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * + * @param fullPath path to pass to {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * @return TypedZPath + */ + static <T1, T2, T3, T4> TypedZPath4<T1, T2, T3, T4> from(String fullPath) + { + return from(ZPath.parseWithIds(fullPath)); + } + + /** + * Return a TypedZPath + * + * @param path path to use + * @return TypedZPath + */ + static <T1, T2, T3, T4> TypedZPath4<T1, T2, T3, T4> from(ZPath path) + { + return path::resolved; + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/c3db1810/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath5.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath5.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath5.java new file mode 100644 index 0000000..e238528 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath5.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.curator.x.async.modeled.typed; + +import org.apache.curator.x.async.modeled.ZPath; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedZPath}, but with 5 parameters + */ +public interface TypedZPath5<T1, T2, T3, T4, T5> +{ + ZPath resolved(T1 p1, T2 p2, T3 p3, T4 p4, T5 p5); + + /** + * Return a TypedZPath using {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * + * @param fullPath path to pass to {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * @return TypedZPath + */ + static <T1, T2, T3, T4, T5> TypedZPath5<T1, T2, T3, T4, T5> from(String fullPath) + { + return from(ZPath.parseWithIds(fullPath)); + } + + /** + * Return a TypedZPath + * + * @param path path to use + * @return TypedZPath + */ + static <T1, T2, T3, T4, T5> TypedZPath5<T1, T2, T3, T4, T5> from(ZPath path) + { + return path::resolved; + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/c3db1810/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath6.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath6.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath6.java new file mode 100644 index 0000000..956c544 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath6.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.curator.x.async.modeled.typed; + +import org.apache.curator.x.async.modeled.ZPath; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedZPath}, but with 6 parameters + */ +public interface TypedZPath6<T1, T2, T3, T4, T5, T6> +{ + ZPath resolved(T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6); + + /** + * Return a TypedZPath using {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * + * @param fullPath path to pass to {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * @return TypedZPath + */ + static <T1, T2, T3, T4, T5, T6> TypedZPath6<T1, T2, T3, T4, T5, T6> from(String fullPath) + { + return from(ZPath.parseWithIds(fullPath)); + } + + /** + * Return a TypedZPath + * + * @param path path to use + * @return TypedZPath + */ + static <T1, T2, T3, T4, T5, T6> TypedZPath6<T1, T2, T3, T4, T5, T6> from(ZPath path) + { + return path::resolved; + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/c3db1810/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath7.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath7.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath7.java new file mode 100644 index 0000000..9d9acf1 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath7.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.curator.x.async.modeled.typed; + +import org.apache.curator.x.async.modeled.ZPath; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedZPath}, but with 7 parameters + */ +public interface TypedZPath7<T1, T2, T3, T4, T5, T6, T7> +{ + ZPath resolved(T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7); + + /** + * Return a TypedZPath using {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * + * @param fullPath path to pass to {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * @return TypedZPath + */ + static <T1, T2, T3, T4, T5, T6, T7> TypedZPath7<T1, T2, T3, T4, T5, T6, T7> from(String fullPath) + { + return from(ZPath.parseWithIds(fullPath)); + } + + /** + * Return a TypedZPath + * + * @param path path to use + * @return TypedZPath + */ + static <T1, T2, T3, T4, T5, T6, T7> TypedZPath7<T1, T2, T3, T4, T5, T6, T7> from(ZPath path) + { + return path::resolved; + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/c3db1810/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath8.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath8.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath8.java new file mode 100644 index 0000000..f6f2a18 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath8.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.curator.x.async.modeled.typed; + +import org.apache.curator.x.async.modeled.ZPath; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedZPath}, but with 8 parameters + */ +public interface TypedZPath8<T1, T2, T3, T4, T5, T6, T7, T8> +{ + ZPath resolved(T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8); + + /** + * Return a TypedZPath using {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * + * @param fullPath path to pass to {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * @return TypedZPath + */ + static <T1, T2, T3, T4, T5, T6, T7, T8> TypedZPath8<T1, T2, T3, T4, T5, T6, T7, T8> from(String fullPath) + { + return from(ZPath.parseWithIds(fullPath)); + } + + /** + * Return a TypedZPath + * + * @param path path to use + * @return TypedZPath + */ + static <T1, T2, T3, T4, T5, T6, T7, T8> TypedZPath8<T1, T2, T3, T4, T5, T6, T7, T8> from(ZPath path) + { + return path::resolved; + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/c3db1810/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath9.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath9.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath9.java new file mode 100644 index 0000000..986401a --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath9.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.curator.x.async.modeled.typed; + +import org.apache.curator.x.async.modeled.ZPath; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedZPath}, but with 9 parameters + */ +public interface TypedZPath9<T1, T2, T3, T4, T5, T6, T7, T8, T9> +{ + ZPath resolved(T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9); + + /** + * Return a TypedZPath using {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * + * @param fullPath path to pass to {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * @return TypedZPath + */ + static <T1, T2, T3, T4, T5, T6, T7, T8, T9> TypedZPath9<T1, T2, T3, T4, T5, T6, T7, T8, T9> from(String fullPath) + { + return from(ZPath.parseWithIds(fullPath)); + } + + /** + * Return a TypedZPath + * + * @param path path to use + * @return TypedZPath + */ + static <T1, T2, T3, T4, T5, T6, T7, T8, T9> TypedZPath9<T1, T2, T3, T4, T5, T6, T7, T8, T9> from(ZPath path) + { + return path::resolved; + } +}