Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/java/com/ibatis/common/beans/ComplexBeanProbe.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public String[] getWriteablePropertyNames(Object object) {
*
* @return The type of the property
*/
@Override
public Class getPropertyTypeForSetter(Object object, String name) {
Class type = object.getClass();

Expand Down Expand Up @@ -115,6 +116,7 @@ public Class getPropertyTypeForSetter(Object object, String name) {
*
* @return The type of the property
*/
@Override
public Class getPropertyTypeForGetter(Object object, String name) {
Class type = object.getClass();

Expand Down Expand Up @@ -203,6 +205,7 @@ private Class getClassPropertyTypeForSetter(Class type, String name) {
*
* @return The property value (as an Object)
*/
@Override
public Object getObject(Object object, String name) {
if (name.indexOf('.') > -1) {
StringTokenizer parser = new StringTokenizer(name, ".");
Expand Down Expand Up @@ -231,6 +234,7 @@ public Object getObject(Object object, String name) {
* @param value
* The new value to set
*/
@Override
public void setObject(Object object, String name, Object value) {
if (name.indexOf('.') > -1) {
StringTokenizer parser = new StringTokenizer(name, ".");
Expand Down Expand Up @@ -272,6 +276,7 @@ public void setObject(Object object, String name, Object value) {
*
* @return True if the property exists and is writable
*/
@Override
public boolean hasWritableProperty(Object object, String propertyName) {
boolean hasProperty = false;
if (object instanceof Map) {
Expand Down Expand Up @@ -302,6 +307,7 @@ public boolean hasWritableProperty(Object object, String propertyName) {
*
* @return True if the property exists and is readable
*/
@Override
public boolean hasReadableProperty(Object object, String propertyName) {
boolean hasProperty = false;
if (object instanceof Map) {
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/ibatis/common/beans/DomProbe.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public String[] getWriteablePropertyNames(Object object) {
return (String[]) props.toArray(new String[props.size()]);
}

@Override
public Class getPropertyTypeForSetter(Object object, String name) {
Element e = findNestedNodeByName(resolveElement(object), name, false);
// todo alias types, don't use exceptions like this
Expand All @@ -70,6 +71,7 @@ public Class getPropertyTypeForSetter(Object object, String name) {
}
}

@Override
public Class getPropertyTypeForGetter(Object object, String name) {
Element e = findNestedNodeByName(resolveElement(object), name, false);
// todo alias types, don't use exceptions like this
Expand All @@ -80,14 +82,17 @@ public Class getPropertyTypeForGetter(Object object, String name) {
}
}

@Override
public boolean hasWritableProperty(Object object, String propertyName) {
return findNestedNodeByName(resolveElement(object), propertyName, false) != null;
}

@Override
public boolean hasReadableProperty(Object object, String propertyName) {
return findNestedNodeByName(resolveElement(object), propertyName, false) != null;
}

@Override
public Object getObject(Object object, String name) {
Object value = null;
Element element = findNestedNodeByName(resolveElement(object), name, false);
Expand All @@ -97,6 +102,7 @@ public Object getObject(Object object, String name) {
return value;
}

@Override
public void setObject(Object object, String name, Object value) {
Element element = findNestedNodeByName(resolveElement(object), name, true);
if (element != null) {
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/ibatis/common/beans/GenericProbe.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ protected GenericProbe() {
*
* @see com.ibatis.common.beans.BaseProbe#getObject(java.lang.Object, java.lang.String)
*/
@Override
public Object getObject(Object object, String name) {

if (object instanceof org.w3c.dom.Document) {
Expand Down Expand Up @@ -96,6 +97,7 @@ public Object getObject(Object object, String name) {
*
* @see com.ibatis.common.beans.BaseProbe#setObject(java.lang.Object, java.lang.String, java.lang.Object)
*/
@Override
public void setObject(Object object, String name, Object value) {
if (object instanceof org.w3c.dom.Document) {
DOM_PROBE.setObject(object, name, value);
Expand Down Expand Up @@ -154,6 +156,7 @@ public String[] getWriteablePropertyNames(Object object) {
*
* @see com.ibatis.common.beans.Probe#getPropertyTypeForSetter(java.lang.Object, java.lang.String)
*/
@Override
public Class getPropertyTypeForSetter(Object object, String name) {
if (object instanceof Class) {
return getClassPropertyTypeForSetter((Class) object, name);
Expand All @@ -176,6 +179,7 @@ public Class getPropertyTypeForSetter(Object object, String name) {
*
* @see com.ibatis.common.beans.Probe#getPropertyTypeForGetter(java.lang.Object, java.lang.String)
*/
@Override
public Class getPropertyTypeForGetter(Object object, String name) {
if (object instanceof Class) {
return getClassPropertyTypeForGetter((Class) object, name);
Expand All @@ -200,6 +204,7 @@ public Class getPropertyTypeForGetter(Object object, String name) {
*
* @see com.ibatis.common.beans.Probe#hasWritableProperty(java.lang.Object, java.lang.String)
*/
@Override
public boolean hasWritableProperty(Object object, String propertyName) {
if (object instanceof org.w3c.dom.Document) {
return DOM_PROBE.hasWritableProperty(object, propertyName);
Expand All @@ -220,6 +225,7 @@ public boolean hasWritableProperty(Object object, String propertyName) {
*
* @see com.ibatis.common.beans.Probe#hasReadableProperty(java.lang.Object, java.lang.String)
*/
@Override
public boolean hasReadableProperty(Object object, String propertyName) {
if (object instanceof org.w3c.dom.Document) {
return DOM_PROBE.hasReadableProperty(object, propertyName);
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/ibatis/common/beans/GetFieldInvoker.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2023 the original author or authors.
* Copyright 2004-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,10 +40,12 @@ public GetFieldInvoker(Field field) {
this.name = "(" + field.getName() + ")";
}

@Override
public Object invoke(Object target, Object[] args) throws IllegalAccessException, InvocationTargetException {
return field.get(target);
}

@Override
public String getName() {
return name;
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/ibatis/common/beans/MethodInvoker.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2023 the original author or authors.
* Copyright 2004-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,6 +40,7 @@ public MethodInvoker(Method method) {
this.name = method.getName();
}

@Override
public Object invoke(Object target, Object[] args) throws IllegalAccessException, InvocationTargetException {
return method.invoke(target, args);
}
Expand All @@ -53,6 +54,7 @@ public Method getMethod() {
return method;
}

@Override
public String getName() {
return name;
}
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/ibatis/common/beans/Probe.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2022 the original author or authors.
* Copyright 2004-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,7 +30,7 @@ public interface Probe {
*
* @return The property value (as an Object)
*/
public Object getObject(Object object, String name);
Object getObject(Object object, String name);

/**
* Sets the value of a property on an object.
Expand All @@ -42,7 +42,7 @@ public interface Probe {
* @param value
* - the new value to set
*/
public void setObject(Object object, String name, Object value);
void setObject(Object object, String name, Object value);

/**
* Returns the class that the setter expects when setting a property.
Expand All @@ -54,7 +54,7 @@ public interface Probe {
*
* @return The type of the property
*/
public Class getPropertyTypeForSetter(Object object, String name);
Class getPropertyTypeForSetter(Object object, String name);

/**
* Returns the class that the getter will return when reading a property.
Expand All @@ -66,7 +66,7 @@ public interface Probe {
*
* @return The type of the property
*/
public Class getPropertyTypeForGetter(Object object, String name);
Class getPropertyTypeForGetter(Object object, String name);

/**
* Checks to see if an object has a writable property by a given name.
Expand All @@ -78,7 +78,7 @@ public interface Probe {
*
* @return True if the property exists and is writable
*/
public boolean hasWritableProperty(Object object, String propertyName);
boolean hasWritableProperty(Object object, String propertyName);

/**
* Checks to see if an object has a readable property by a given name.
Expand All @@ -90,6 +90,6 @@ public interface Probe {
*
* @return True if the property exists and is readable
*/
public boolean hasReadableProperty(Object object, String propertyName);
boolean hasReadableProperty(Object object, String propertyName);

}
3 changes: 1 addition & 2 deletions src/main/java/com/ibatis/common/beans/ProbeFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ public static Probe getProbe() {
public static Probe getProbe(Object object) {
if (object instanceof org.w3c.dom.Document) {
return DOM;
} else {
return BEAN;
}
return BEAN;
}

}
4 changes: 3 additions & 1 deletion src/main/java/com/ibatis/common/beans/SetFieldInvoker.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2023 the original author or authors.
* Copyright 2004-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,11 +40,13 @@ public SetFieldInvoker(Field field) {
this.name = "(" + field.getName() + ")";
}

@Override
public Object invoke(Object target, Object[] args) throws IllegalAccessException, InvocationTargetException {
field.set(target, args[0]);
return null;
}

@Override
public String getName() {
return name;
}
Expand Down
31 changes: 29 additions & 2 deletions src/main/java/com/ibatis/common/jdbc/SimpleDataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,22 @@
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.sql.*;
import java.util.*;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.SQLWarning;
import java.sql.Savepoint;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.logging.Logger;

import javax.sql.DataSource;
Expand Down Expand Up @@ -288,41 +302,47 @@ private int assembleConnectionTypeCode(String url, String username, String passw
/**
* @see javax.sql.DataSource#getConnection()
*/
@Override
public Connection getConnection() throws SQLException {
return popConnection(jdbcUsername, jdbcPassword).getProxyConnection();
}

/**
* @see javax.sql.DataSource#getConnection(java.lang.String, java.lang.String)
*/
@Override
public Connection getConnection(String username, String password) throws SQLException {
return popConnection(username, password).getProxyConnection();
}

/**
* @see javax.sql.DataSource#setLoginTimeout(int)
*/
@Override
public void setLoginTimeout(int loginTimeout) throws SQLException {
DriverManager.setLoginTimeout(loginTimeout);
}

/**
* @see javax.sql.DataSource#getLoginTimeout()
*/
@Override
public int getLoginTimeout() throws SQLException {
return DriverManager.getLoginTimeout();
}

/**
* @see javax.sql.DataSource#setLogWriter(java.io.PrintWriter)
*/
@Override
public void setLogWriter(PrintWriter logWriter) throws SQLException {
DriverManager.setLogWriter(logWriter);
}

/**
* @see javax.sql.DataSource#getLogWriter()
*/
@Override
public PrintWriter getLogWriter() throws SQLException {
return DriverManager.getLogWriter();
}
Expand Down Expand Up @@ -857,6 +877,7 @@ public static Connection unwrapConnection(Connection conn) {
}
}

@Override
protected void finalize() throws Throwable {
forceCloseAll();
}
Expand Down Expand Up @@ -1081,6 +1102,7 @@ private Connection getValidConnection() {
return realConnection;
}

@Override
public int hashCode() {
return hashCode;
}
Expand All @@ -1093,6 +1115,7 @@ public int hashCode() {
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (obj instanceof SimplePooledConnection) {
return realConnection.hashCode() == (((SimplePooledConnection) obj).realConnection.hashCode());
Expand All @@ -1119,6 +1142,7 @@ public boolean equals(Object obj) {
*
* @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
*/
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
String methodName = method.getName();
if (CLOSE.hashCode() == methodName.hashCode() && CLOSE.equals(methodName)) {
Expand Down Expand Up @@ -1646,16 +1670,19 @@ public PreparedStatement prepareStatement(String sql, String columnNames[]) thro

}

@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
// TODO Auto-generated method stub
return null;
}

@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
// TODO Auto-generated method stub
return null;
}

@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
// TODO Auto-generated method stub
return false;
Expand Down
Loading
Loading