File tree 3 files changed +78
-0
lines changed
3 files changed +78
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3
+ xsi:schemaLocation=" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
4
+
5
+ <modelVersion >4.0.0</modelVersion >
6
+ <artifactId >spring-data-java8-stub</artifactId >
7
+
8
+ <parent >
9
+ <groupId >org.springframework.data.build</groupId >
10
+ <artifactId >spring-data-build</artifactId >
11
+ <version >1.4.0.BUILD-SNAPSHOT</version >
12
+ </parent >
13
+
14
+ <name >Spring Data Build - Java 8 Stubs</name >
15
+
16
+ <build >
17
+ <plugins >
18
+ <plugin >
19
+ <groupId >org.apache.maven.plugins</groupId >
20
+ <artifactId >maven-compiler-plugin</artifactId >
21
+ <version >3.1</version >
22
+ <configuration >
23
+ <source >1.6</source >
24
+ <target >1.6</target >
25
+ </configuration >
26
+ </plugin >
27
+ </plugins >
28
+ </build >
29
+
30
+ </project >
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2014 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
+ * http://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 java .util ;
17
+
18
+ /**
19
+ * Stub implementation of JDK 8's {@link Optional}.
20
+ *
21
+ * @author Oliver Gierke
22
+ */
23
+ @ SuppressWarnings ("unused" )
24
+ public final class Optional <T > {
25
+
26
+ private static final Optional <?> EMPTY = new Optional <Object >(null );
27
+
28
+ private final T value ;
29
+
30
+ private Optional (T value ) {
31
+ this .value = value ;
32
+ }
33
+
34
+ public static <T > Optional <T > of (T value ) {
35
+ return new Optional <T >(value );
36
+ }
37
+
38
+ public static <T > Optional <T > ofNullable (T value ) {
39
+ return value == null ? Optional .<T > empty () : of (value );
40
+ }
41
+
42
+ @ SuppressWarnings ("unchecked" )
43
+ public static <T > Optional <T > empty () {
44
+ Optional <T > t = (Optional <T >) EMPTY ;
45
+ return t ;
46
+ }
47
+ }
Original file line number Diff line number Diff line change 18
18
19
19
<modules >
20
20
<module >resources</module >
21
+ <module >java8</module >
21
22
<module >parent</module >
22
23
<module >bom</module >
23
24
</modules >
You can’t perform that action at this time.
0 commit comments