Skip to content

Commit 8618782

Browse files
committed
[ci] formatting
1 parent e042979 commit 8618782

Some content is hidden

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

49 files changed

+1231
-996
lines changed

src/main/java/org/apache/ibatis/mapping/VendorDatabaseIdProvider.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
/**
3030
* Vendor DatabaseId provider.
3131
* <p>
32-
* It returns database product name as a databaseId. If the user provides a properties it uses it to
33-
* translate database product name key="Microsoft SQL Server", value="ms" will return "ms". It can return
34-
* null, if no database product name or a properties was specified and no translation was found.
32+
* It returns database product name as a databaseId. If the user provides a properties it uses it to translate database
33+
* product name key="Microsoft SQL Server", value="ms" will return "ms". It can return null, if no database product name
34+
* or a properties was specified and no translation was found.
3535
*
3636
* @author Eduardo Macarron
3737
*/

src/main/java/org/apache/ibatis/reflection/SystemMetaObject.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,7 +27,8 @@ public final class SystemMetaObject {
2727

2828
public static final ObjectFactory DEFAULT_OBJECT_FACTORY = new DefaultObjectFactory();
2929
public static final ObjectWrapperFactory DEFAULT_OBJECT_WRAPPER_FACTORY = new DefaultObjectWrapperFactory();
30-
public static final MetaObject NULL_META_OBJECT = MetaObject.forObject(new NullObject(), DEFAULT_OBJECT_FACTORY, DEFAULT_OBJECT_WRAPPER_FACTORY, new DefaultReflectorFactory());
30+
public static final MetaObject NULL_META_OBJECT = MetaObject.forObject(new NullObject(), DEFAULT_OBJECT_FACTORY,
31+
DEFAULT_OBJECT_WRAPPER_FACTORY, new DefaultReflectorFactory());
3132

3233
private SystemMetaObject() {
3334
// Prevent Instantiation of Static Class
@@ -37,7 +38,8 @@ private static class NullObject {
3738
}
3839

3940
public static MetaObject forObject(Object object) {
40-
return MetaObject.forObject(object, DEFAULT_OBJECT_FACTORY, DEFAULT_OBJECT_WRAPPER_FACTORY, new DefaultReflectorFactory());
41+
return MetaObject.forObject(object, DEFAULT_OBJECT_FACTORY, DEFAULT_OBJECT_WRAPPER_FACTORY,
42+
new DefaultReflectorFactory());
4143
}
4244

4345
}

src/main/java/org/apache/ibatis/reflection/TypeParameterResolver.java

+17-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@ public class TypeParameterResolver {
3737
* the field
3838
* @param srcType
3939
* the src type
40+
*
4041
* @return The field type as {@link Type}. If it has type parameters in the declaration,<br>
4142
* they will be resolved to the actual runtime {@link Type}s.
4243
*/
@@ -53,6 +54,7 @@ public static Type resolveFieldType(Field field, Type srcType) {
5354
* the method
5455
* @param srcType
5556
* the src type
57+
*
5658
* @return The return type of the method as {@link Type}. If it has type parameters in the declaration,<br>
5759
* they will be resolved to the actual runtime {@link Type}s.
5860
*/
@@ -69,6 +71,7 @@ public static Type resolveReturnType(Method method, Type srcType) {
6971
* the method
7072
* @param srcType
7173
* the src type
74+
*
7275
* @return The parameter types of the method as an array of {@link Type}s. If they have type parameters in the
7376
* declaration,<br>
7477
* they will be resolved to the actual runtime {@link Type}s.
@@ -95,7 +98,8 @@ private static Type resolveType(Type type, Type srcType, Class<?> declaringClass
9598
}
9699
}
97100

98-
private static Type resolveGenericArrayType(GenericArrayType genericArrayType, Type srcType, Class<?> declaringClass) {
101+
private static Type resolveGenericArrayType(GenericArrayType genericArrayType, Type srcType,
102+
Class<?> declaringClass) {
99103
Type componentType = genericArrayType.getGenericComponentType();
100104
Type resolvedComponentType = null;
101105
if (componentType instanceof TypeVariable) {
@@ -112,7 +116,8 @@ private static Type resolveGenericArrayType(GenericArrayType genericArrayType, T
112116
}
113117
}
114118

115-
private static ParameterizedType resolveParameterizedType(ParameterizedType parameterizedType, Type srcType, Class<?> declaringClass) {
119+
private static ParameterizedType resolveParameterizedType(ParameterizedType parameterizedType, Type srcType,
120+
Class<?> declaringClass) {
116121
Class<?> rawType = (Class<?>) parameterizedType.getRawType();
117122
Type[] typeArgs = parameterizedType.getActualTypeArguments();
118123
Type[] args = new Type[typeArgs.length];
@@ -161,7 +166,8 @@ private static Type resolveTypeVar(TypeVariable<?> typeVar, Type srcType, Class<
161166
ParameterizedType parameterizedType = (ParameterizedType) srcType;
162167
clazz = (Class<?>) parameterizedType.getRawType();
163168
} else {
164-
throw new IllegalArgumentException("The 2nd arg must be Class or ParameterizedType, but was: " + srcType.getClass());
169+
throw new IllegalArgumentException(
170+
"The 2nd arg must be Class or ParameterizedType, but was: " + srcType.getClass());
165171
}
166172

167173
if (clazz == declaringClass) {
@@ -188,7 +194,8 @@ private static Type resolveTypeVar(TypeVariable<?> typeVar, Type srcType, Class<
188194
return Object.class;
189195
}
190196

191-
private static Type scanSuperTypes(TypeVariable<?> typeVar, Type srcType, Class<?> declaringClass, Class<?> clazz, Type superclass) {
197+
private static Type scanSuperTypes(TypeVariable<?> typeVar, Type srcType, Class<?> declaringClass, Class<?> clazz,
198+
Type superclass) {
192199
if (superclass instanceof ParameterizedType) {
193200
ParameterizedType parentAsType = (ParameterizedType) superclass;
194201
Class<?> parentAsClass = (Class<?>) parentAsType.getRawType();
@@ -212,7 +219,8 @@ private static Type scanSuperTypes(TypeVariable<?> typeVar, Type srcType, Class<
212219
return null;
213220
}
214221

215-
private static ParameterizedType translateParentTypeVars(ParameterizedType srcType, Class<?> srcClass, ParameterizedType parentType) {
222+
private static ParameterizedType translateParentTypeVars(ParameterizedType srcType, Class<?> srcClass,
223+
ParameterizedType parentType) {
216224
Type[] parentTypeArgs = parentType.getActualTypeArguments();
217225
Type[] srcTypeArgs = srcType.getActualTypeArguments();
218226
TypeVariable<?>[] srcTypeVars = srcClass.getTypeParameters();
@@ -230,7 +238,7 @@ private static ParameterizedType translateParentTypeVars(ParameterizedType srcTy
230238
newParentArgs[i] = parentTypeArgs[i];
231239
}
232240
}
233-
return noChange ? parentType : new ParameterizedTypeImpl((Class<?>)parentType.getRawType(), null, newParentArgs);
241+
return noChange ? parentType : new ParameterizedTypeImpl((Class<?>) parentType.getRawType(), null, newParentArgs);
234242
}
235243

236244
private TypeParameterResolver() {
@@ -268,7 +276,8 @@ public Type getRawType() {
268276

269277
@Override
270278
public String toString() {
271-
return "ParameterizedTypeImpl [rawType=" + rawType + ", ownerType=" + ownerType + ", actualTypeArguments=" + Arrays.toString(actualTypeArguments) + "]";
279+
return "ParameterizedTypeImpl [rawType=" + rawType + ", ownerType=" + ownerType + ", actualTypeArguments="
280+
+ Arrays.toString(actualTypeArguments) + "]";
272281
}
273282
}
274283

src/main/java/org/apache/ibatis/reflection/wrapper/BaseWrapper.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -68,7 +68,8 @@ protected Object getCollectionValue(PropertyTokenizer prop, Object collection) {
6868
} else if (collection instanceof short[]) {
6969
return ((short[]) collection)[i];
7070
} else {
71-
throw new ReflectionException("The '" + prop.getName() + "' property of " + collection + " is not a List or Array.");
71+
throw new ReflectionException(
72+
"The '" + prop.getName() + "' property of " + collection + " is not a List or Array.");
7273
}
7374
}
7475
}
@@ -99,7 +100,8 @@ protected void setCollectionValue(PropertyTokenizer prop, Object collection, Obj
99100
} else if (collection instanceof short[]) {
100101
((short[]) collection)[i] = (Short) value;
101102
} else {
102-
throw new ReflectionException("The '" + prop.getName() + "' property of " + collection + " is not a List or Array.");
103+
throw new ReflectionException(
104+
"The '" + prop.getName() + "' property of " + collection + " is not a List or Array.");
103105
}
104106
}
105107
}

src/main/java/org/apache/ibatis/reflection/wrapper/BeanWrapper.java

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -149,10 +149,12 @@ public MetaObject instantiatePropertyValue(String name, PropertyTokenizer prop,
149149
Class<?> type = getSetterType(prop.getName());
150150
try {
151151
Object newObject = objectFactory.create(type);
152-
metaValue = MetaObject.forObject(newObject, metaObject.getObjectFactory(), metaObject.getObjectWrapperFactory(), metaObject.getReflectorFactory());
152+
metaValue = MetaObject.forObject(newObject, metaObject.getObjectFactory(), metaObject.getObjectWrapperFactory(),
153+
metaObject.getReflectorFactory());
153154
set(prop, newObject);
154155
} catch (Exception e) {
155-
throw new ReflectionException("Cannot set value of property '" + name + "' because '" + name + "' is null and cannot be instantiated on instance of " + type.getName() + ". Cause:" + e.toString(), e);
156+
throw new ReflectionException("Cannot set value of property '" + name + "' because '" + name
157+
+ "' is null and cannot be instantiated on instance of " + type.getName() + ". Cause:" + e.toString(), e);
156158
}
157159
return metaValue;
158160
}
@@ -168,21 +170,23 @@ private Object getBeanProperty(PropertyTokenizer prop, Object object) {
168170
} catch (RuntimeException e) {
169171
throw e;
170172
} catch (Throwable t) {
171-
throw new ReflectionException("Could not get property '" + prop.getName() + "' from " + object.getClass() + ". Cause: " + t.toString(), t);
173+
throw new ReflectionException(
174+
"Could not get property '" + prop.getName() + "' from " + object.getClass() + ". Cause: " + t.toString(), t);
172175
}
173176
}
174177

175178
private void setBeanProperty(PropertyTokenizer prop, Object object, Object value) {
176179
try {
177180
Invoker method = metaClass.getSetInvoker(prop.getName());
178-
Object[] params = {value};
181+
Object[] params = { value };
179182
try {
180183
method.invoke(object, params);
181184
} catch (Throwable t) {
182185
throw ExceptionUtil.unwrapThrowable(t);
183186
}
184187
} catch (Throwable t) {
185-
throw new ReflectionException("Could not set property '" + prop.getName() + "' of '" + object.getClass() + "' with value '" + value + "' Cause: " + t.toString(), t);
188+
throw new ReflectionException("Could not set property '" + prop.getName() + "' of '" + object.getClass()
189+
+ "' with value '" + value + "' Cause: " + t.toString(), t);
186190
}
187191
}
188192

src/main/java/org/apache/ibatis/reflection/wrapper/DefaultObjectWrapperFactory.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,7 +30,8 @@ public boolean hasWrapperFor(Object object) {
3030

3131
@Override
3232
public ObjectWrapper getWrapperFor(MetaObject metaObject, Object object) {
33-
throw new ReflectionException("The DefaultObjectWrapperFactory should never be called to provide an ObjectWrapper.");
33+
throw new ReflectionException(
34+
"The DefaultObjectWrapperFactory should never be called to provide an ObjectWrapper.");
3435
}
3536

3637
}

src/main/java/org/apache/ibatis/reflection/wrapper/MapWrapper.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -137,7 +137,8 @@ public boolean hasGetter(String name) {
137137
public MetaObject instantiatePropertyValue(String name, PropertyTokenizer prop, ObjectFactory objectFactory) {
138138
HashMap<String, Object> map = new HashMap<>();
139139
set(prop, map);
140-
return MetaObject.forObject(map, metaObject.getObjectFactory(), metaObject.getObjectWrapperFactory(), metaObject.getReflectorFactory());
140+
return MetaObject.forObject(map, metaObject.getObjectFactory(), metaObject.getObjectWrapperFactory(),
141+
metaObject.getReflectorFactory());
141142
}
142143

143144
@Override

src/main/java/org/apache/ibatis/scripting/LanguageDriver.java

+30-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,32 +29,48 @@ public interface LanguageDriver {
2929
* Creates a {@link ParameterHandler} that passes the actual parameters to the the JDBC statement.
3030
*
3131
* @author Frank D. Martinez [mnesarco]
32-
* @param mappedStatement The mapped statement that is being executed
33-
* @param parameterObject The input parameter object (can be null)
34-
* @param boundSql The resulting SQL once the dynamic language has been executed.
32+
*
33+
* @param mappedStatement
34+
* The mapped statement that is being executed
35+
* @param parameterObject
36+
* The input parameter object (can be null)
37+
* @param boundSql
38+
* The resulting SQL once the dynamic language has been executed.
39+
*
3540
* @return the parameter handler
41+
*
3642
* @see DefaultParameterHandler
3743
*/
3844
ParameterHandler createParameterHandler(MappedStatement mappedStatement, Object parameterObject, BoundSql boundSql);
3945

4046
/**
41-
* Creates an {@link SqlSource} that will hold the statement read from a mapper xml file.
42-
* It is called during startup, when the mapped statement is read from a class or an xml file.
47+
* Creates an {@link SqlSource} that will hold the statement read from a mapper xml file. It is called during startup,
48+
* when the mapped statement is read from a class or an xml file.
49+
*
50+
* @param configuration
51+
* The MyBatis configuration
52+
* @param script
53+
* XNode parsed from a XML file
54+
* @param parameterType
55+
* input parameter type got from a mapper method or specified in the parameterType xml attribute. Can be
56+
* null.
4357
*
44-
* @param configuration The MyBatis configuration
45-
* @param script XNode parsed from a XML file
46-
* @param parameterType input parameter type got from a mapper method or specified in the parameterType xml attribute. Can be null.
4758
* @return the sql source
4859
*/
4960
SqlSource createSqlSource(Configuration configuration, XNode script, Class<?> parameterType);
5061

5162
/**
52-
* Creates an {@link SqlSource} that will hold the statement read from an annotation.
53-
* It is called during startup, when the mapped statement is read from a class or an xml file.
63+
* Creates an {@link SqlSource} that will hold the statement read from an annotation. It is called during startup,
64+
* when the mapped statement is read from a class or an xml file.
65+
*
66+
* @param configuration
67+
* The MyBatis configuration
68+
* @param script
69+
* The content of the annotation
70+
* @param parameterType
71+
* input parameter type got from a mapper method or specified in the parameterType xml attribute. Can be
72+
* null.
5473
*
55-
* @param configuration The MyBatis configuration
56-
* @param script The content of the annotation
57-
* @param parameterType input parameter type got from a mapper method or specified in the parameterType xml attribute. Can be null.
5874
* @return the sql source
5975
*/
6076
SqlSource createSqlSource(Configuration configuration, String script, Class<?> parameterType);

src/main/java/org/apache/ibatis/scripting/defaults/RawLanguageDriver.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,11 +22,11 @@
2222
import org.apache.ibatis.session.Configuration;
2323

2424
/**
25-
* As of 3.2.4 the default XML language is able to identify static statements
26-
* and create a {@link RawSqlSource}. So there is no need to use RAW unless you
27-
* want to make sure that there is not any dynamic tag for any reason.
25+
* As of 3.2.4 the default XML language is able to identify static statements and create a {@link RawSqlSource}. So
26+
* there is no need to use RAW unless you want to make sure that there is not any dynamic tag for any reason.
2827
*
2928
* @since 3.2.0
29+
*
3030
* @author Eduardo Macarron
3131
*/
3232
public class RawLanguageDriver extends XMLLanguageDriver {

src/main/java/org/apache/ibatis/scripting/defaults/RawSqlSource.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,10 +26,10 @@
2626
import org.apache.ibatis.session.Configuration;
2727

2828
/**
29-
* Static SqlSource. It is faster than {@link DynamicSqlSource} because mappings are
30-
* calculated during startup.
29+
* Static SqlSource. It is faster than {@link DynamicSqlSource} because mappings are calculated during startup.
3130
*
3231
* @since 3.2.0
32+
*
3333
* @author Eduardo Macarron
3434
*/
3535
public class RawSqlSource implements SqlSource {

src/main/java/org/apache/ibatis/scripting/xmltags/DynamicContext.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -117,7 +117,7 @@ public Object getProperty(Map context, Object target, Object name) {
117117

118118
Object parameterObject = map.get(PARAMETER_OBJECT_KEY);
119119
if (parameterObject instanceof Map) {
120-
return ((Map)parameterObject).get(name);
120+
return ((Map) parameterObject).get(name);
121121
}
122122

123123
return null;

0 commit comments

Comments
 (0)