Skip to content

Commit 04585d7

Browse files
committed
write a line into test.file
1 parent ba7339e commit 04585d7

10 files changed

+1150
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.huifer.securityuserview;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class SecurityUserViewApplication {
8+
9+
public static void main(String[] args) {
10+
SpringApplication.run(SecurityUserViewApplication.class, args);
11+
}
12+
13+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/**
2+
* Copyright 2009-2018 the original author or authors.
3+
* <p>
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+
* <p>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p>
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.apache.ibatis.jdbc;
17+
18+
import org.apache.ibatis.type.*;
19+
20+
/**
21+
* 对于 null 不同类型的描述, {类型处理器,jdbc类型}
22+
* @author Clinton Begin
23+
* @author Adam Gent
24+
*/
25+
public enum Null {
26+
BOOLEAN(new BooleanTypeHandler(), JdbcType.BOOLEAN),
27+
28+
BYTE(new ByteTypeHandler(), JdbcType.TINYINT),
29+
SHORT(new ShortTypeHandler(), JdbcType.SMALLINT),
30+
INTEGER(new IntegerTypeHandler(), JdbcType.INTEGER),
31+
LONG(new LongTypeHandler(), JdbcType.BIGINT),
32+
FLOAT(new FloatTypeHandler(), JdbcType.FLOAT),
33+
DOUBLE(new DoubleTypeHandler(), JdbcType.DOUBLE),
34+
BIGDECIMAL(new BigDecimalTypeHandler(), JdbcType.DECIMAL),
35+
36+
STRING(new StringTypeHandler(), JdbcType.VARCHAR),
37+
CLOB(new ClobTypeHandler(), JdbcType.CLOB),
38+
LONGVARCHAR(new ClobTypeHandler(), JdbcType.LONGVARCHAR),
39+
40+
BYTEARRAY(new ByteArrayTypeHandler(), JdbcType.LONGVARBINARY),
41+
BLOB(new BlobTypeHandler(), JdbcType.BLOB),
42+
LONGVARBINARY(new BlobTypeHandler(), JdbcType.LONGVARBINARY),
43+
44+
OBJECT(new ObjectTypeHandler(), JdbcType.OTHER),
45+
OTHER(new ObjectTypeHandler(), JdbcType.OTHER),
46+
TIMESTAMP(new DateTypeHandler(), JdbcType.TIMESTAMP),
47+
DATE(new DateOnlyTypeHandler(), JdbcType.DATE),
48+
TIME(new TimeOnlyTypeHandler(), JdbcType.TIME),
49+
SQLTIMESTAMP(new SqlTimestampTypeHandler(), JdbcType.TIMESTAMP),
50+
SQLDATE(new SqlDateTypeHandler(), JdbcType.DATE),
51+
SQLTIME(new SqlTimeTypeHandler(), JdbcType.TIME);
52+
53+
/**
54+
* 类型处理器
55+
*/
56+
private TypeHandler<?> typeHandler;
57+
/**
58+
* jdbc 类型
59+
*/
60+
private JdbcType jdbcType;
61+
62+
Null(TypeHandler<?> typeHandler, JdbcType jdbcType) {
63+
this.typeHandler = typeHandler;
64+
this.jdbcType = jdbcType;
65+
}
66+
67+
public TypeHandler<?> getTypeHandler() {
68+
return typeHandler;
69+
}
70+
71+
public JdbcType getJdbcType() {
72+
return jdbcType;
73+
}
74+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* Copyright 2009-2015 the original author or authors.
3+
* <p>
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+
* <p>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p>
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.apache.ibatis.exceptions;
17+
18+
import org.apache.ibatis.executor.ErrorContext;
19+
20+
/**
21+
* 异常工厂
22+
* @author Clinton Begin
23+
*/
24+
public class ExceptionFactory {
25+
26+
private ExceptionFactory() {
27+
// Prevent Instantiation
28+
}
29+
30+
/**
31+
* 异常
32+
* @param message 异常消息
33+
* @param e 异常
34+
* @return
35+
*/
36+
public static RuntimeException wrapException(String message, Exception e) {
37+
return new PersistenceException(ErrorContext.instance().message(message).cause(e).toString(), e);
38+
}
39+
40+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.huifer.bigfile;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.boot.autoconfigure.domain.EntityScan;
6+
import org.springframework.transaction.annotation.EnableTransactionManagement;
7+
8+
/**
9+
* <p>Title : App </p>
10+
* <p>Description : </p>
11+
*
12+
* @author huifer
13+
* @date 2019-05-27
14+
*/
15+
@SpringBootApplication
16+
@EntityScan(basePackages = {"com.huifer.bigfile"})
17+
@EnableTransactionManagement
18+
public class App {
19+
20+
public static void main(String[] args) {
21+
SpringApplication.run(App.class, args);
22+
}
23+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/**
2+
* Copyright 2009-2019 the original author or authors.
3+
* <p>
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+
* <p>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p>
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.apache.ibatis.logging.jdbc;
17+
18+
import org.apache.ibatis.logging.Log;
19+
import org.apache.ibatis.reflection.ExceptionUtil;
20+
21+
import java.lang.reflect.InvocationHandler;
22+
import java.lang.reflect.Method;
23+
import java.lang.reflect.Proxy;
24+
import java.sql.Connection;
25+
import java.sql.PreparedStatement;
26+
import java.sql.Statement;
27+
28+
/**
29+
* Connection proxy to add logging.
30+
*
31+
* @author Clinton Begin
32+
* @author Eduardo Macarron
33+
*
34+
*/
35+
public final class ConnectionLogger extends BaseJdbcLogger implements InvocationHandler {
36+
37+
private final Connection connection;
38+
39+
private ConnectionLogger(Connection conn, Log statementLog, int queryStack) {
40+
super(statementLog, queryStack);
41+
this.connection = conn;
42+
}
43+
44+
/**
45+
* Creates a logging version of a connection.
46+
*
47+
* @param conn - the original connection
48+
* @return - the connection with logging
49+
*/
50+
public static Connection newInstance(Connection conn, Log statementLog, int queryStack) {
51+
InvocationHandler handler = new ConnectionLogger(conn, statementLog, queryStack);
52+
ClassLoader cl = Connection.class.getClassLoader();
53+
return (Connection) Proxy.newProxyInstance(cl, new Class[]{Connection.class}, handler);
54+
}
55+
56+
@Override
57+
public Object invoke(Object proxy, Method method, Object[] params)
58+
throws Throwable {
59+
try {
60+
if (Object.class.equals(method.getDeclaringClass())) {
61+
return method.invoke(this, params);
62+
}
63+
if ("prepareStatement".equals(method.getName())) {
64+
if (isDebugEnabled()) {
65+
debug(" Preparing: " + removeBreakingWhitespace((String) params[0]), true);
66+
}
67+
PreparedStatement stmt = (PreparedStatement) method.invoke(connection, params);
68+
stmt = PreparedStatementLogger.newInstance(stmt, statementLog, queryStack);
69+
return stmt;
70+
} else if ("prepareCall".equals(method.getName())) {
71+
if (isDebugEnabled()) {
72+
debug(" Preparing: " + removeBreakingWhitespace((String) params[0]), true);
73+
}
74+
PreparedStatement stmt = (PreparedStatement) method.invoke(connection, params);
75+
stmt = PreparedStatementLogger.newInstance(stmt, statementLog, queryStack);
76+
return stmt;
77+
} else if ("createStatement".equals(method.getName())) {
78+
Statement stmt = (Statement) method.invoke(connection, params);
79+
stmt = StatementLogger.newInstance(stmt, statementLog, queryStack);
80+
return stmt;
81+
} else {
82+
return method.invoke(connection, params);
83+
}
84+
} catch (Throwable t) {
85+
throw ExceptionUtil.unwrapThrowable(t);
86+
}
87+
}
88+
89+
/**
90+
* return the wrapped connection.
91+
*
92+
* @return the connection
93+
*/
94+
public Connection getConnection() {
95+
return connection;
96+
}
97+
98+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package org.example.domain.event.model;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public abstract class EventCommon {
7+
8+
private List<DomainEvent> events;
9+
10+
protected final void registerEvent(DomainEvent event) {
11+
getEvents().add(event);
12+
}
13+
14+
15+
public final List<DomainEvent> getEvents() {
16+
if (events == null) {
17+
events = new ArrayList<>();
18+
}
19+
return events;
20+
}
21+
22+
public final void cleanEvents() {
23+
getEvents().clear();
24+
}
25+
26+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
* Copyright 2009-2018 the original author or authors.
3+
* <p>
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+
* <p>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p>
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.apache.ibatis.reflection.invoker;
17+
18+
import org.apache.ibatis.reflection.Reflector;
19+
20+
import java.lang.reflect.Field;
21+
22+
/**
23+
* setter 字段的方法 -> {@link Invoker}
24+
*
25+
* @author Clinton Begin
26+
*/
27+
public class SetFieldInvoker implements Invoker {
28+
/**
29+
* 字段
30+
*/
31+
private final Field field;
32+
33+
public SetFieldInvoker(Field field) {
34+
this.field = field;
35+
}
36+
37+
/**
38+
* 执行方法如 name -> 执行 setName
39+
*
40+
* @param target
41+
* @param args
42+
* @return
43+
* @throws IllegalAccessException
44+
*/
45+
@Override
46+
public Object invoke(Object target, Object[] args) throws IllegalAccessException {
47+
try {
48+
field.set(target, args[0]);
49+
}
50+
catch (IllegalAccessException e) {
51+
if (Reflector.canControlMemberAccessible()) {
52+
field.setAccessible(true);
53+
field.set(target, args[0]);
54+
}
55+
else {
56+
throw e;
57+
}
58+
}
59+
return null;
60+
}
61+
62+
@Override
63+
public Class<?> getType() {
64+
return field.getType();
65+
}
66+
}

0 commit comments

Comments
 (0)