Skip to content

Commit 9bab06b

Browse files
authored
Add spotless-maven-plugin for Java formatting (neo4j#1227) (neo4j#1234)
* Add spotless-maven-plugin for Java formatting This update introduces similar updates to Neo4j server. * Add .gitattributes
1 parent 0084fc6 commit 9bab06b

File tree

854 files changed

+37910
-46413
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

854 files changed

+37910
-46413
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.java eol=lf
2+
*.xml eol=lf
3+

driver/src/main/java/org/neo4j/driver/AccessMode.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
* While any {@link AccessMode} will be ignored while running transactions via a driver towards a single server.
2828
* As the single server serves both read and write operations at the same time.
2929
*/
30-
public enum AccessMode
31-
{
30+
public enum AccessMode {
3231
/**
3332
* Use this for transactions that requires a read server in a cluster
3433
*/

driver/src/main/java/org/neo4j/driver/AuthToken.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,4 @@
2727
* @see GraphDatabase#driver(String, AuthToken)
2828
* @since 1.0
2929
*/
30-
public interface AuthToken
31-
{
32-
33-
}
30+
public interface AuthToken {}

driver/src/main/java/org/neo4j/driver/AuthTokens.java

Lines changed: 48 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818
*/
1919
package org.neo4j.driver;
2020

21-
import java.util.Map;
22-
import java.util.Objects;
23-
24-
import org.neo4j.driver.internal.security.InternalAuthToken;
25-
2621
import static java.util.Collections.singletonMap;
2722
import static org.neo4j.driver.Values.value;
2823
import static org.neo4j.driver.internal.security.InternalAuthToken.CREDENTIALS_KEY;
@@ -32,15 +27,18 @@
3227
import static org.neo4j.driver.internal.security.InternalAuthToken.SCHEME_KEY;
3328
import static org.neo4j.driver.internal.util.Iterables.newHashMapWithSize;
3429

30+
import java.util.Map;
31+
import java.util.Objects;
32+
import org.neo4j.driver.internal.security.InternalAuthToken;
33+
3534
/**
3635
* This is a listing of the various methods of authentication supported by this
3736
* driver. The scheme used must be supported by the Neo4j Instance you are connecting
3837
* to.
3938
* @see GraphDatabase#driver(String, AuthToken)
4039
* @since 1.0
4140
*/
42-
public class AuthTokens
43-
{
41+
public class AuthTokens {
4442
/**
4543
* The basic authentication scheme, using a username and a password.
4644
* @param username this is the "principal", identifying who this token represents
@@ -49,9 +47,8 @@ public class AuthTokens
4947
* @see GraphDatabase#driver(String, AuthToken)
5048
* @throws NullPointerException when either username or password is {@code null}
5149
*/
52-
public static AuthToken basic( String username, String password )
53-
{
54-
return basic( username, password, null );
50+
public static AuthToken basic(String username, String password) {
51+
return basic(username, password, null);
5552
}
5653

5754
/**
@@ -63,20 +60,18 @@ public static AuthToken basic( String username, String password )
6360
* @see GraphDatabase#driver(String, AuthToken)
6461
* @throws NullPointerException when either username or password is {@code null}
6562
*/
66-
public static AuthToken basic( String username, String password, String realm )
67-
{
68-
Objects.requireNonNull( username, "Username can't be null" );
69-
Objects.requireNonNull( password, "Password can't be null" );
63+
public static AuthToken basic(String username, String password, String realm) {
64+
Objects.requireNonNull(username, "Username can't be null");
65+
Objects.requireNonNull(password, "Password can't be null");
7066

71-
Map<String,Value> map = newHashMapWithSize( 4 );
72-
map.put( SCHEME_KEY, value( "basic" ) );
73-
map.put( PRINCIPAL_KEY, value( username ) );
74-
map.put( CREDENTIALS_KEY, value( password ) );
75-
if ( realm != null )
76-
{
77-
map.put( REALM_KEY, value( realm ) );
67+
Map<String, Value> map = newHashMapWithSize(4);
68+
map.put(SCHEME_KEY, value("basic"));
69+
map.put(PRINCIPAL_KEY, value(username));
70+
map.put(CREDENTIALS_KEY, value(password));
71+
if (realm != null) {
72+
map.put(REALM_KEY, value(realm));
7873
}
79-
return new InternalAuthToken( map );
74+
return new InternalAuthToken(map);
8075
}
8176

8277
/**
@@ -87,14 +82,13 @@ public static AuthToken basic( String username, String password, String realm )
8782
* @throws NullPointerException when token is {@code null}
8883
* @see GraphDatabase#driver(String, AuthToken)
8984
*/
90-
public static AuthToken bearer( String token )
91-
{
92-
Objects.requireNonNull( token, "Token can't be null" );
85+
public static AuthToken bearer(String token) {
86+
Objects.requireNonNull(token, "Token can't be null");
9387

94-
Map<String,Value> map = newHashMapWithSize( 2 );
95-
map.put( SCHEME_KEY, value( "bearer" ) );
96-
map.put( CREDENTIALS_KEY, value( token ) );
97-
return new InternalAuthToken( map );
88+
Map<String, Value> map = newHashMapWithSize(2);
89+
map.put(SCHEME_KEY, value("bearer"));
90+
map.put(CREDENTIALS_KEY, value(token));
91+
return new InternalAuthToken(map);
9892
}
9993

10094
/**
@@ -106,15 +100,14 @@ public static AuthToken bearer( String token )
106100
* @see GraphDatabase#driver(String, AuthToken)
107101
* @since 1.3
108102
*/
109-
public static AuthToken kerberos( String base64EncodedTicket )
110-
{
111-
Objects.requireNonNull( base64EncodedTicket, "Ticket can't be null" );
103+
public static AuthToken kerberos(String base64EncodedTicket) {
104+
Objects.requireNonNull(base64EncodedTicket, "Ticket can't be null");
112105

113-
Map<String,Value> map = newHashMapWithSize( 3 );
114-
map.put( SCHEME_KEY, value( "kerberos" ) );
115-
map.put( PRINCIPAL_KEY, value( "" ) ); // This empty string is required for backwards compatibility.
116-
map.put( CREDENTIALS_KEY, value( base64EncodedTicket ) );
117-
return new InternalAuthToken( map );
106+
Map<String, Value> map = newHashMapWithSize(3);
107+
map.put(SCHEME_KEY, value("kerberos"));
108+
map.put(PRINCIPAL_KEY, value("")); // This empty string is required for backwards compatibility.
109+
map.put(CREDENTIALS_KEY, value(base64EncodedTicket));
110+
return new InternalAuthToken(map);
118111
}
119112

120113
/**
@@ -127,9 +120,8 @@ public static AuthToken kerberos( String base64EncodedTicket )
127120
* @see GraphDatabase#driver(String, AuthToken)
128121
* @throws NullPointerException when either principal, credentials or scheme is {@code null}
129122
*/
130-
public static AuthToken custom( String principal, String credentials, String realm, String scheme)
131-
{
132-
return custom( principal, credentials, realm, scheme, null );
123+
public static AuthToken custom(String principal, String credentials, String realm, String scheme) {
124+
return custom(principal, credentials, realm, scheme, null);
133125
}
134126

135127
/**
@@ -143,25 +135,23 @@ public static AuthToken custom( String principal, String credentials, String rea
143135
* @see GraphDatabase#driver(String, AuthToken)
144136
* @throws NullPointerException when either principal, credentials or scheme is {@code null}
145137
*/
146-
public static AuthToken custom( String principal, String credentials, String realm, String scheme, Map<String, Object> parameters)
147-
{
148-
Objects.requireNonNull( principal, "Principal can't be null" );
149-
Objects.requireNonNull( credentials, "Credentials can't be null" );
150-
Objects.requireNonNull( scheme, "Scheme can't be null" );
138+
public static AuthToken custom(
139+
String principal, String credentials, String realm, String scheme, Map<String, Object> parameters) {
140+
Objects.requireNonNull(principal, "Principal can't be null");
141+
Objects.requireNonNull(credentials, "Credentials can't be null");
142+
Objects.requireNonNull(scheme, "Scheme can't be null");
151143

152-
Map<String,Value> map = newHashMapWithSize( 5 );
153-
map.put( SCHEME_KEY, value( scheme ) );
154-
map.put( PRINCIPAL_KEY, value( principal ) );
155-
map.put( CREDENTIALS_KEY, value( credentials ) );
156-
if ( realm != null )
157-
{
158-
map.put( REALM_KEY, value( realm ) );
144+
Map<String, Value> map = newHashMapWithSize(5);
145+
map.put(SCHEME_KEY, value(scheme));
146+
map.put(PRINCIPAL_KEY, value(principal));
147+
map.put(CREDENTIALS_KEY, value(credentials));
148+
if (realm != null) {
149+
map.put(REALM_KEY, value(realm));
159150
}
160-
if ( parameters != null )
161-
{
162-
map.put( PARAMETERS_KEY, value( parameters ) );
151+
if (parameters != null) {
152+
map.put(PARAMETERS_KEY, value(parameters));
163153
}
164-
return new InternalAuthToken( map );
154+
return new InternalAuthToken(map);
165155
}
166156

167157
/**
@@ -170,8 +160,7 @@ public static AuthToken custom( String principal, String credentials, String rea
170160
* @return an authentication token that can be used to connect to Neo4j instances with auth disabled
171161
* @see GraphDatabase#driver(String, AuthToken)
172162
*/
173-
public static AuthToken none()
174-
{
175-
return new InternalAuthToken( singletonMap( SCHEME_KEY, value( "none" ) ) );
163+
public static AuthToken none() {
164+
return new InternalAuthToken(singletonMap(SCHEME_KEY, value("none")));
176165
}
177166
}

driver/src/main/java/org/neo4j/driver/Bookmark.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package org.neo4j.driver;
2020

2121
import java.util.Set;
22-
2322
import org.neo4j.driver.internal.InternalBookmark;
2423

2524
/**
@@ -33,8 +32,7 @@
3332
*
3433
* To opt out of this mechanism for unrelated units of work, applications can use multiple sessions.
3534
*/
36-
public interface Bookmark
37-
{
35+
public interface Bookmark {
3836
/**
3937
* Returns a read-only set of bookmark strings that this bookmark instance identifies.
4038
* @return a read-only set of bookmark strings that this bookmark instance identifies.
@@ -46,9 +44,8 @@ public interface Bookmark
4644
* @param values values obtained from a previous bookmark.
4745
* @return A bookmark.
4846
*/
49-
static Bookmark from( Set<String> values )
50-
{
51-
return InternalBookmark.parse( values );
47+
static Bookmark from(Set<String> values) {
48+
return InternalBookmark.parse(values);
5249
}
5350

5451
/**

0 commit comments

Comments
 (0)