Skip to content

Commit 2804726

Browse files
committed
#73 - hacking - separate Bindings class.
1 parent 9b32943 commit 2804726

File tree

1 file changed

+54
-0
lines changed
  • src/main/java/org/springframework/data/r2dbc/function

1 file changed

+54
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright 2019 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.r2dbc.function;
17+
18+
import io.r2dbc.spi.Statement;
19+
import lombok.Value;
20+
21+
import org.springframework.data.r2dbc.domain.SettableValue;
22+
23+
import java.util.List;
24+
25+
/**
26+
* @author Jens Schauder
27+
*/
28+
public class Bindings {
29+
30+
private final List<SingleBinding> bindings;
31+
32+
public Bindings(List<SingleBinding> bindings) {
33+
this.bindings = bindings;
34+
}
35+
36+
37+
@Value
38+
static public abstract class SingleBinding<T> {
39+
40+
T identifier;
41+
SettableValue value;
42+
43+
public abstract void bindTo(Statement statement);
44+
45+
public boolean isIndexed() {
46+
return (identifier instanceof Number);
47+
}
48+
49+
public boolean isNamed() {
50+
return !isIndexed();
51+
}
52+
}
53+
54+
}

0 commit comments

Comments
 (0)