http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec3.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec3.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec3.java new file mode 100644 index 0000000..f4e808c --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec3.java @@ -0,0 +1,61 @@ +/** + * 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.ModelSpec; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedModelSpec}, but with 3 parameters + */ +@FunctionalInterface +public interface TypedModelSpec3<M, P1, P2, P3> +{ + ModelSpec<M> resolved(P1 p1, P2 p2, P3 p3); + + /** + * Return a new TypedModelSpec using the given model spec builder and typed path. When + * {@link #resolved(Object, Object, Object)} is called the actual model spec is generated with the + * resolved path + * + * @param builder model spec builder + * @param path typed path + * @return new TypedModelSpec + */ + static <M, P1, P2, P3> TypedModelSpec3<M, P1, P2, P3> from(ModelSpecBuilder<M> builder, TypedZPath3<P1, P2, P3> path) + { + return (p1, p2, p3) -> builder.withPath(path.resolved(p1, p2, p3)).build(); + } + + /** + * Return a new TypedModelSpec using the given model spec builder and path. A TypedZPath + * is created from the given full path and When + * {@link #resolved(Object, Object, Object)} is called the actual model spec is generated with the + * resolved path + * + * @param builder model spec builder + * @param pathWithIds typed path + * @return new TypedModelSpec + */ + static <M, P1, P2, P3> TypedModelSpec3<M, P1, P2, P3> from(ModelSpecBuilder<M> builder, String pathWithIds) + { + TypedZPath3<P1, P2, P3> zPath = TypedZPath3.from(pathWithIds); + return (p1, p2, p3) -> builder.withPath(zPath.resolved(p1, p2, p3)).build(); + } +}
http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec4.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec4.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec4.java new file mode 100644 index 0000000..040f8a6 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec4.java @@ -0,0 +1,61 @@ +/** + * 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.ModelSpec; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedModelSpec}, but with 4 parameters + */ +@FunctionalInterface +public interface TypedModelSpec4<M, P1, P2, P3, P4> +{ + ModelSpec<M> resolved(P1 p1, P2 p2, P3 p3, P4 p4); + + /** + * Return a new TypedModelSpec using the given model spec builder and typed path. When + * {@link #resolved(Object, Object, Object, Object)} is called the actual model spec is generated with the + * resolved path + * + * @param builder model spec builder + * @param path typed path + * @return new TypedModelSpec + */ + static <M, P1, P2, P3, P4> TypedModelSpec4<M, P1, P2, P3, P4> from(ModelSpecBuilder<M> builder, TypedZPath4<P1, P2, P3, P4> path) + { + return (p1, p2, p3, p4) -> builder.withPath(path.resolved(p1, p2, p3, p4)).build(); + } + + /** + * Return a new TypedModelSpec using the given model spec builder and path. A TypedZPath + * is created from the given full path and When + * {@link #resolved(Object, Object, Object, Object)} is called the actual model spec is generated with the + * resolved path + * + * @param builder model spec builder + * @param pathWithIds typed path + * @return new TypedModelSpec + */ + static <M, P1, P2, P3, P4> TypedModelSpec4<M, P1, P2, P3, P4> from(ModelSpecBuilder<M> builder, String pathWithIds) + { + TypedZPath4<P1, P2, P3, P4> zPath = TypedZPath4.from(pathWithIds); + return (p1, p2, p3, p4) -> builder.withPath(zPath.resolved(p1, p2, p3, p4)).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec5.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec5.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec5.java new file mode 100644 index 0000000..b67f5b0 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec5.java @@ -0,0 +1,61 @@ +/** + * 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.ModelSpec; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedModelSpec}, but with 5 parameters + */ +@FunctionalInterface +public interface TypedModelSpec5<M, P1, P2, P3, P4, P5> +{ + ModelSpec<M> resolved(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5); + + /** + * Return a new TypedModelSpec using the given model spec builder and typed path. When + * {@link #resolved(Object, Object, Object, Object, Object)} is called the actual model spec is generated with the + * resolved path + * + * @param builder model spec builder + * @param path typed path + * @return new TypedModelSpec + */ + static <M, P1, P2, P3, P4, P5> TypedModelSpec5<M, P1, P2, P3, P4, P5> from(ModelSpecBuilder<M> builder, TypedZPath5<P1, P2, P3, P4, P5> path) + { + return (p1, p2, p3, p4, p5) -> builder.withPath(path.resolved(p1, p2, p3, p4, p5)).build(); + } + + /** + * Return a new TypedModelSpec using the given model spec builder and path. A TypedZPath + * is created from the given full path and When + * {@link #resolved(Object, Object, Object, Object, Object)} is called the actual model spec is generated with the + * resolved path + * + * @param builder model spec builder + * @param pathWithIds typed path + * @return new TypedModelSpec + */ + static <M, P1, P2, P3, P4, P5> TypedModelSpec5<M, P1, P2, P3, P4, P5> from(ModelSpecBuilder<M> builder, String pathWithIds) + { + TypedZPath5<P1, P2, P3, P4, P5> zPath = TypedZPath5.from(pathWithIds); + return (p1, p2, p3, p4, p5) -> builder.withPath(zPath.resolved(p1, p2, p3, p4, p5)).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec6.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec6.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec6.java new file mode 100644 index 0000000..675029a --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec6.java @@ -0,0 +1,61 @@ +/** + * 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.ModelSpec; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedModelSpec}, but with 6 parameters + */ +@FunctionalInterface +public interface TypedModelSpec6<M, P1, P2, P3, P4, P5, P6> +{ + ModelSpec<M> resolved(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6); + + /** + * Return a new TypedModelSpec using the given model spec builder and typed path. When + * {@link #resolved(Object, Object, Object, Object, Object, Object)} is called the actual model spec is generated with the + * resolved path + * + * @param builder model spec builder + * @param path typed path + * @return new TypedModelSpec + */ + static <M, P1, P2, P3, P4, P5, P6> TypedModelSpec6<M, P1, P2, P3, P4, P5, P6> from(ModelSpecBuilder<M> builder, TypedZPath6<P1, P2, P3, P4, P5, P6> path) + { + return (p1, p2, p3, p4, p5, p6) -> builder.withPath(path.resolved(p1, p2, p3, p4, p5, p6)).build(); + } + + /** + * Return a new TypedModelSpec using the given model spec builder and path. A TypedZPath + * is created from the given full path and When + * {@link #resolved(Object, Object, Object, Object, Object, Object)} is called the actual model spec is generated with the + * resolved path + * + * @param builder model spec builder + * @param pathWithIds typed path + * @return new TypedModelSpec + */ + static <M, P1, P2, P3, P4, P5, P6> TypedModelSpec6<M, P1, P2, P3, P4, P5, P6> from(ModelSpecBuilder<M> builder, String pathWithIds) + { + TypedZPath6<P1, P2, P3, P4, P5, P6> zPath = TypedZPath6.from(pathWithIds); + return (p1, p2, p3, p4, p5, p6) -> builder.withPath(zPath.resolved(p1, p2, p3, p4, p5, p6)).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec7.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec7.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec7.java new file mode 100644 index 0000000..8ffd3c0 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec7.java @@ -0,0 +1,61 @@ +/** + * 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.ModelSpec; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedModelSpec}, but with 7 parameters + */ +@FunctionalInterface +public interface TypedModelSpec7<M, P1, P2, P3, P4, P5, P6, P7> +{ + ModelSpec<M> resolved(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7); + + /** + * Return a new TypedModelSpec using the given model spec builder and typed path. When + * {@link #resolved(Object, Object, Object, Object, Object, Object, Object)} is called the actual model spec is generated with the + * resolved path + * + * @param builder model spec builder + * @param path typed path + * @return new TypedModelSpec + */ + static <M, P1, P2, P3, P4, P5, P6, P7> TypedModelSpec7<M, P1, P2, P3, P4, P5, P6, P7> from(ModelSpecBuilder<M> builder, TypedZPath7<P1, P2, P3, P4, P5, P6, P7> path) + { + return (p1, p2, p3, p4, p5, p6, p7) -> builder.withPath(path.resolved(p1, p2, p3, p4, p5, p6, p7)).build(); + } + + /** + * Return a new TypedModelSpec using the given model spec builder and path. A TypedZPath + * is created from the given full path and When + * {@link #resolved(Object, Object, Object, Object, Object, Object, Object)} is called the actual model spec is generated with the + * resolved path + * + * @param builder model spec builder + * @param pathWithIds typed path + * @return new TypedModelSpec + */ + static <M, P1, P2, P3, P4, P5, P6, P7> TypedModelSpec7<M, P1, P2, P3, P4, P5, P6, P7> from(ModelSpecBuilder<M> builder, String pathWithIds) + { + TypedZPath7<P1, P2, P3, P4, P5, P6, P7> zPath = TypedZPath7.from(pathWithIds); + return (p1, p2, p3, p4, p5, p6, p7) -> builder.withPath(zPath.resolved(p1, p2, p3, p4, p5, p6, p7)).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec8.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec8.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec8.java new file mode 100644 index 0000000..3a9acd4 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec8.java @@ -0,0 +1,61 @@ +/** + * 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.ModelSpec; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedModelSpec}, but with 8 parameters + */ +@FunctionalInterface +public interface TypedModelSpec8<M, P1, P2, P3, P4, P5, P6, P7, P8> +{ + ModelSpec<M> resolved(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8); + + /** + * Return a new TypedModelSpec using the given model spec builder and typed path. When + * {@link #resolved(Object, Object, Object, Object, Object, Object, Object, Object)} is called the actual model spec is generated with the + * resolved path + * + * @param builder model spec builder + * @param path typed path + * @return new TypedModelSpec + */ + static <M, P1, P2, P3, P4, P5, P6, P7, P8> TypedModelSpec8<M, P1, P2, P3, P4, P5, P6, P7, P8> from(ModelSpecBuilder<M> builder, TypedZPath8<P1, P2, P3, P4, P5, P6, P7, P8> path) + { + return (p1, p2, p3, p4, p5, p6, p7, p8) -> builder.withPath(path.resolved(p1, p2, p3, p4, p5, p6, p7, p8)).build(); + } + + /** + * Return a new TypedModelSpec using the given model spec builder and path. A TypedZPath + * is created from the given full path and When + * {@link #resolved(Object, Object, Object, Object, Object, Object, Object, Object)} is called the actual model spec is generated with the + * resolved path + * + * @param builder model spec builder + * @param pathWithIds typed path + * @return new TypedModelSpec + */ + static <M, P1, P2, P3, P4, P5, P6, P7, P8> TypedModelSpec8<M, P1, P2, P3, P4, P5, P6, P7, P8> from(ModelSpecBuilder<M> builder, String pathWithIds) + { + TypedZPath8<P1, P2, P3, P4, P5, P6, P7, P8> zPath = TypedZPath8.from(pathWithIds); + return (p1, p2, p3, p4, p5, p6, p7, p8) -> builder.withPath(zPath.resolved(p1, p2, p3, p4, p5, p6, p7, p8)).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec9.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec9.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec9.java new file mode 100644 index 0000000..94ff8d7 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModelSpec9.java @@ -0,0 +1,61 @@ +/** + * 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.ModelSpec; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedModelSpec}, but with 9 parameters + */ +@FunctionalInterface +public interface TypedModelSpec9<M, P1, P2, P3, P4, P5, P6, P7, P8, P9> +{ + ModelSpec<M> resolved(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9); + + /** + * Return a new TypedModelSpec using the given model spec builder and typed path. When + * {@link #resolved(Object, Object, Object, Object, Object, Object, Object, Object, Object)} is called the actual model spec is generated with the + * resolved path + * + * @param builder model spec builder + * @param path typed path + * @return new TypedModelSpec + */ + static <M, P1, P2, P3, P4, P5, P6, P7, P8, P9> TypedModelSpec9<M, P1, P2, P3, P4, P5, P6, P7, P8, P9> from(ModelSpecBuilder<M> builder, TypedZPath9<P1, P2, P3, P4, P5, P6, P7, P8, P9> path) + { + return (p1, p2, p3, p4, p5, p6, p7, p8, p9) -> builder.withPath(path.resolved(p1, p2, p3, p4, p5, p6, p7, p8, p9)).build(); + } + + /** + * Return a new TypedModelSpec using the given model spec builder and path. A TypedZPath + * is created from the given full path and When + * {@link #resolved(Object, Object, Object, Object, Object, Object, Object, Object, Object)} is called the actual model spec is generated with the + * resolved path + * + * @param builder model spec builder + * @param pathWithIds typed path + * @return new TypedModelSpec + */ + static <M, P1, P2, P3, P4, P5, P6, P7, P8, P9> TypedModelSpec9<M, P1, P2, P3, P4, P5, P6, P7, P8, P9> from(ModelSpecBuilder<M> builder, String pathWithIds) + { + TypedZPath9<P1, P2, P3, P4, P5, P6, P7, P8, P9> zPath = TypedZPath9.from(pathWithIds); + return (p1, p2, p3, p4, p5, p6, p7, p8, p9) -> builder.withPath(zPath.resolved(p1, p2, p3, p4, p5, p6, p7, p8, p9)).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework.java new file mode 100644 index 0000000..56a8ebc --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework.java @@ -0,0 +1,93 @@ +/** + * 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.AsyncCuratorFramework; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; +import org.apache.curator.x.async.modeled.ModeledFramework; +import org.apache.curator.x.async.modeled.ModeledFrameworkBuilder; + +/** + * <p> + * Abstraction that allows the construction of ModeledFrameworks using strongly typed parameter replacements. + * For example, given a ModeledFramework with a ModelSpec that has a path such as + * "/root/registry/people/{id}" where "id" should be <code>PersonId</code>. + * </p> + * + * <p> + * <pre><code> + * // Step 1. Create a typed ZPath + * TypedZPath<PersonId> typedPath = TypedZPath.from("/root/registry/people/{id}"); + * + * // Step 2. Create a typed ModelSpec (see TypedModelSpec for details) + * TypedModelSpec<Person, PersonId> typedModelSpec = TypedModelSpec.from(builder, path); + * + * // Step 3. Create a ModeledFramework builder (do not build at this point) + * ModeledFrameworkBuilder<Person> builder = ModeledFramework.builder()... // add any other needed options + * + * // Step 4. Create a typed TypedModeledFramework using the typed ZPath, typed ModelSpec, and ModeledFramework builder + * TypedModeledFramework<Person, PersonId> clientSpec = TypedModeledFramework.from(builder, modelSpec); + * + * // later on the TypedModelSpec can be resolved into a useable ModeledFramework + * ModeledFramework<Person> client = clientSpec.resolve(personId); + * </pre></code> + * </p> + */ +@FunctionalInterface +public interface TypedModeledFramework<M, P1> +{ + /** + * Resolve into a ModeledFramework using the given parameter + * + * @param client the curator instance to use + * @param p1 the parameter + * @return ZPath + */ + ModeledFramework<M> resolved(AsyncCuratorFramework client, P1 p1); + + /** + * Return a new TypedModeledFramework using the given modeled framework builder and typed model spec. + * When {@link #resolved(AsyncCuratorFramework, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpec TypedModelSpec + * @return new TypedModeledFramework + */ + static <M, P1> TypedModeledFramework<M, P1> from(ModeledFrameworkBuilder<M> frameworkBuilder, TypedModelSpec<M, P1> modelSpec) + { + return (client, p1) -> frameworkBuilder.withClient(client).withModelSpec(modelSpec.resolved(p1)).build(); + } + + /** + * Return a new TypedModeledFramework using the given modeled framework builder, model spec builder and a path with ids. + * When {@link #resolved(AsyncCuratorFramework, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec and resolved path + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpecBuilder model spec builder + * @param pathWithIds path with {XXXX} parameters + * @return new TypedModeledFramework + */ + static <M, P1> TypedModeledFramework<M, P1> from(ModeledFrameworkBuilder<M> frameworkBuilder, ModelSpecBuilder<M> modelSpecBuilder, String pathWithIds) + { + TypedModelSpec<M, P1> typedModelSpec = TypedModelSpec.from(modelSpecBuilder, pathWithIds); + return (client, p1) -> frameworkBuilder.withClient(client).withModelSpec(typedModelSpec.resolved(p1)).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework0.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework0.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework0.java new file mode 100644 index 0000000..8c9de04 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework0.java @@ -0,0 +1,63 @@ +/** + * 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.AsyncCuratorFramework; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; +import org.apache.curator.x.async.modeled.ModeledFramework; +import org.apache.curator.x.async.modeled.ModeledFrameworkBuilder; + +/** + * Same as {@link TypedModeledFramework}, but with 0 parameters + */ +@FunctionalInterface +public interface TypedModeledFramework0<M> +{ + ModeledFramework<M> resolved(AsyncCuratorFramework client); + + /** + * Return a new TypedModeledFramework using the given modeled framework builder and typed model spec. + * When {@link #resolved(org.apache.curator.x.async.AsyncCuratorFramework)} is called the actual ModeledFramework is generated with the + * resolved model spec + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpec TypedModelSpec + * @return new TypedModeledFramework + */ + static <M> TypedModeledFramework0<M> from(ModeledFrameworkBuilder<M> frameworkBuilder, TypedModelSpec0<M> modelSpec) + { + return (client) -> frameworkBuilder.withClient(client).withModelSpec(modelSpec.resolved()).build(); + } + + /** + * Return a new TypedModeledFramework using the given modeled framework builder, model spec builder and a path with ids. + * When {@link #resolved(org.apache.curator.x.async.AsyncCuratorFramework)} is called the actual ModeledFramework is generated with the + * resolved model spec and resolved path + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpecBuilder model spec builder + * @param pathWithIds path with {XXXX} parameters + * @return new TypedModeledFramework + */ + static <M> TypedModeledFramework0<M> from(ModeledFrameworkBuilder<M> frameworkBuilder, ModelSpecBuilder<M> modelSpecBuilder, String pathWithIds) + { + TypedModelSpec0<M> typedModelSpec = TypedModelSpec0.from(modelSpecBuilder, pathWithIds); + return (client) -> frameworkBuilder.withClient(client).withModelSpec(typedModelSpec.resolved()).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework10.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework10.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework10.java new file mode 100644 index 0000000..24a4671 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework10.java @@ -0,0 +1,63 @@ +/** + * 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.AsyncCuratorFramework; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; +import org.apache.curator.x.async.modeled.ModeledFramework; +import org.apache.curator.x.async.modeled.ModeledFrameworkBuilder; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedModeledFramework}, but with 10 parameters + */ +@FunctionalInterface +public interface TypedModeledFramework10<M, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10> +{ + ModeledFramework<M> resolved(AsyncCuratorFramework client, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10); + + /** + * Return a new TypedModeledFramework using the given modeled framework builder and typed model spec. + * When {@link #resolved(AsyncCuratorFramework, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpec TypedModelSpec + * @return new TypedModeledFramework + */ + static <M, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10> TypedModeledFramework10<M, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10> from(ModeledFrameworkBuilder<M> frameworkBuilder, TypedModelSpec10<M, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10> modelSpec) + { + return (client, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) -> frameworkBuilder.withClient(client).withModelSpec(modelSpec.resolved(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)).build(); + } + + /** + * Return a new TypedModeledFramework using the given modeled framework builder, model spec builder and a path with ids. + * When {@link #resolved(AsyncCuratorFramework, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec and resolved path + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpecBuilder model spec builder + * @param pathWithIds path with {XXXX} parameters + * @return new TypedModeledFramework + */ + static <M, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10> TypedModeledFramework10<M, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10> from(ModeledFrameworkBuilder<M> frameworkBuilder, ModelSpecBuilder<M> modelSpecBuilder, String pathWithIds) + { + TypedModelSpec10<M, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10> typedModelSpec = TypedModelSpec10.from(modelSpecBuilder, pathWithIds); + return (client, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) -> frameworkBuilder.withClient(client).withModelSpec(typedModelSpec.resolved(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework2.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework2.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework2.java new file mode 100644 index 0000000..9a535e0 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework2.java @@ -0,0 +1,63 @@ +/** + * 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.AsyncCuratorFramework; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; +import org.apache.curator.x.async.modeled.ModeledFramework; +import org.apache.curator.x.async.modeled.ModeledFrameworkBuilder; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedModeledFramework}, but with 2 parameters + */ +@FunctionalInterface +public interface TypedModeledFramework2<M, P1, P2> +{ + ModeledFramework<M> resolved(AsyncCuratorFramework client, P1 p1, P2 p2); + + /** + * Return a new TypedModeledFramework using the given modeled framework builder and typed model spec. + * When {@link #resolved(AsyncCuratorFramework, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpec TypedModelSpec + * @return new TypedModeledFramework + */ + static <M, P1, P2> TypedModeledFramework2<M, P1, P2> from(ModeledFrameworkBuilder<M> frameworkBuilder, TypedModelSpec2<M, P1, P2> modelSpec) + { + return (client, p1, p2) -> frameworkBuilder.withClient(client).withModelSpec(modelSpec.resolved(p1, p2)).build(); + } + + /** + * Return a new TypedModeledFramework using the given modeled framework builder, model spec builder and a path with ids. + * When {@link #resolved(AsyncCuratorFramework, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec and resolved path + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpecBuilder model spec builder + * @param pathWithIds path with {XXXX} parameters + * @return new TypedModeledFramework + */ + static <M, P1, P2> TypedModeledFramework2<M, P1, P2> from(ModeledFrameworkBuilder<M> frameworkBuilder, ModelSpecBuilder<M> modelSpecBuilder, String pathWithIds) + { + TypedModelSpec2<M, P1, P2> typedModelSpec = TypedModelSpec2.from(modelSpecBuilder, pathWithIds); + return (client, p1, p2) -> frameworkBuilder.withClient(client).withModelSpec(typedModelSpec.resolved(p1, p2)).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework3.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework3.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework3.java new file mode 100644 index 0000000..6d6edc3 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework3.java @@ -0,0 +1,63 @@ +/** + * 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.AsyncCuratorFramework; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; +import org.apache.curator.x.async.modeled.ModeledFramework; +import org.apache.curator.x.async.modeled.ModeledFrameworkBuilder; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedModeledFramework}, but with 3 parameters + */ +@FunctionalInterface +public interface TypedModeledFramework3<M, P1, P2, P3> +{ + ModeledFramework<M> resolved(AsyncCuratorFramework client, P1 p1, P2 p2, P3 p3); + + /** + * Return a new TypedModeledFramework using the given modeled framework builder and typed model spec. + * When {@link #resolved(AsyncCuratorFramework, Object, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpec TypedModelSpec + * @return new TypedModeledFramework + */ + static <M, P1, P2, P3> TypedModeledFramework3<M, P1, P2, P3> from(ModeledFrameworkBuilder<M> frameworkBuilder, TypedModelSpec3<M, P1, P2, P3> modelSpec) + { + return (client, p1, p2, p3) -> frameworkBuilder.withClient(client).withModelSpec(modelSpec.resolved(p1, p2, p3)).build(); + } + + /** + * Return a new TypedModeledFramework using the given modeled framework builder, model spec builder and a path with ids. + * When {@link #resolved(AsyncCuratorFramework, Object, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec and resolved path + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpecBuilder model spec builder + * @param pathWithIds path with {XXXX} parameters + * @return new TypedModeledFramework + */ + static <M, P1, P2, P3> TypedModeledFramework3<M, P1, P2, P3> from(ModeledFrameworkBuilder<M> frameworkBuilder, ModelSpecBuilder<M> modelSpecBuilder, String pathWithIds) + { + TypedModelSpec3<M, P1, P2, P3> typedModelSpec = TypedModelSpec3.from(modelSpecBuilder, pathWithIds); + return (client, p1, p2, p3) -> frameworkBuilder.withClient(client).withModelSpec(typedModelSpec.resolved(p1, p2, p3)).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework4.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework4.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework4.java new file mode 100644 index 0000000..ff88a0f --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework4.java @@ -0,0 +1,63 @@ +/** + * 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.AsyncCuratorFramework; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; +import org.apache.curator.x.async.modeled.ModeledFramework; +import org.apache.curator.x.async.modeled.ModeledFrameworkBuilder; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedModeledFramework}, but with 4 parameters + */ +@FunctionalInterface +public interface TypedModeledFramework4<M, P1, P2, P3, P4> +{ + ModeledFramework<M> resolved(AsyncCuratorFramework client, P1 p1, P2 p2, P3 p3, P4 p4); + + /** + * Return a new TypedModeledFramework using the given modeled framework builder and typed model spec. + * When {@link #resolved(AsyncCuratorFramework, Object, Object, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpec TypedModelSpec + * @return new TypedModeledFramework + */ + static <M, P1, P2, P3, P4> TypedModeledFramework4<M, P1, P2, P3, P4> from(ModeledFrameworkBuilder<M> frameworkBuilder, TypedModelSpec4<M, P1, P2, P3, P4> modelSpec) + { + return (client, p1, p2, p3, p4) -> frameworkBuilder.withClient(client).withModelSpec(modelSpec.resolved(p1, p2, p3, p4)).build(); + } + + /** + * Return a new TypedModeledFramework using the given modeled framework builder, model spec builder and a path with ids. + * When {@link #resolved(AsyncCuratorFramework, Object, Object, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec and resolved path + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpecBuilder model spec builder + * @param pathWithIds path with {XXXX} parameters + * @return new TypedModeledFramework + */ + static <M, P1, P2, P3, P4> TypedModeledFramework4<M, P1, P2, P3, P4> from(ModeledFrameworkBuilder<M> frameworkBuilder, ModelSpecBuilder<M> modelSpecBuilder, String pathWithIds) + { + TypedModelSpec4<M, P1, P2, P3, P4> typedModelSpec = TypedModelSpec4.from(modelSpecBuilder, pathWithIds); + return (client, p1, p2, p3, p4) -> frameworkBuilder.withClient(client).withModelSpec(typedModelSpec.resolved(p1, p2, p3, p4)).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework5.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework5.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework5.java new file mode 100644 index 0000000..7579158 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework5.java @@ -0,0 +1,63 @@ +/** + * 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.AsyncCuratorFramework; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; +import org.apache.curator.x.async.modeled.ModeledFramework; +import org.apache.curator.x.async.modeled.ModeledFrameworkBuilder; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedModeledFramework}, but with 5 parameters + */ +@FunctionalInterface +public interface TypedModeledFramework5<M, P1, P2, P3, P4, P5> +{ + ModeledFramework<M> resolved(AsyncCuratorFramework client, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5); + + /** + * Return a new TypedModeledFramework using the given modeled framework builder and typed model spec. + * When {@link #resolved(AsyncCuratorFramework, Object, Object, Object, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpec TypedModelSpec + * @return new TypedModeledFramework + */ + static <M, P1, P2, P3, P4, P5> TypedModeledFramework5<M, P1, P2, P3, P4, P5> from(ModeledFrameworkBuilder<M> frameworkBuilder, TypedModelSpec5<M, P1, P2, P3, P4, P5> modelSpec) + { + return (client, p1, p2, p3, p4, p5) -> frameworkBuilder.withClient(client).withModelSpec(modelSpec.resolved(p1, p2, p3, p4, p5)).build(); + } + + /** + * Return a new TypedModeledFramework using the given modeled framework builder, model spec builder and a path with ids. + * When {@link #resolved(AsyncCuratorFramework, Object, Object, Object, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec and resolved path + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpecBuilder model spec builder + * @param pathWithIds path with {XXXX} parameters + * @return new TypedModeledFramework + */ + static <M, P1, P2, P3, P4, P5> TypedModeledFramework5<M, P1, P2, P3, P4, P5> from(ModeledFrameworkBuilder<M> frameworkBuilder, ModelSpecBuilder<M> modelSpecBuilder, String pathWithIds) + { + TypedModelSpec5<M, P1, P2, P3, P4, P5> typedModelSpec = TypedModelSpec5.from(modelSpecBuilder, pathWithIds); + return (client, p1, p2, p3, p4, p5) -> frameworkBuilder.withClient(client).withModelSpec(typedModelSpec.resolved(p1, p2, p3, p4, p5)).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework6.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework6.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework6.java new file mode 100644 index 0000000..9b30a52 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework6.java @@ -0,0 +1,63 @@ +/** + * 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.AsyncCuratorFramework; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; +import org.apache.curator.x.async.modeled.ModeledFramework; +import org.apache.curator.x.async.modeled.ModeledFrameworkBuilder; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedModeledFramework}, but with 6 parameters + */ +@FunctionalInterface +public interface TypedModeledFramework6<M, P1, P2, P3, P4, P5, P6> +{ + ModeledFramework<M> resolved(AsyncCuratorFramework client, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6); + + /** + * Return a new TypedModeledFramework using the given modeled framework builder and typed model spec. + * When {@link #resolved(AsyncCuratorFramework, Object, Object, Object, Object, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpec TypedModelSpec + * @return new TypedModeledFramework + */ + static <M, P1, P2, P3, P4, P5, P6> TypedModeledFramework6<M, P1, P2, P3, P4, P5, P6> from(ModeledFrameworkBuilder<M> frameworkBuilder, TypedModelSpec6<M, P1, P2, P3, P4, P5, P6> modelSpec) + { + return (client, p1, p2, p3, p4, p5, p6) -> frameworkBuilder.withClient(client).withModelSpec(modelSpec.resolved(p1, p2, p3, p4, p5, p6)).build(); + } + + /** + * Return a new TypedModeledFramework using the given modeled framework builder, model spec builder and a path with ids. + * When {@link #resolved(AsyncCuratorFramework, Object, Object, Object, Object, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec and resolved path + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpecBuilder model spec builder + * @param pathWithIds path with {XXXX} parameters + * @return new TypedModeledFramework + */ + static <M, P1, P2, P3, P4, P5, P6> TypedModeledFramework6<M, P1, P2, P3, P4, P5, P6> from(ModeledFrameworkBuilder<M> frameworkBuilder, ModelSpecBuilder<M> modelSpecBuilder, String pathWithIds) + { + TypedModelSpec6<M, P1, P2, P3, P4, P5, P6> typedModelSpec = TypedModelSpec6.from(modelSpecBuilder, pathWithIds); + return (client, p1, p2, p3, p4, p5, p6) -> frameworkBuilder.withClient(client).withModelSpec(typedModelSpec.resolved(p1, p2, p3, p4, p5, p6)).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework7.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework7.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework7.java new file mode 100644 index 0000000..f4947f2 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework7.java @@ -0,0 +1,63 @@ +/** + * 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.AsyncCuratorFramework; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; +import org.apache.curator.x.async.modeled.ModeledFramework; +import org.apache.curator.x.async.modeled.ModeledFrameworkBuilder; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedModeledFramework}, but with 7 parameters + */ +@FunctionalInterface +public interface TypedModeledFramework7<M, P1, P2, P3, P4, P5, P6, P7> +{ + ModeledFramework<M> resolved(AsyncCuratorFramework client, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7); + + /** + * Return a new TypedModeledFramework using the given modeled framework builder and typed model spec. + * When {@link #resolved(AsyncCuratorFramework, Object, Object, Object, Object, Object, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpec TypedModelSpec + * @return new TypedModeledFramework + */ + static <M, P1, P2, P3, P4, P5, P6, P7> TypedModeledFramework7<M, P1, P2, P3, P4, P5, P6, P7> from(ModeledFrameworkBuilder<M> frameworkBuilder, TypedModelSpec7<M, P1, P2, P3, P4, P5, P6, P7> modelSpec) + { + return (client, p1, p2, p3, p4, p5, p6, p7) -> frameworkBuilder.withClient(client).withModelSpec(modelSpec.resolved(p1, p2, p3, p4, p5, p6, p7)).build(); + } + + /** + * Return a new TypedModeledFramework using the given modeled framework builder, model spec builder and a path with ids. + * When {@link #resolved(AsyncCuratorFramework, Object, Object, Object, Object, Object, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec and resolved path + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpecBuilder model spec builder + * @param pathWithIds path with {XXXX} parameters + * @return new TypedModeledFramework + */ + static <M, P1, P2, P3, P4, P5, P6, P7> TypedModeledFramework7<M, P1, P2, P3, P4, P5, P6, P7> from(ModeledFrameworkBuilder<M> frameworkBuilder, ModelSpecBuilder<M> modelSpecBuilder, String pathWithIds) + { + TypedModelSpec7<M, P1, P2, P3, P4, P5, P6, P7> typedModelSpec = TypedModelSpec7.from(modelSpecBuilder, pathWithIds); + return (client, p1, p2, p3, p4, p5, p6, p7) -> frameworkBuilder.withClient(client).withModelSpec(typedModelSpec.resolved(p1, p2, p3, p4, p5, p6, p7)).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework8.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework8.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework8.java new file mode 100644 index 0000000..2864df1 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework8.java @@ -0,0 +1,63 @@ +/** + * 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.AsyncCuratorFramework; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; +import org.apache.curator.x.async.modeled.ModeledFramework; +import org.apache.curator.x.async.modeled.ModeledFrameworkBuilder; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedModeledFramework}, but with 8 parameters + */ +@FunctionalInterface +public interface TypedModeledFramework8<M, P1, P2, P3, P4, P5, P6, P7, P8> +{ + ModeledFramework<M> resolved(AsyncCuratorFramework client, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8); + + /** + * Return a new TypedModeledFramework using the given modeled framework builder and typed model spec. + * When {@link #resolved(AsyncCuratorFramework, Object, Object, Object, Object, Object, Object, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpec TypedModelSpec + * @return new TypedModeledFramework + */ + static <M, P1, P2, P3, P4, P5, P6, P7, P8> TypedModeledFramework8<M, P1, P2, P3, P4, P5, P6, P7, P8> from(ModeledFrameworkBuilder<M> frameworkBuilder, TypedModelSpec8<M, P1, P2, P3, P4, P5, P6, P7, P8> modelSpec) + { + return (client, p1, p2, p3, p4, p5, p6, p7, p8) -> frameworkBuilder.withClient(client).withModelSpec(modelSpec.resolved(p1, p2, p3, p4, p5, p6, p7, p8)).build(); + } + + /** + * Return a new TypedModeledFramework using the given modeled framework builder, model spec builder and a path with ids. + * When {@link #resolved(AsyncCuratorFramework, Object, Object, Object, Object, Object, Object, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec and resolved path + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpecBuilder model spec builder + * @param pathWithIds path with {XXXX} parameters + * @return new TypedModeledFramework + */ + static <M, P1, P2, P3, P4, P5, P6, P7, P8> TypedModeledFramework8<M, P1, P2, P3, P4, P5, P6, P7, P8> from(ModeledFrameworkBuilder<M> frameworkBuilder, ModelSpecBuilder<M> modelSpecBuilder, String pathWithIds) + { + TypedModelSpec8<M, P1, P2, P3, P4, P5, P6, P7, P8> typedModelSpec = TypedModelSpec8.from(modelSpecBuilder, pathWithIds); + return (client, p1, p2, p3, p4, p5, p6, p7, p8) -> frameworkBuilder.withClient(client).withModelSpec(typedModelSpec.resolved(p1, p2, p3, p4, p5, p6, p7, p8)).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework9.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework9.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework9.java new file mode 100644 index 0000000..6102943 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedModeledFramework9.java @@ -0,0 +1,63 @@ +/** + * 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.AsyncCuratorFramework; +import org.apache.curator.x.async.modeled.ModelSpecBuilder; +import org.apache.curator.x.async.modeled.ModeledFramework; +import org.apache.curator.x.async.modeled.ModeledFrameworkBuilder; + +/** + * Same as {@link org.apache.curator.x.async.modeled.typed.TypedModeledFramework}, but with 9 parameters + */ +@FunctionalInterface +public interface TypedModeledFramework9<M, P1, P2, P3, P4, P5, P6, P7, P8, P9> +{ + ModeledFramework<M> resolved(AsyncCuratorFramework client, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9); + + /** + * Return a new TypedModeledFramework using the given modeled framework builder and typed model spec. + * When {@link #resolved(AsyncCuratorFramework, Object, Object, Object, Object, Object, Object, Object, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpec TypedModelSpec + * @return new TypedModeledFramework + */ + static <M, P1, P2, P3, P4, P5, P6, P7, P8, P9> TypedModeledFramework9<M, P1, P2, P3, P4, P5, P6, P7, P8, P9> from(ModeledFrameworkBuilder<M> frameworkBuilder, TypedModelSpec9<M, P1, P2, P3, P4, P5, P6, P7, P8, P9> modelSpec) + { + return (client, p1, p2, p3, p4, p5, p6, p7, p8, p9) -> frameworkBuilder.withClient(client).withModelSpec(modelSpec.resolved(p1, p2, p3, p4, p5, p6, p7, p8, p9)).build(); + } + + /** + * Return a new TypedModeledFramework using the given modeled framework builder, model spec builder and a path with ids. + * When {@link #resolved(AsyncCuratorFramework, Object, Object, Object, Object, Object, Object, Object, Object, Object)} is called the actual ModeledFramework is generated with the + * resolved model spec and resolved path + * + * @param frameworkBuilder ModeledFrameworkBuilder + * @param modelSpecBuilder model spec builder + * @param pathWithIds path with {XXXX} parameters + * @return new TypedModeledFramework + */ + static <M, P1, P2, P3, P4, P5, P6, P7, P8, P9> TypedModeledFramework9<M, P1, P2, P3, P4, P5, P6, P7, P8, P9> from(ModeledFrameworkBuilder<M> frameworkBuilder, ModelSpecBuilder<M> modelSpecBuilder, String pathWithIds) + { + TypedModelSpec9<M, P1, P2, P3, P4, P5, P6, P7, P8, P9> typedModelSpec = TypedModelSpec9.from(modelSpecBuilder, pathWithIds); + return (client, p1, p2, p3, p4, p5, p6, p7, p8, p9) -> frameworkBuilder.withClient(client).withModelSpec(typedModelSpec.resolved(p1, p2, p3, p4, p5, p6, p7, p8, p9)).build(); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/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..ed3dcd3 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath.java @@ -0,0 +1,92 @@ +/** + * 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 typed 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> + * + * <p> + * Additionally, if you have a model/class that implements {@link org.apache.curator.x.async.modeled.NodeName} + * you can pass that when resolving. E.g. + * </p> + * + * <p> + * <pre><code> + * public class MyModel implements NodeName { + * ... + * public String nodeName() { + * return modelId; + * } + * } + * + * TypedZPath<MyModel> typedPath = TypedZPath.from("/foo/bar/{id}"); + * + * MyModel model = ... + * ZPath path = typedPath.resolved(model); + * </pre></code> + * </p> + */ +@FunctionalInterface +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 pathWithIds path to pass to {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * @return TypedZPath + */ + static <T> TypedZPath<T> from(String pathWithIds) + { + return from(ZPath.parseWithIds(pathWithIds)); + } + + /** + * 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/0f5d10da/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath0.java ---------------------------------------------------------------------- diff --git a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath0.java b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath0.java new file mode 100644 index 0000000..60576b2 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath0.java @@ -0,0 +1,52 @@ +/** + * 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 TypedZPath}, but with 0 parameters. + */ +@FunctionalInterface +public interface TypedZPath0 +{ + ZPath resolved(); + + /** + * Return a TypedZPath using {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * + * @param pathWithIds path to pass to {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * @return TypedZPath + */ + static TypedZPath0 from(String pathWithIds) + { + return from(ZPath.parseWithIds(pathWithIds)); + } + + /** + * Return a TypedZPath + * + * @param path path to use + * @return TypedZPath + */ + static TypedZPath0 from(ZPath path) + { + return path::resolved; + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/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..b29f5ef --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath10.java @@ -0,0 +1,52 @@ +/** + * 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 + */ +@FunctionalInterface +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 pathWithIds 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 pathWithIds) + { + return from(ZPath.parseWithIds(pathWithIds)); + } + + /** + * 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 (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) -> path.resolved(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/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..1feed76 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath2.java @@ -0,0 +1,52 @@ +/** + * 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 + */ +@FunctionalInterface +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 pathWithIds path to pass to {@link org.apache.curator.x.async.modeled.ZPath#parseWithIds} + * @return TypedZPath + */ + static <T1, T2> TypedZPath2<T1, T2> from(String pathWithIds) + { + return from(ZPath.parseWithIds(pathWithIds)); + } + + /** + * Return a TypedZPath + * + * @param path path to use + * @return TypedZPath + */ + static <T1, T2> TypedZPath2<T1, T2> from(ZPath path) + { + return (p1, p2) -> path.resolved(p1, p2); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/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..91185ce --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath3.java @@ -0,0 +1,52 @@ +/** + * 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 + */ +@FunctionalInterface +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 pathWithIds 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 pathWithIds) + { + return from(ZPath.parseWithIds(pathWithIds)); + } + + /** + * Return a TypedZPath + * + * @param path path to use + * @return TypedZPath + */ + static <T1, T2, T3> TypedZPath3<T1, T2, T3> from(ZPath path) + { + return (p1, p2, p3) -> path.resolved(p1, p2, p3); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/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..be4905b --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath4.java @@ -0,0 +1,52 @@ +/** + * 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 + */ +@FunctionalInterface +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 pathWithIds 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 pathWithIds) + { + return from(ZPath.parseWithIds(pathWithIds)); + } + + /** + * Return a TypedZPath + * + * @param path path to use + * @return TypedZPath + */ + static <T1, T2, T3, T4> TypedZPath4<T1, T2, T3, T4> from(ZPath path) + { + return (p1, p2, p3, p4) -> path.resolved(p1, p2, p3, p4); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/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..8c7311d --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath5.java @@ -0,0 +1,52 @@ +/** + * 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 + */ +@FunctionalInterface +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 pathWithIds 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 pathWithIds) + { + return from(ZPath.parseWithIds(pathWithIds)); + } + + /** + * 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 (p1, p2, p3, p4, p5) -> path.resolved(p1, p2, p3, p4, p5); + } +} http://git-wip-us.apache.org/repos/asf/curator/blob/0f5d10da/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..6e05be9 --- /dev/null +++ b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/typed/TypedZPath6.java @@ -0,0 +1,52 @@ +/** + * 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 + */ +@FunctionalInterface +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 pathWithIds 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 pathWithIds) + { + return from(ZPath.parseWithIds(pathWithIds)); + } + + /** + * 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 (p1, p2, p3, p4, p5, p6) -> path.resolved(p1, p2, p3, p4, p5, p6); + } +}
