├── pic ├── demo.gif ├── logo.png ├── book_info.jpg ├── logo_large.png ├── logo_large.psd ├── logo_orgin.jpg └── mybatisCN_code.png ├── .gitignore └── src └── main └── java └── org └── apache └── ibatis ├── type ├── package-info.java ├── Alias.java ├── MappedTypes.java ├── MappedJdbcTypes.java ├── TypeException.java ├── ByteArrayUtils.java ├── TypeHandler.java ├── ByteArrayTypeHandler.java ├── ObjectTypeHandler.java ├── StringTypeHandler.java ├── NStringTypeHandler.java ├── SqlDateTypeHandler.java ├── SqlTimeTypeHandler.java └── SqlTimestampTypeHandler.java ├── jdbc ├── package-info.java ├── SQL.java └── RuntimeSqlException.java ├── parsing ├── package-info.java ├── TokenHandler.java └── ParsingException.java ├── io └── package-info.java ├── reflection ├── package-info.java ├── invoker │ ├── package-info.java │ ├── Invoker.java │ └── SetFieldInvoker.java ├── factory │ └── package-info.java ├── wrapper │ ├── package-info.java │ ├── ObjectWrapperFactory.java │ └── DefaultObjectWrapperFactory.java ├── property │ └── package-info.java ├── ReflectorFactory.java ├── OptionalUtil.java ├── ReflectionException.java └── ParamNameUtil.java ├── cache ├── package-info.java ├── decorators │ └── package-info.java ├── impl │ └── package-info.java ├── NullCacheKey.java └── CacheException.java ├── logging ├── package-info.java ├── log4j │ └── package-info.java ├── log4j2 │ └── package-info.java ├── slf4j │ ├── package-info.java │ └── Slf4jLoggerImpl.java ├── stdout │ ├── package-info.java │ └── StdOutImpl.java ├── jdk14 │ └── package-info.java ├── nologging │ ├── package-info.java │ └── NoLoggingImpl.java ├── commons │ └── package-info.java ├── jdbc │ └── package-info.java ├── Log.java └── LogException.java ├── mapping ├── package-info.java ├── ResultFlag.java ├── FetchType.java ├── StatementType.java ├── ParameterMode.java ├── SqlCommandType.java ├── DefaultDatabaseIdProvider.java ├── SqlSource.java ├── ResultSetType.java └── DatabaseIdProvider.java ├── cursor ├── package-info.java └── defaults │ └── package-info.java ├── plugin ├── package-info.java ├── Signature.java ├── Intercepts.java ├── PluginException.java ├── Invocation.java └── Interceptor.java ├── scripting ├── package-info.java ├── defaults │ └── package-info.java ├── xmltags │ ├── package-info.java │ ├── SqlNode.java │ ├── StaticTextSqlNode.java │ ├── SetSqlNode.java │ ├── MixedSqlNode.java │ ├── WhereSqlNode.java │ ├── VarDeclSqlNode.java │ ├── OgnlClassResolver.java │ ├── ChooseSqlNode.java │ └── IfSqlNode.java └── ScriptingException.java ├── datasource ├── package-info.java ├── jndi │ └── package-info.java ├── unpooled │ └── package-info.java ├── pooled │ ├── package-info.java │ └── PooledDataSourceFactory.java ├── DataSourceFactory.java └── DataSourceException.java ├── exceptions ├── package-info.java ├── TooManyResultsException.java ├── PersistenceException.java ├── IbatisException.java └── ExceptionFactory.java ├── executor ├── package-info.java ├── keygen │ ├── package-info.java │ ├── KeyGenerator.java │ └── NoKeyGenerator.java ├── statement │ └── package-info.java ├── loader │ ├── cglib │ │ └── package-info.java │ ├── javassist │ │ └── package-info.java │ ├── package-info.java │ ├── CglibProxyFactory.java │ ├── JavassistProxyFactory.java │ ├── WriteReplaceInterface.java │ └── ProxyFactory.java ├── result │ ├── package-info.java │ ├── ResultMapException.java │ ├── DefaultResultHandler.java │ └── DefaultResultContext.java ├── resultset │ ├── package-info.java │ └── ResultSetHandler.java ├── parameter │ ├── package-info.java │ └── ParameterHandler.java ├── ExecutionPlaceholder.java └── ExecutorException.java ├── session ├── package-info.java ├── defaults │ └── package-info.java ├── ExecutorType.java ├── ResultHandler.java ├── LocalCacheScope.java ├── ResultContext.java ├── AutoMappingBehavior.java ├── TransactionIsolationLevel.java ├── SqlSessionException.java ├── RowBounds.java └── SqlSessionFactory.java ├── transaction ├── jdbc │ ├── package-info.java │ └── JdbcTransactionFactory.java ├── package-info.java ├── managed │ └── package-info.java └── TransactionException.java ├── binding ├── package-info.java └── BindingException.java ├── builder ├── package-info.java ├── xml │ └── package-info.java ├── annotation │ ├── package-info.java │ └── MethodResolver.java ├── InitializingObject.java ├── IncompleteElementException.java ├── BuilderException.java └── CacheRefResolver.java ├── annotations ├── package-info.java ├── Delete.java ├── Insert.java ├── MapKey.java ├── Select.java ├── Update.java ├── ResultMap.java ├── ConstructorArgs.java ├── Case.java ├── Many.java ├── One.java ├── Param.java ├── Lang.java ├── Flush.java ├── Results.java ├── AutomapConstructor.java ├── Mapper.java ├── Property.java ├── ResultType.java ├── SelectKey.java ├── TypeDiscriminator.java ├── Result.java ├── CacheNamespaceRef.java ├── Arg.java └── CacheNamespace.java ├── package-info.java └── lang ├── UsesJava7.java └── UsesJava8.java /pic/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeecode/MyBatisCN/HEAD/pic/demo.gif -------------------------------------------------------------------------------- /pic/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeecode/MyBatisCN/HEAD/pic/logo.png -------------------------------------------------------------------------------- /pic/book_info.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeecode/MyBatisCN/HEAD/pic/book_info.jpg -------------------------------------------------------------------------------- /pic/logo_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeecode/MyBatisCN/HEAD/pic/logo_large.png -------------------------------------------------------------------------------- /pic/logo_large.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeecode/MyBatisCN/HEAD/pic/logo_large.psd -------------------------------------------------------------------------------- /pic/logo_orgin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeecode/MyBatisCN/HEAD/pic/logo_orgin.jpg -------------------------------------------------------------------------------- /pic/mybatisCN_code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeecode/MyBatisCN/HEAD/pic/mybatisCN_code.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /*.iml 2 | /*.ipr 3 | /*.iws 4 | /.classpath 5 | /.factorypath 6 | /.idea 7 | /.project 8 | /.settings 9 | /nb* 10 | /release.properties 11 | /target 12 | 13 | # These are needed if running in IDE without properties set 14 | /ibderby 15 | derby.log 16 | /bin/ 17 | .mvn/wrapper/maven-wrapper.jar 18 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/type/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Type handlers. 18 | */ 19 | package org.apache.ibatis.type; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/jdbc/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2018 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 | /** 17 | * Utilities for JDBC. 18 | */ 19 | package org.apache.ibatis.jdbc; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/parsing/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Parsing utils 18 | */ 19 | package org.apache.ibatis.parsing; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/io/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Utilities to read resources. 18 | */ 19 | package org.apache.ibatis.io; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/reflection/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Reflection utils. 18 | */ 19 | package org.apache.ibatis.reflection; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/cache/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Base package for caching stuff 18 | */ 19 | package org.apache.ibatis.cache; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/logging/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2018 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 | /** 17 | * Base package for logging. 18 | */ 19 | package org.apache.ibatis.logging; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/mapping/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2018 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 | /** 17 | * Base package for mapping. 18 | */ 19 | package org.apache.ibatis.mapping; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/cursor/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 | /** 17 | * Base package for cursor feature 18 | */ 19 | package org.apache.ibatis.cursor; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/plugin/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Base package for handing plugins. 18 | */ 19 | package org.apache.ibatis.plugin; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/reflection/invoker/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Unused. 18 | */ 19 | package org.apache.ibatis.reflection.invoker; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/scripting/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Base package for languages. 18 | */ 19 | package org.apache.ibatis.scripting; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/datasource/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Base package for Datasources 18 | */ 19 | package org.apache.ibatis.datasource; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/exceptions/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Base package for exceptions. 18 | */ 19 | package org.apache.ibatis.exceptions; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Contains the statement executors. 18 | */ 19 | package org.apache.ibatis.executor; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/reflection/factory/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Object factory. 18 | */ 19 | package org.apache.ibatis.reflection.factory; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/reflection/wrapper/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Object wrappers. 18 | */ 19 | package org.apache.ibatis.reflection.wrapper; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/session/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Base package. Contains the SqlSession. 18 | */ 19 | package org.apache.ibatis.session; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/transaction/jdbc/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * JDBC transaction. 18 | */ 19 | package org.apache.ibatis.transaction.jdbc; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/transaction/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Base package for transactions. 18 | */ 19 | package org.apache.ibatis.transaction; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/cache/decorators/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Contains cache decorators 18 | */ 19 | package org.apache.ibatis.cache.decorators; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/datasource/jndi/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * JNDI Datasource factory 18 | */ 19 | package org.apache.ibatis.datasource.jndi; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/keygen/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Contains the key generators 18 | */ 19 | package org.apache.ibatis.executor.keygen; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/statement/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Statement handlers. 18 | */ 19 | package org.apache.ibatis.executor.statement; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/logging/log4j/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2018 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 | /** 17 | * logger using Log4J feature. 18 | */ 19 | package org.apache.ibatis.logging.log4j; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/logging/log4j2/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2018 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 | /** 17 | * logger using Log4J 2 feature. 18 | */ 19 | package org.apache.ibatis.logging.log4j2; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/logging/slf4j/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2018 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 | /** 17 | * logger using SLF4J feature. 18 | */ 19 | package org.apache.ibatis.logging.slf4j; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/logging/stdout/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2018 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 | /** 17 | * logger using standard out. 18 | */ 19 | package org.apache.ibatis.logging.stdout; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/binding/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Bings mapper interfaces with mapped statements 18 | */ 19 | package org.apache.ibatis.binding; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/builder/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Base package for the Configuration building code 18 | */ 19 | package org.apache.ibatis.builder; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/cache/impl/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Contains the default cache implementation 18 | */ 19 | package org.apache.ibatis.cache.impl; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/datasource/unpooled/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Hyper-simple Datasource. 18 | */ 19 | package org.apache.ibatis.datasource.unpooled; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/loader/cglib/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * CGLIB proxy factory 18 | */ 19 | package org.apache.ibatis.executor.loader.cglib; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/result/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Contains the result handlers. 18 | */ 19 | package org.apache.ibatis.executor.result; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/logging/jdk14/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2018 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 | /** 17 | * logger using JDK logging feature. 18 | */ 19 | package org.apache.ibatis.logging.jdk14; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/logging/nologging/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2018 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 | /** 17 | * logger for no operation. 18 | */ 19 | package org.apache.ibatis.logging.nologging; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/session/defaults/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Default impl for SqlSession. 18 | */ 19 | package org.apache.ibatis.session.defaults; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/transaction/managed/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * External transaction. 18 | */ 19 | package org.apache.ibatis.transaction.managed; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/builder/xml/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Parses XML files to create a Configuration 18 | */ 19 | package org.apache.ibatis.builder.xml; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/logging/commons/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2018 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 | /** 17 | * logger using Commons Logging feature. 18 | */ 19 | package org.apache.ibatis.logging.commons; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/scripting/defaults/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Default beans for languages. 18 | */ 19 | package org.apache.ibatis.scripting.defaults; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/scripting/xmltags/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Default XML MyBatis language. 18 | */ 19 | package org.apache.ibatis.scripting.xmltags; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/cursor/defaults/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 | /** 17 | * Default implementation for cursor feature 18 | */ 19 | package org.apache.ibatis.cursor.defaults; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/datasource/pooled/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Simple single-thread pooled datasource 18 | */ 19 | package org.apache.ibatis.datasource.pooled; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/resultset/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Contains the result processing logic 18 | */ 19 | package org.apache.ibatis.executor.resultset; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/logging/jdbc/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Logging proxies that logs any JDBC statement. 18 | */ 19 | package org.apache.ibatis.logging.jdbc; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/loader/javassist/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Javassist proxy factory 18 | */ 19 | package org.apache.ibatis.executor.loader.javassist; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/loader/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Base package for loading results into beans 18 | */ 19 | package org.apache.ibatis.executor.loader; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/parameter/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Base package for handling parameters. 18 | */ 19 | package org.apache.ibatis.executor.parameter; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/reflection/property/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Tools for getting/setting properties 18 | */ 19 | package org.apache.ibatis.reflection.property; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/builder/annotation/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Parses annotions to create a Configuration 18 | */ 19 | package org.apache.ibatis.builder.annotation; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * Contains all the annotation that are used in mapper interfaces 18 | */ 19 | package org.apache.ibatis.annotations; 20 | 21 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/mapping/ResultFlag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.mapping; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | public enum ResultFlag { 22 | ID, CONSTRUCTOR 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/mapping/FetchType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.mapping; 17 | 18 | /** 19 | * @author Eduardo Macarron 20 | */ 21 | public enum FetchType { 22 | LAZY, EAGER, DEFAULT 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 | /** 17 | * The MyBatis data mapper framework makes it easier to use a relational database with object-oriented applications. 18 | */ 19 | package org.apache.ibatis; 20 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/mapping/StatementType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.mapping; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | public enum StatementType { 22 | STATEMENT, PREPARED, CALLABLE 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/ExecutionPlaceholder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.executor; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | public enum ExecutionPlaceholder { 22 | EXECUTION_PLACEHOLDER 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/mapping/ParameterMode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.mapping; 17 | 18 | /** 19 | * @author Clinton Begin 20 | * 表明参数的类型,输入还是输出 21 | */ 22 | public enum ParameterMode { 23 | IN, OUT, INOUT 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/parsing/TokenHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.parsing; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | public interface TokenHandler { 22 | String handleToken(String content); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/mapping/SqlCommandType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.mapping; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | public enum SqlCommandType { 22 | UNKNOWN, INSERT, UPDATE, DELETE, SELECT, FLUSH; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/mapping/DefaultDatabaseIdProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.mapping; 17 | 18 | /** 19 | * @author Eduardo Macarron 20 | */ 21 | @Deprecated 22 | public class DefaultDatabaseIdProvider extends VendorDatabaseIdProvider { 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/session/ExecutorType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.session; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | public enum ExecutorType { 22 | 23 | SIMPLE, // 为每个语句创建新的预处理语句 24 | REUSE, // 复用 25 | BATCH // 执行批量操作 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/jdbc/SQL.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.jdbc; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | public class SQL extends AbstractSQL { 22 | 23 | @Override 24 | public SQL getSelf() { 25 | return this; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/session/ResultHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.session; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | public interface ResultHandler { 22 | 23 | void handleResult(ResultContext resultContext); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/session/LocalCacheScope.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.session; 17 | 18 | /** 19 | * @author Eduardo Macarron 20 | */ 21 | // 本地缓存作用域 22 | public enum LocalCacheScope { 23 | SESSION, // 本地缓存的作用域为一次回话 24 | STATEMENT // 本地缓存的作用域为一条语句,也就是不进行任何缓存 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/loader/CglibProxyFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.executor.loader; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | @Deprecated 22 | public class CglibProxyFactory extends org.apache.ibatis.executor.loader.cglib.CglibProxyFactory { 23 | /* no-op */ 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/session/ResultContext.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.session; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | public interface ResultContext { 22 | 23 | T getResultObject(); 24 | 25 | int getResultCount(); 26 | 27 | boolean isStopped(); 28 | 29 | void stop(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/loader/JavassistProxyFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.executor.loader; 17 | 18 | /** 19 | * @author Eduardo Macarron 20 | */ 21 | @Deprecated 22 | public final class JavassistProxyFactory extends org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory { 23 | /* no-op */ 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/loader/WriteReplaceInterface.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.executor.loader; 17 | 18 | import java.io.ObjectStreamException; 19 | 20 | /** 21 | * @author Eduardo Macarron 22 | */ 23 | public interface WriteReplaceInterface { 24 | 25 | Object writeReplace() throws ObjectStreamException; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/reflection/ReflectorFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.reflection; 17 | 18 | /** 19 | * 工厂接口 20 | */ 21 | public interface ReflectorFactory { 22 | 23 | boolean isClassCacheEnabled(); 24 | 25 | void setClassCacheEnabled(boolean classCacheEnabled); 26 | 27 | Reflector findForClass(Class type); 28 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/reflection/wrapper/ObjectWrapperFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.reflection.wrapper; 17 | 18 | import org.apache.ibatis.reflection.MetaObject; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public interface ObjectWrapperFactory { 24 | 25 | boolean hasWrapperFor(Object object); 26 | 27 | ObjectWrapper getWrapperFor(MetaObject metaObject, Object object); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/scripting/xmltags/SqlNode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.scripting.xmltags; 17 | 18 | /** 19 | * @author Clinton Begin 20 | * 在我们写动态的SQL语句时, 这些就是sqlNode 21 | */ 22 | public interface SqlNode { 23 | 24 | /** 25 | * 完成该节点自身的解析 26 | * @param context 上下文环境,节点自身的解析结果将合并到该上下文环境中 27 | * @return 解析是否成功 28 | */ 29 | boolean apply(DynamicContext context); 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/logging/Log.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.logging; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | public interface Log { 22 | 23 | boolean isDebugEnabled(); 24 | 25 | boolean isTraceEnabled(); 26 | 27 | void error(String s, Throwable e); 28 | 29 | void error(String s); 30 | 31 | void debug(String s); 32 | 33 | void trace(String s); 34 | 35 | void warn(String s); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/reflection/invoker/Invoker.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.reflection.invoker; 17 | 18 | import java.lang.reflect.InvocationTargetException; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public interface Invoker { 24 | // 方法执行调用器 25 | Object invoke(Object target, Object[] args) throws IllegalAccessException, InvocationTargetException; 26 | // 传入参数或者传出参数的类型(如有一个入参就是入参,否则是出参) 27 | Class getType(); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/reflection/OptionalUtil.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2018 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 | 17 | package org.apache.ibatis.reflection; 18 | 19 | import java.util.Optional; 20 | 21 | /** 22 | * @deprecated Since 3.5.0, Will remove this class at future(next major version up). 23 | */ 24 | @Deprecated 25 | public abstract class OptionalUtil { 26 | 27 | public static Object ofNullable(Object value) { 28 | return Optional.ofNullable(value); 29 | } 30 | 31 | private OptionalUtil() { 32 | super(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/datasource/pooled/PooledDataSourceFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.datasource.pooled; 17 | 18 | import org.apache.ibatis.datasource.unpooled.UnpooledDataSourceFactory; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public class PooledDataSourceFactory extends UnpooledDataSourceFactory { 24 | 25 | // 唯一却别就是这里,其他全都继承UnpooledDataSourceFactory 26 | public PooledDataSourceFactory() { 27 | this.dataSource = new PooledDataSource(); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/datasource/DataSourceFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.datasource; 17 | 18 | import java.util.Properties; 19 | import javax.sql.DataSource; 20 | 21 | /** 22 | * @author Clinton Begin 23 | */ 24 | public interface DataSourceFactory { 25 | 26 | /** 27 | * 设置工厂属性 28 | * @param props 属性 29 | */ 30 | void setProperties(Properties props); 31 | 32 | 33 | /** 34 | * 从工厂中获取产品 35 | * @return DataSource对象 36 | */ 37 | DataSource getDataSource(); 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/type/Alias.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.type; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * @author Clinton Begin 26 | */ 27 | @Documented 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.TYPE) 30 | public @interface Alias { 31 | String value(); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/parameter/ParameterHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.executor.parameter; 17 | 18 | import java.sql.PreparedStatement; 19 | import java.sql.SQLException; 20 | 21 | /** 22 | * A parameter handler sets the parameters of the {@code PreparedStatement}. 23 | * 24 | * @author Clinton Begin 25 | */ 26 | public interface ParameterHandler { 27 | 28 | Object getParameterObject(); 29 | 30 | void setParameters(PreparedStatement ps) 31 | throws SQLException; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/plugin/Signature.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.plugin; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | /** 24 | * @author Clinton Begin 25 | */ 26 | @Documented 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Target({}) 29 | public @interface Signature { 30 | Class type(); 31 | 32 | String method(); 33 | 34 | Class[] args(); 35 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/Delete.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * @author Clinton Begin 26 | */ 27 | @Documented 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.METHOD) 30 | public @interface Delete { 31 | String[] value(); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/Insert.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * @author Clinton Begin 26 | */ 27 | @Documented 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.METHOD) 30 | public @interface Insert { 31 | String[] value(); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/MapKey.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * @author Clinton Begin 26 | */ 27 | @Documented 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.METHOD) 30 | public @interface MapKey { 31 | String value(); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/Select.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * @author Clinton Begin 26 | */ 27 | @Documented 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.METHOD) 30 | public @interface Select { 31 | String[] value(); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/Update.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * @author Clinton Begin 26 | */ 27 | @Documented 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.METHOD) 30 | public @interface Update { 31 | String[] value(); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/type/MappedTypes.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.type; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * @author Eduardo Macarron 26 | */ 27 | @Documented 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.TYPE) 30 | public @interface MappedTypes { 31 | Class[] value(); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/ResultMap.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * @author Jeff Butler 26 | */ 27 | @Documented 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.METHOD) 30 | public @interface ResultMap { 31 | String[] value(); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/plugin/Intercepts.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.plugin; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * @author Clinton Begin 26 | */ 27 | @Documented 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.TYPE) 30 | public @interface Intercepts { 31 | Signature[] value(); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/ConstructorArgs.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * @author Clinton Begin 26 | */ 27 | @Documented 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.METHOD) 30 | public @interface ConstructorArgs { 31 | Arg[] value() default {}; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/scripting/xmltags/StaticTextSqlNode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2017 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 org.apache.ibatis.scripting.xmltags; 17 | 18 | /** 19 | * @author Clinton Begin 20 | * 21 | * 静态的SQL节点,直接追加到sql尾部即可 22 | */ 23 | public class StaticTextSqlNode implements SqlNode { 24 | private final String text; 25 | 26 | public StaticTextSqlNode(String text) { 27 | this.text = text; 28 | } 29 | 30 | @Override 31 | // 最终调用到这里,将节点内容拼接到context后面 32 | public boolean apply(DynamicContext context) { 33 | context.appendSql(text); 34 | return true; 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/Case.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | /** 24 | * @author Clinton Begin 25 | */ 26 | @Documented 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Target({}) 29 | public @interface Case { 30 | String value(); 31 | 32 | Class type(); 33 | 34 | Result[] results() default {}; 35 | 36 | Arg[] constructArgs() default {}; 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/lang/UsesJava7.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2017 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 org.apache.ibatis.lang; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | *

26 | * Indicates that the element uses Java 7 API. 27 | *

28 | */ 29 | @Documented 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target({ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD }) 32 | public @interface UsesJava7 { 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/lang/UsesJava8.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2017 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 org.apache.ibatis.lang; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | *

26 | * Indicates that the element uses Java 8 API. 27 | *

28 | */ 29 | @Documented 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target({ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD }) 32 | public @interface UsesJava8 { 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/type/MappedJdbcTypes.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.type; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * @author Eduardo Macarron 26 | */ 27 | @Documented 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.TYPE) 30 | public @interface MappedJdbcTypes { 31 | JdbcType[] value(); 32 | boolean includeNullJdbcType() default false; 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/Many.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | import org.apache.ibatis.mapping.FetchType; 24 | 25 | /** 26 | * @author Clinton Begin 27 | */ 28 | @Documented 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Target({}) 31 | public @interface Many { 32 | String select() default ""; 33 | 34 | FetchType fetchType() default FetchType.DEFAULT; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/One.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | import org.apache.ibatis.mapping.FetchType; 24 | 25 | /** 26 | * @author Clinton Begin 27 | */ 28 | @Documented 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Target({}) 31 | public @interface One { 32 | String select() default ""; 33 | 34 | FetchType fetchType() default FetchType.DEFAULT; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/keygen/KeyGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.executor.keygen; 17 | 18 | import java.sql.Statement; 19 | 20 | import org.apache.ibatis.executor.Executor; 21 | import org.apache.ibatis.mapping.MappedStatement; 22 | 23 | /** 24 | * @author Clinton Begin 25 | */ 26 | // 用于实现数据插入时主键自增的主键编号生成器 27 | public interface KeyGenerator { 28 | 29 | void processBefore(Executor executor, MappedStatement ms, Statement stmt, Object parameter); 30 | 31 | void processAfter(Executor executor, MappedStatement ms, Statement stmt, Object parameter); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/scripting/xmltags/SetSqlNode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2018 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 org.apache.ibatis.scripting.xmltags; 17 | 18 | import java.util.Collections; 19 | import java.util.List; 20 | 21 | import org.apache.ibatis.session.Configuration; 22 | 23 | /** 24 | * @author Clinton Begin 25 | */ 26 | public class SetSqlNode extends TrimSqlNode { 27 | 28 | private static final List COMMA = Collections.singletonList(","); 29 | 30 | public SetSqlNode(Configuration configuration,SqlNode contents) { 31 | super(configuration, contents, "SET", COMMA, null, COMMA); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/Param.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * @author Clinton Begin 26 | */ 27 | @Documented // 表明该注解会保留在API文档中 28 | @Retention(RetentionPolicy.RUNTIME) // 表明注解会保留到运行阶段 29 | @Target(ElementType.PARAMETER) // 表明注解可以应用在参数上 30 | public @interface Param { 31 | String value(); // 整个注解只有一个属性,名为value 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/Lang.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | import org.apache.ibatis.scripting.LanguageDriver; 25 | 26 | /** 27 | * @author Clinton Begin 28 | */ 29 | @Documented 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target(ElementType.METHOD) 32 | public @interface Lang { 33 | Class value(); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/scripting/xmltags/MixedSqlNode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.scripting.xmltags; 17 | 18 | import java.util.List; 19 | 20 | /** 21 | * @author Clinton Begin 22 | * 23 | * 符合节点,需要将节点内的内容循环加到尾部 24 | * 25 | */ 26 | public class MixedSqlNode implements SqlNode { 27 | private final List contents; 28 | 29 | public MixedSqlNode(List contents) { 30 | this.contents = contents; 31 | } 32 | 33 | @Override 34 | public boolean apply(DynamicContext context) { 35 | contents.forEach(node -> node.apply(context)); 36 | return true; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/Flush.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * The maker annotation that invoke a flush statements via Mapper interface. 26 | * 27 | * @since 3.3.0 28 | * @author Kazuki Shimizu 29 | */ 30 | @Documented 31 | @Retention(RetentionPolicy.RUNTIME) 32 | @Target(ElementType.METHOD) 33 | public @interface Flush { 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/mapping/SqlSource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.mapping; 17 | 18 | /** 19 | * Represents the content of a mapped statement read from an XML file or an annotation. 20 | * It creates the SQL that will be passed to the database out of the input parameter received from the user. 21 | * 22 | * @author Clinton Begin 23 | */ 24 | 25 | /** 26 | * 一共有四个实现 27 | */ 28 | public interface SqlSource { 29 | 30 | /** 31 | * 获取一个BoundSql对象 32 | * @param parameterObject 参数对象 33 | * @return BoundSql对象 34 | */ 35 | BoundSql getBoundSql(Object parameterObject); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/Results.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * @author Clinton Begin 26 | */ 27 | @Documented 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.METHOD) 30 | public @interface Results { 31 | /** 32 | * The name of the result map. 33 | */ 34 | String id() default ""; 35 | Result[] value() default {}; 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/builder/InitializingObject.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.builder; 17 | 18 | /** 19 | * Interface that indicate to provide a initialization method. 20 | * 21 | * @since 3.4.2 22 | * @author Kazuki Shimizu 23 | */ 24 | public interface InitializingObject { 25 | 26 | /** 27 | * Initialize a instance. 28 | *

29 | * This method will be invoked after it has set all properties. 30 | *

31 | * @throws Exception in the event of misconfiguration (such as failure to set an essential property) or if initialization fails 32 | */ 33 | void initialize() throws Exception; 34 | 35 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/AutomapConstructor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2017 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * The marker annotation that indicate a constructor for automatic mapping. 26 | * 27 | * @author Tim Chen 28 | * @since 3.4.3 29 | */ 30 | @Documented 31 | @Retention(RetentionPolicy.RUNTIME) 32 | @Target({ElementType.CONSTRUCTOR}) 33 | public @interface AutomapConstructor { 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/scripting/xmltags/WhereSqlNode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.scripting.xmltags; 17 | 18 | import java.util.Arrays; 19 | import java.util.List; 20 | 21 | import org.apache.ibatis.session.Configuration; 22 | 23 | /** 24 | * @author Clinton Begin 25 | */ 26 | public class WhereSqlNode extends TrimSqlNode { 27 | 28 | private static List prefixList = Arrays.asList("AND ","OR ","AND\n", "OR\n", "AND\r", "OR\r", "AND\t", "OR\t"); 29 | 30 | public WhereSqlNode(Configuration configuration, SqlNode contents) { 31 | super(configuration, contents, "WHERE", prefixList, null, null); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/cache/NullCacheKey.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.cache; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | public final class NullCacheKey extends CacheKey { 22 | 23 | private static final long serialVersionUID = 3704229911977019465L; 24 | 25 | public NullCacheKey() { 26 | super(); 27 | } 28 | 29 | @Override 30 | public void update(Object object) { 31 | throw new CacheException("Not allowed to update a NullCacheKey instance."); 32 | } 33 | 34 | @Override 35 | public void updateAll(Object[] objects) { 36 | throw new CacheException("Not allowed to update a NullCacheKey instance."); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/jdbc/RuntimeSqlException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.jdbc; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | public class RuntimeSqlException extends RuntimeException { 22 | 23 | private static final long serialVersionUID = 5224696788505678598L; 24 | 25 | public RuntimeSqlException() { 26 | super(); 27 | } 28 | 29 | public RuntimeSqlException(String message) { 30 | super(message); 31 | } 32 | 33 | public RuntimeSqlException(String message, Throwable cause) { 34 | super(message, cause); 35 | } 36 | 37 | public RuntimeSqlException(Throwable cause) { 38 | super(cause); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/scripting/xmltags/VarDeclSqlNode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.scripting.xmltags; 17 | 18 | /** 19 | * @author Frank D. Martinez [mnesarco] 20 | */ 21 | public class VarDeclSqlNode implements SqlNode { 22 | 23 | private final String name; 24 | private final String expression; 25 | 26 | public VarDeclSqlNode(String var, String exp) { 27 | name = var; 28 | expression = exp; 29 | } 30 | 31 | @Override 32 | public boolean apply(DynamicContext context) { 33 | final Object value = OgnlCache.getValue(expression, context.getBindings()); 34 | context.bind(name, value); 35 | return true; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/exceptions/TooManyResultsException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.exceptions; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | public class TooManyResultsException extends PersistenceException { 22 | 23 | private static final long serialVersionUID = 8935197089745865786L; 24 | 25 | public TooManyResultsException() { 26 | super(); 27 | } 28 | 29 | public TooManyResultsException(String message) { 30 | super(message); 31 | } 32 | 33 | public TooManyResultsException(String message, Throwable cause) { 34 | super(message, cause); 35 | } 36 | 37 | public TooManyResultsException(Throwable cause) { 38 | super(cause); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/logging/LogException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.logging; 17 | 18 | import org.apache.ibatis.exceptions.PersistenceException; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public class LogException extends PersistenceException { 24 | 25 | private static final long serialVersionUID = 1022924004852350942L; 26 | 27 | public LogException() { 28 | super(); 29 | } 30 | 31 | public LogException(String message) { 32 | super(message); 33 | } 34 | 35 | public LogException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | public LogException(Throwable cause) { 40 | super(cause); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/session/AutoMappingBehavior.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.session; 17 | 18 | /** 19 | * Specifies if and how MyBatis should automatically map columns to fields/properties. 20 | * 21 | * @author Eduardo Macarron 22 | */ 23 | // 自动映射选项 24 | public enum AutoMappingBehavior { 25 | 26 | /** 27 | * Disables auto-mapping. 28 | */ 29 | // 关闭自动映射 30 | NONE, 31 | 32 | /** 33 | * Will only auto-map results with no nested result mappings defined inside. 34 | */ 35 | // 仅仅自动映射单层属性 36 | PARTIAL, 37 | 38 | /** 39 | * Will auto-map result mappings of any complexity (containing nested or otherwise). 40 | */ 41 | // 映射所有属性,含嵌套属性 42 | FULL 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/type/TypeException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.type; 17 | 18 | import org.apache.ibatis.exceptions.PersistenceException; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public class TypeException extends PersistenceException { 24 | 25 | private static final long serialVersionUID = 8614420898975117130L; 26 | 27 | public TypeException() { 28 | super(); 29 | } 30 | 31 | public TypeException(String message) { 32 | super(message); 33 | } 34 | 35 | public TypeException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | public TypeException(Throwable cause) { 40 | super(cause); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/mapping/ResultSetType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2018 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 org.apache.ibatis.mapping; 17 | 18 | import java.sql.ResultSet; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public enum ResultSetType { 24 | /** 25 | * behavior with same as unset (driver dependent). 26 | * 27 | * @since 3.5.0 28 | */ 29 | DEFAULT(-1), 30 | FORWARD_ONLY(ResultSet.TYPE_FORWARD_ONLY), 31 | SCROLL_INSENSITIVE(ResultSet.TYPE_SCROLL_INSENSITIVE), 32 | SCROLL_SENSITIVE(ResultSet.TYPE_SCROLL_SENSITIVE); 33 | 34 | private final int value; 35 | 36 | ResultSetType(int value) { 37 | this.value = value; 38 | } 39 | 40 | public int getValue() { 41 | return value; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/Mapper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Inherited; 21 | import java.lang.annotation.Retention; 22 | import java.lang.annotation.RetentionPolicy; 23 | import java.lang.annotation.Target; 24 | 25 | /** 26 | * Marker interface for MyBatis mappers 27 | * 28 | * @author Frank David Martínez 29 | */ 30 | @Documented 31 | @Inherited 32 | @Retention(RetentionPolicy.RUNTIME) 33 | @Target({ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER }) 34 | public @interface Mapper { 35 | // Interface Mapper 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/builder/IncompleteElementException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.builder; 17 | 18 | /** 19 | * @author Eduardo Macarron 20 | */ 21 | public class IncompleteElementException extends BuilderException { 22 | private static final long serialVersionUID = -3697292286890900315L; 23 | 24 | public IncompleteElementException() { 25 | super(); 26 | } 27 | 28 | public IncompleteElementException(String message, Throwable cause) { 29 | super(message, cause); 30 | } 31 | 32 | public IncompleteElementException(String message) { 33 | super(message); 34 | } 35 | 36 | public IncompleteElementException(Throwable cause) { 37 | super(cause); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/plugin/PluginException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.plugin; 17 | 18 | import org.apache.ibatis.exceptions.PersistenceException; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public class PluginException extends PersistenceException { 24 | 25 | private static final long serialVersionUID = 8548771664564998595L; 26 | 27 | public PluginException() { 28 | super(); 29 | } 30 | 31 | public PluginException(String message) { 32 | super(message); 33 | } 34 | 35 | public PluginException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | public PluginException(Throwable cause) { 40 | super(cause); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/exceptions/PersistenceException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.exceptions; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | @SuppressWarnings("deprecation") 22 | public class PersistenceException extends IbatisException { 23 | 24 | private static final long serialVersionUID = -7537395265357977271L; 25 | 26 | public PersistenceException() { 27 | super(); 28 | } 29 | 30 | public PersistenceException(String message) { 31 | super(message); 32 | } 33 | 34 | public PersistenceException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | 38 | public PersistenceException(Throwable cause) { 39 | super(cause); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/parsing/ParsingException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.parsing; 17 | 18 | import org.apache.ibatis.exceptions.PersistenceException; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public class ParsingException extends PersistenceException { 24 | private static final long serialVersionUID = -176685891441325943L; 25 | 26 | public ParsingException() { 27 | super(); 28 | } 29 | 30 | public ParsingException(String message) { 31 | super(message); 32 | } 33 | 34 | public ParsingException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | 38 | public ParsingException(Throwable cause) { 39 | super(cause); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/binding/BindingException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.binding; 17 | 18 | import org.apache.ibatis.exceptions.PersistenceException; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public class BindingException extends PersistenceException { 24 | 25 | private static final long serialVersionUID = 4300802238789381562L; 26 | 27 | public BindingException() { 28 | super(); 29 | } 30 | 31 | public BindingException(String message) { 32 | super(message); 33 | } 34 | 35 | public BindingException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | public BindingException(Throwable cause) { 40 | super(cause); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/builder/BuilderException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.builder; 17 | 18 | import org.apache.ibatis.exceptions.PersistenceException; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public class BuilderException extends PersistenceException { 24 | 25 | private static final long serialVersionUID = -3885164021020443281L; 26 | 27 | public BuilderException() { 28 | super(); 29 | } 30 | 31 | public BuilderException(String message) { 32 | super(message); 33 | } 34 | 35 | public BuilderException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | public BuilderException(Throwable cause) { 40 | super(cause); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/builder/annotation/MethodResolver.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2017 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 org.apache.ibatis.builder.annotation; 17 | 18 | import java.lang.reflect.Method; 19 | 20 | /** 21 | * @author Eduardo Macarron 22 | * 23 | * 封装了解析器和方法 24 | * 因此这是一个具有了方法解析功能的方法包装类 25 | * 26 | */ 27 | public class MethodResolver { 28 | private final MapperAnnotationBuilder annotationBuilder; 29 | // 带了注解的,要处理的方法 30 | private final Method method; 31 | 32 | public MethodResolver(MapperAnnotationBuilder annotationBuilder, Method method) { 33 | this.annotationBuilder = annotationBuilder; 34 | this.method = method; 35 | } 36 | 37 | public void resolve() { 38 | annotationBuilder.parseStatement(method); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/exceptions/IbatisException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.exceptions; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | @Deprecated 22 | public class IbatisException extends RuntimeException { 23 | 24 | // 序列化标志。因为它是Throwable的子类,Throwable是可序列化的。 25 | private static final long serialVersionUID = 3880206998166270511L; 26 | 27 | public IbatisException() { 28 | super(); 29 | } 30 | 31 | public IbatisException(String message) { 32 | super(message); 33 | } 34 | 35 | public IbatisException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | public IbatisException(Throwable cause) { 40 | super(cause); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/loader/ProxyFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.executor.loader; 17 | 18 | import java.util.List; 19 | import java.util.Properties; 20 | 21 | import org.apache.ibatis.reflection.factory.ObjectFactory; 22 | import org.apache.ibatis.session.Configuration; 23 | 24 | /** 25 | * @author Eduardo Macarron 26 | */ 27 | public interface ProxyFactory { 28 | 29 | // 设置工厂属性 30 | default void setProperties(Properties properties) { 31 | // NOP 32 | } 33 | 34 | // 创建代理对象 35 | Object createProxy(Object target, ResultLoaderMap lazyLoader, Configuration configuration, ObjectFactory objectFactory, List> constructorArgTypes, List constructorArgs); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/result/ResultMapException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.executor.result; 17 | 18 | import org.apache.ibatis.exceptions.PersistenceException; 19 | 20 | /** 21 | * @author Ryan Lamore 22 | */ 23 | public class ResultMapException extends PersistenceException { 24 | private static final long serialVersionUID = 3270932060569707623L; 25 | 26 | public ResultMapException() { 27 | } 28 | 29 | public ResultMapException(String message) { 30 | super(message); 31 | } 32 | 33 | public ResultMapException(String message, Throwable cause) { 34 | super(message, cause); 35 | } 36 | 37 | public ResultMapException(Throwable cause) { 38 | super(cause); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/Property.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | /** 24 | * The annotation that inject a property value. 25 | * 26 | * @since 3.4.2 27 | * @author Kazuki Shimizu 28 | * @see CacheNamespace 29 | */ 30 | @Documented 31 | @Retention(RetentionPolicy.RUNTIME) 32 | @Target({}) 33 | public @interface Property { 34 | 35 | /** 36 | * A target property name. 37 | */ 38 | String name(); 39 | 40 | /** 41 | * A property value or placeholder. 42 | */ 43 | String value(); 44 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/session/TransactionIsolationLevel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2018 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 org.apache.ibatis.session; 17 | 18 | import java.sql.Connection; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public enum TransactionIsolationLevel { 24 | NONE(Connection.TRANSACTION_NONE), 25 | READ_COMMITTED(Connection.TRANSACTION_READ_COMMITTED), 26 | READ_UNCOMMITTED(Connection.TRANSACTION_READ_UNCOMMITTED), 27 | REPEATABLE_READ(Connection.TRANSACTION_REPEATABLE_READ), 28 | SERIALIZABLE(Connection.TRANSACTION_SERIALIZABLE); 29 | 30 | private final int level; 31 | 32 | TransactionIsolationLevel(int level) { 33 | this.level = level; 34 | } 35 | 36 | public int getLevel() { 37 | return level; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/exceptions/ExceptionFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.exceptions; 17 | 18 | import org.apache.ibatis.executor.ErrorContext; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public class ExceptionFactory { 24 | 25 | // 不允许实例化该类 26 | private ExceptionFactory() { 27 | // Prevent Instantiation 28 | } 29 | 30 | // 静态方法,直接调用 31 | 32 | /** 33 | * 生成一个RuntimeException异常 34 | * @param message 异常信息 35 | * @param e 异常 36 | * @return 新的RuntimeException异常 37 | */ 38 | public static RuntimeException wrapException(String message, Exception e) { 39 | return new PersistenceException(ErrorContext.instance().message(message).cause(e).toString(), e); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/ExecutorException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.executor; 17 | 18 | import org.apache.ibatis.exceptions.PersistenceException; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public class ExecutorException extends PersistenceException { 24 | 25 | private static final long serialVersionUID = 4060977051977364820L; 26 | 27 | public ExecutorException() { 28 | super(); 29 | } 30 | 31 | public ExecutorException(String message) { 32 | super(message); 33 | } 34 | 35 | public ExecutorException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | public ExecutorException(Throwable cause) { 40 | super(cause); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/reflection/wrapper/DefaultObjectWrapperFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.reflection.wrapper; 17 | 18 | import org.apache.ibatis.reflection.MetaObject; 19 | import org.apache.ibatis.reflection.ReflectionException; 20 | 21 | /** 22 | * @author Clinton Begin 23 | */ 24 | public class DefaultObjectWrapperFactory implements ObjectWrapperFactory { 25 | 26 | @Override 27 | public boolean hasWrapperFor(Object object) { 28 | return false; 29 | } 30 | 31 | @Override 32 | public ObjectWrapper getWrapperFor(MetaObject metaObject, Object object) { 33 | throw new ReflectionException("The DefaultObjectWrapperFactory should never be called to provide an ObjectWrapper."); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/session/SqlSessionException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.session; 17 | 18 | import org.apache.ibatis.exceptions.PersistenceException; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public class SqlSessionException extends PersistenceException { 24 | 25 | private static final long serialVersionUID = 3833184690240265047L; 26 | 27 | public SqlSessionException() { 28 | super(); 29 | } 30 | 31 | public SqlSessionException(String message) { 32 | super(message); 33 | } 34 | 35 | public SqlSessionException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | public SqlSessionException(Throwable cause) { 40 | super(cause); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/resultset/ResultSetHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.executor.resultset; 17 | 18 | import java.sql.CallableStatement; 19 | import java.sql.SQLException; 20 | import java.sql.Statement; 21 | import java.util.List; 22 | 23 | import org.apache.ibatis.cursor.Cursor; 24 | 25 | /** 26 | * @author Clinton Begin 27 | */ 28 | public interface ResultSetHandler { 29 | 30 | // 将Statement的执行结果处理为List 31 | List handleResultSets(Statement stmt) throws SQLException; 32 | 33 | // 将Statement的执行结果处理为Map 34 | Cursor handleCursorResultSets(Statement stmt) throws SQLException; 35 | 36 | // 处理存储过程的输出结果 37 | void handleOutputParameters(CallableStatement cs) throws SQLException; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/cache/CacheException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.cache; 17 | 18 | import org.apache.ibatis.exceptions.PersistenceException; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public class CacheException extends PersistenceException { 24 | 25 | private static final long serialVersionUID = -193202262468464650L; 26 | 27 | // 方法一 28 | public CacheException() { 29 | super(); 30 | } 31 | // 方法二 32 | public CacheException(String message) { 33 | super(message); 34 | } 35 | // 方法三 36 | public CacheException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | // 方法四 40 | public CacheException(Throwable cause) { 41 | super(cause); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/datasource/DataSourceException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.datasource; 17 | 18 | import org.apache.ibatis.exceptions.PersistenceException; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public class DataSourceException extends PersistenceException { 24 | 25 | private static final long serialVersionUID = -5251396250407091334L; 26 | 27 | public DataSourceException() { 28 | super(); 29 | } 30 | 31 | public DataSourceException(String message) { 32 | super(message); 33 | } 34 | 35 | public DataSourceException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | public DataSourceException(Throwable cause) { 40 | super(cause); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/scripting/ScriptingException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.scripting; 17 | 18 | import org.apache.ibatis.exceptions.PersistenceException; 19 | 20 | /** 21 | * @author Frank D. Martinez [mnesarco] 22 | */ 23 | public class ScriptingException extends PersistenceException { 24 | 25 | private static final long serialVersionUID = 7642570221267566591L; 26 | 27 | public ScriptingException() { 28 | super(); 29 | } 30 | 31 | public ScriptingException(String message) { 32 | super(message); 33 | } 34 | 35 | public ScriptingException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | public ScriptingException(Throwable cause) { 40 | super(cause); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/type/ByteArrayUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.type; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | class ByteArrayUtils { 22 | 23 | private ByteArrayUtils() { 24 | // Prevent Instantiation 25 | } 26 | 27 | static byte[] convertToPrimitiveArray(Byte[] objects) { 28 | final byte[] bytes = new byte[objects.length]; 29 | for (int i = 0; i < objects.length; i++) { 30 | bytes[i] = objects[i]; 31 | } 32 | return bytes; 33 | } 34 | 35 | static Byte[] convertToObjectArray(byte[] bytes) { 36 | final Byte[] objects = new Byte[bytes.length]; 37 | for (int i = 0; i < bytes.length; i++) { 38 | objects[i] = bytes[i]; 39 | } 40 | return objects; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/reflection/ReflectionException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.reflection; 17 | 18 | import org.apache.ibatis.exceptions.PersistenceException; 19 | 20 | /** 21 | * @author Clinton Begin 22 | * 异常类 23 | */ 24 | public class ReflectionException extends PersistenceException { 25 | 26 | private static final long serialVersionUID = 7642570221267566591L; 27 | 28 | public ReflectionException() { 29 | super(); 30 | } 31 | 32 | public ReflectionException(String message) { 33 | super(message); 34 | } 35 | 36 | public ReflectionException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | 40 | public ReflectionException(Throwable cause) { 41 | super(cause); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/transaction/TransactionException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.transaction; 17 | 18 | import org.apache.ibatis.exceptions.PersistenceException; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public class TransactionException extends PersistenceException { 24 | 25 | private static final long serialVersionUID = -433589569461084605L; 26 | 27 | public TransactionException() { 28 | super(); 29 | } 30 | 31 | public TransactionException(String message) { 32 | super(message); 33 | } 34 | 35 | public TransactionException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | public TransactionException(Throwable cause) { 40 | super(cause); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/ResultType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * This annotation can be used when a @Select method is using a 26 | * ResultHandler. Those methods must have void return type, so 27 | * this annotation can be used to tell MyBatis what kind of object 28 | * it should build for each row. 29 | * 30 | * @since 3.2.0 31 | * @author Jeff Butler 32 | */ 33 | @Documented 34 | @Retention(RetentionPolicy.RUNTIME) 35 | @Target(ElementType.METHOD) 36 | public @interface ResultType { 37 | Class value(); 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/SelectKey.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | import org.apache.ibatis.mapping.StatementType; 25 | 26 | /** 27 | * @author Clinton Begin 28 | */ 29 | @Documented 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target(ElementType.METHOD) 32 | public @interface SelectKey { 33 | String[] statement(); 34 | 35 | String keyProperty(); 36 | 37 | String keyColumn() default ""; 38 | 39 | boolean before(); 40 | 41 | Class resultType(); 42 | 43 | StatementType statementType() default StatementType.PREPARED; 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/builder/CacheRefResolver.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.builder; 17 | 18 | import org.apache.ibatis.cache.Cache; 19 | 20 | /** 21 | * @author Clinton Begin 22 | * 23 | * 缓存引用解析器 24 | * 25 | * 包含了被解析的对象cacheRefNamespace 和对应的解析器MapperBuilderAssistant 因此具有自解析功能。 26 | */ 27 | public class CacheRefResolver { 28 | // Mapper建造者辅助类 29 | private final MapperBuilderAssistant assistant; 30 | // 被应用的namespace,即使用cacheRefNamespace的缓存空间 31 | private final String cacheRefNamespace; 32 | 33 | public CacheRefResolver(MapperBuilderAssistant assistant, String cacheRefNamespace) { 34 | this.assistant = assistant; 35 | this.cacheRefNamespace = cacheRefNamespace; 36 | } 37 | 38 | public Cache resolveCacheRef() { 39 | return assistant.useCacheRef(cacheRefNamespace); 40 | } 41 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/type/TypeHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.type; 17 | 18 | import java.sql.CallableStatement; 19 | import java.sql.PreparedStatement; 20 | import java.sql.ResultSet; 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * @author Clinton Begin 25 | */ 26 | public interface TypeHandler { 27 | 28 | void setParameter(PreparedStatement ps, int i, T parameter, JdbcType jdbcType) throws SQLException; 29 | 30 | /** 31 | * @param columnName Colunm name, when configuration useColumnLabel is false 32 | */ 33 | T getResult(ResultSet rs, String columnName) throws SQLException; 34 | 35 | T getResult(ResultSet rs, int columnIndex) throws SQLException; 36 | 37 | T getResult(CallableStatement cs, int columnIndex) throws SQLException; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/scripting/xmltags/OgnlClassResolver.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.scripting.xmltags; 17 | 18 | import ognl.DefaultClassResolver; 19 | import org.apache.ibatis.io.Resources; 20 | 21 | /** 22 | * Custom ognl {@code ClassResolver} which behaves same like ognl's 23 | * {@code DefaultClassResolver}. But uses the {@code Resources} 24 | * utility class to find the target class instead of {@code Class#forName(String)}. 25 | * 26 | * @author Daniel Guggi 27 | * 28 | * @see Issue 161 29 | */ 30 | public class OgnlClassResolver extends DefaultClassResolver { 31 | 32 | @Override 33 | protected Class toClassForName(String className) throws ClassNotFoundException { 34 | return Resources.classForName(className); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/session/RowBounds.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2017 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 org.apache.ibatis.session; 17 | 18 | /** 19 | * @author Clinton Begin 20 | */ 21 | public class RowBounds { 22 | 23 | public static final int NO_ROW_OFFSET = 0; 24 | public static final int NO_ROW_LIMIT = Integer.MAX_VALUE; 25 | public static final RowBounds DEFAULT = new RowBounds(); 26 | 27 | // 起始位置 28 | private final int offset; 29 | // 总长度限制 30 | private final int limit; 31 | 32 | public RowBounds() { 33 | this.offset = NO_ROW_OFFSET; 34 | this.limit = NO_ROW_LIMIT; 35 | } 36 | 37 | public RowBounds(int offset, int limit) { 38 | this.offset = offset; 39 | this.limit = limit; 40 | } 41 | 42 | public int getOffset() { 43 | return offset; 44 | } 45 | 46 | public int getLimit() { 47 | return limit; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/keygen/NoKeyGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2017 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 org.apache.ibatis.executor.keygen; 17 | 18 | import java.sql.Statement; 19 | 20 | import org.apache.ibatis.executor.Executor; 21 | import org.apache.ibatis.mapping.MappedStatement; 22 | 23 | /** 24 | * @author Clinton Begin 25 | * @author Kazuki Shimizu 26 | */ 27 | public class NoKeyGenerator implements KeyGenerator { 28 | 29 | /** 30 | * A shared instance. 31 | * @since 3.4.3 32 | */ 33 | public static final NoKeyGenerator INSTANCE = new NoKeyGenerator(); 34 | 35 | @Override 36 | public void processBefore(Executor executor, MappedStatement ms, Statement stmt, Object parameter) { 37 | // Do Nothing 38 | } 39 | 40 | @Override 41 | public void processAfter(Executor executor, MappedStatement ms, Statement stmt, Object parameter) { 42 | // Do Nothing 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/scripting/xmltags/ChooseSqlNode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2017 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 org.apache.ibatis.scripting.xmltags; 17 | 18 | import java.util.List; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public class ChooseSqlNode implements SqlNode { 24 | private final SqlNode defaultSqlNode; 25 | private final List ifSqlNodes; 26 | 27 | public ChooseSqlNode(List ifSqlNodes, SqlNode defaultSqlNode) { 28 | this.ifSqlNodes = ifSqlNodes; 29 | this.defaultSqlNode = defaultSqlNode; 30 | } 31 | 32 | @Override 33 | public boolean apply(DynamicContext context) { 34 | for (SqlNode sqlNode : ifSqlNodes) { 35 | if (sqlNode.apply(context)) { 36 | return true; 37 | } 38 | } 39 | if (defaultSqlNode != null) { 40 | defaultSqlNode.apply(context); 41 | return true; 42 | } 43 | return false; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/session/SqlSessionFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.session; 17 | 18 | import java.sql.Connection; 19 | 20 | /** 21 | * Creates an {@link SqlSession} out of a connection or a DataSource 22 | * 23 | * @author Clinton Begin 24 | */ 25 | public interface SqlSessionFactory { 26 | 27 | SqlSession openSession(); 28 | 29 | SqlSession openSession(boolean autoCommit); 30 | 31 | SqlSession openSession(Connection connection); 32 | 33 | SqlSession openSession(TransactionIsolationLevel level); 34 | 35 | SqlSession openSession(ExecutorType execType); 36 | 37 | SqlSession openSession(ExecutorType execType, boolean autoCommit); 38 | 39 | SqlSession openSession(ExecutorType execType, TransactionIsolationLevel level); 40 | 41 | SqlSession openSession(ExecutorType execType, Connection connection); 42 | 43 | Configuration getConfiguration(); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/TypeDiscriminator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | import org.apache.ibatis.type.JdbcType; 25 | import org.apache.ibatis.type.TypeHandler; 26 | import org.apache.ibatis.type.UnknownTypeHandler; 27 | 28 | /** 29 | * @author Clinton Begin 30 | */ 31 | @Documented 32 | @Retention(RetentionPolicy.RUNTIME) 33 | @Target(ElementType.METHOD) 34 | public @interface TypeDiscriminator { 35 | String column(); 36 | 37 | Class javaType() default void.class; 38 | 39 | JdbcType jdbcType() default JdbcType.UNDEFINED; 40 | 41 | Class typeHandler() default UnknownTypeHandler.class; 42 | 43 | Case[] cases(); 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/transaction/jdbc/JdbcTransactionFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.transaction.jdbc; 17 | 18 | import java.sql.Connection; 19 | 20 | import javax.sql.DataSource; 21 | 22 | import org.apache.ibatis.session.TransactionIsolationLevel; 23 | import org.apache.ibatis.transaction.Transaction; 24 | import org.apache.ibatis.transaction.TransactionFactory; 25 | 26 | /** 27 | * Creates {@link JdbcTransaction} instances. 28 | * 29 | * @author Clinton Begin 30 | * 31 | * @see JdbcTransaction 32 | */ 33 | public class JdbcTransactionFactory implements TransactionFactory { 34 | 35 | @Override 36 | public Transaction newTransaction(Connection conn) { 37 | return new JdbcTransaction(conn); 38 | } 39 | 40 | @Override 41 | public Transaction newTransaction(DataSource ds, TransactionIsolationLevel level, boolean autoCommit) { 42 | return new JdbcTransaction(ds, level, autoCommit); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/Result.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2016 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | import org.apache.ibatis.type.JdbcType; 24 | import org.apache.ibatis.type.TypeHandler; 25 | import org.apache.ibatis.type.UnknownTypeHandler; 26 | 27 | /** 28 | * @author Clinton Begin 29 | */ 30 | @Documented 31 | @Retention(RetentionPolicy.RUNTIME) 32 | @Target({}) 33 | public @interface Result { 34 | boolean id() default false; 35 | 36 | String column() default ""; 37 | 38 | String property() default ""; 39 | 40 | Class javaType() default void.class; 41 | 42 | JdbcType jdbcType() default JdbcType.UNDEFINED; 43 | 44 | Class typeHandler() default UnknownTypeHandler.class; 45 | 46 | One one() default @One; 47 | 48 | Many many() default @Many; 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/result/DefaultResultHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.executor.result; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | import org.apache.ibatis.reflection.factory.ObjectFactory; 22 | import org.apache.ibatis.session.ResultContext; 23 | import org.apache.ibatis.session.ResultHandler; 24 | 25 | /** 26 | * @author Clinton Begin 27 | */ 28 | public class DefaultResultHandler implements ResultHandler { 29 | 30 | private final List list; 31 | 32 | public DefaultResultHandler() { 33 | list = new ArrayList<>(); 34 | } 35 | 36 | @SuppressWarnings("unchecked") 37 | public DefaultResultHandler(ObjectFactory objectFactory) { 38 | list = objectFactory.create(List.class); 39 | } 40 | 41 | @Override 42 | public void handleResult(ResultContext context) { 43 | list.add(context.getResultObject()); 44 | } 45 | 46 | public List getResultList() { 47 | return list; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/reflection/ParamNameUtil.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.reflection; 17 | 18 | import java.lang.reflect.Constructor; 19 | import java.lang.reflect.Executable; 20 | import java.lang.reflect.Method; 21 | import java.lang.reflect.Parameter; 22 | import java.util.Arrays; 23 | import java.util.List; 24 | import java.util.stream.Collectors; 25 | 26 | // 提供获取普通方法或者构造方法的参数名称列表的工具方法。 27 | public class ParamNameUtil { 28 | public static List getParamNames(Method method) { 29 | return getParameterNames(method); 30 | } 31 | 32 | public static List getParamNames(Constructor constructor) { 33 | return getParameterNames(constructor); 34 | } 35 | 36 | // 获取方法(Executable的子类包含构造方法和一般方法)的参数列表 37 | private static List getParameterNames(Executable executable) { 38 | return Arrays.stream(executable.getParameters()).map(Parameter::getName).collect(Collectors.toList()); 39 | } 40 | 41 | private ParamNameUtil() { 42 | super(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/logging/nologging/NoLoggingImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.logging.nologging; 17 | 18 | import org.apache.ibatis.logging.Log; 19 | 20 | /** 21 | * @author Clinton Begin 22 | * 实现包 23 | */ 24 | public class NoLoggingImpl implements Log { 25 | 26 | public NoLoggingImpl(String clazz) { 27 | // Do Nothing 28 | } 29 | 30 | @Override 31 | public boolean isDebugEnabled() { 32 | return false; 33 | } 34 | 35 | @Override 36 | public boolean isTraceEnabled() { 37 | return false; 38 | } 39 | 40 | @Override 41 | public void error(String s, Throwable e) { 42 | // Do Nothing 43 | } 44 | 45 | @Override 46 | public void error(String s) { 47 | // Do Nothing 48 | } 49 | 50 | @Override 51 | public void debug(String s) { 52 | // Do Nothing 53 | } 54 | 55 | @Override 56 | public void trace(String s) { 57 | // Do Nothing 58 | } 59 | 60 | @Override 61 | public void warn(String s) { 62 | // Do Nothing 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/plugin/Invocation.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2017 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 org.apache.ibatis.plugin; 17 | 18 | import java.lang.reflect.InvocationTargetException; 19 | import java.lang.reflect.Method; 20 | 21 | /** 22 | * @author Clinton Begin 23 | */ 24 | 25 | /** 26 | * 代表了一个调用的详细信息 27 | */ 28 | public class Invocation { 29 | 30 | // 目标对象 31 | private final Object target; 32 | // 目标方法 33 | private final Method method; 34 | // 方法参数 35 | private final Object[] args; 36 | 37 | public Invocation(Object target, Method method, Object[] args) { 38 | this.target = target; 39 | this.method = method; 40 | this.args = args; 41 | } 42 | 43 | public Object getTarget() { 44 | return target; 45 | } 46 | 47 | public Method getMethod() { 48 | return method; 49 | } 50 | 51 | public Object[] getArgs() { 52 | return args; 53 | } 54 | 55 | public Object proceed() throws InvocationTargetException, IllegalAccessException { 56 | return method.invoke(target, args); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/reflection/invoker/SetFieldInvoker.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2018 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 org.apache.ibatis.reflection.invoker; 17 | 18 | import java.lang.reflect.Field; 19 | 20 | import org.apache.ibatis.reflection.Reflector; 21 | 22 | /** 23 | * @author Clinton Begin 24 | */ 25 | public class SetFieldInvoker implements Invoker { 26 | // 要操作的属性 27 | private final Field field; 28 | 29 | public SetFieldInvoker(Field field) { 30 | this.field = field; 31 | } 32 | 33 | @Override 34 | public Object invoke(Object target, Object[] args) throws IllegalAccessException { 35 | try { 36 | // 直接给属性赋值就可以 37 | field.set(target, args[0]); 38 | } catch (IllegalAccessException e) { 39 | if (Reflector.canControlMemberAccessible()) { 40 | field.setAccessible(true); 41 | field.set(target, args[0]); 42 | } else { 43 | throw e; 44 | } 45 | } 46 | return null; 47 | } 48 | 49 | @Override 50 | public Class getType() { 51 | return field.getType(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/scripting/xmltags/IfSqlNode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2017 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 org.apache.ibatis.scripting.xmltags; 17 | 18 | /** 19 | * @author Clinton Begin 20 | * 节点 21 | */ 22 | public class IfSqlNode implements SqlNode { 23 | // 表达式评估器 24 | private final ExpressionEvaluator evaluator; 25 | // if判断时的测试条件 26 | private final String test; 27 | // if成立时,要被拼接的SQL片段信息 28 | private final SqlNode contents; 29 | 30 | public IfSqlNode(SqlNode contents, String test) { 31 | this.test = test; 32 | this.contents = contents; 33 | this.evaluator = new ExpressionEvaluator(); 34 | } 35 | 36 | /** 37 | * 完成该节点自身的解析 38 | * @param context 上下文环境,节点自身的解析结果将合并到该上下文环境中 39 | * @return 解析是否成功 40 | */ 41 | @Override 42 | public boolean apply(DynamicContext context) { 43 | // 判断if条件是否成立 44 | if (evaluator.evaluateBoolean(test, context.getBindings())) { 45 | // 将contents拼接到context 46 | contents.apply(context); 47 | return true; 48 | } 49 | return false; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/CacheNamespaceRef.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * The annotation that reference a cache. 26 | *

27 | * If you use this annotation, should be specified either {@link #value()} or {@link #name()} attribute. 28 | *

29 | * @author Clinton Begin 30 | * @author Kazuki Shimizu 31 | */ 32 | @Documented 33 | @Retention(RetentionPolicy.RUNTIME) 34 | @Target(ElementType.TYPE) 35 | public @interface CacheNamespaceRef { 36 | 37 | /** 38 | * A namespace type to reference a cache (the namespace name become a FQCN of specified type). 39 | */ 40 | Class value() default void.class; 41 | 42 | /** 43 | * A namespace name to reference a cache. 44 | * @since 3.4.2 45 | */ 46 | String name() default ""; 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/plugin/Interceptor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.plugin; 17 | 18 | import java.util.Properties; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | // 拦截器 // Invocation:调用 24 | // 这是插件接口,所有插件需要实现该接口 25 | public interface Interceptor { 26 | /** 27 | * 该方法内是拦截器拦截到目标方法时的操作 28 | * @param invocation 拦截到的目标方法的信息 29 | * @return 经过拦截器处理后的返回结果 30 | * @throws Throwable 31 | */ 32 | Object intercept(Invocation invocation) throws Throwable; 33 | 34 | /** 35 | * 用返回值替代入参对象。 36 | * 通常情况下,可以调用Plugin的warp方法来完成,因为warp方法能判断目标对象是否需要拦截,并根据判断结果返回相应的对象来替换目标对象 37 | * @param target MyBatis传入的支持拦截的几个类(ParameterHandler、ResultSetHandler、StatementHandler、Executor)的实例 38 | * @return 如果当前拦截器要拦截该实例,则返回该实例的代理;如果不需要拦截该实例,则直接返回该实例本身 39 | */ 40 | default Object plugin(Object target) { 41 | return Plugin.wrap(target, this); 42 | } 43 | 44 | /** 45 | * 设置拦截器的属性 46 | * @param properties 要给拦截器设置的属性 47 | */ 48 | default void setProperties(Properties properties) { 49 | // NOP 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/annotations/Arg.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2018 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 org.apache.ibatis.annotations; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | import org.apache.ibatis.type.JdbcType; 24 | import org.apache.ibatis.type.TypeHandler; 25 | import org.apache.ibatis.type.UnknownTypeHandler; 26 | 27 | /** 28 | * @author Clinton Begin 29 | */ 30 | @Documented 31 | @Retention(RetentionPolicy.RUNTIME) 32 | @Target({}) 33 | public @interface Arg { 34 | boolean id() default false; 35 | 36 | String column() default ""; 37 | 38 | Class javaType() default void.class; 39 | 40 | JdbcType jdbcType() default JdbcType.UNDEFINED; 41 | 42 | Class typeHandler() default UnknownTypeHandler.class; 43 | 44 | String select() default ""; 45 | 46 | String resultMap() default ""; 47 | 48 | String name() default ""; 49 | 50 | /** 51 | * @since 3.5.0 52 | */ 53 | String columnPrefix() default ""; 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/logging/stdout/StdOutImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.logging.stdout; 17 | 18 | import org.apache.ibatis.logging.Log; 19 | 20 | /** 21 | * @author Clinton Begin 22 | * 实现包 23 | */ 24 | public class StdOutImpl implements Log { 25 | 26 | public StdOutImpl(String clazz) { 27 | // Do Nothing 28 | } 29 | 30 | @Override 31 | public boolean isDebugEnabled() { 32 | return true; 33 | } 34 | 35 | @Override 36 | public boolean isTraceEnabled() { 37 | return true; 38 | } 39 | 40 | @Override 41 | public void error(String s, Throwable e) { 42 | System.err.println(s); 43 | e.printStackTrace(System.err); 44 | } 45 | 46 | @Override 47 | public void error(String s) { 48 | System.err.println(s); 49 | } 50 | 51 | @Override 52 | public void debug(String s) { 53 | System.out.println(s); 54 | } 55 | 56 | @Override 57 | public void trace(String s) { 58 | System.out.println(s); 59 | } 60 | 61 | @Override 62 | public void warn(String s) { 63 | System.out.println(s); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/logging/slf4j/Slf4jLoggerImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2017 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 org.apache.ibatis.logging.slf4j; 17 | 18 | import org.apache.ibatis.logging.Log; 19 | import org.slf4j.Logger; 20 | 21 | /** 22 | * @author Eduardo Macarron 23 | */ 24 | class Slf4jLoggerImpl implements Log { 25 | 26 | private final Logger log; 27 | 28 | public Slf4jLoggerImpl(Logger logger) { 29 | log = logger; 30 | } 31 | 32 | @Override 33 | public boolean isDebugEnabled() { 34 | return log.isDebugEnabled(); 35 | } 36 | 37 | @Override 38 | public boolean isTraceEnabled() { 39 | return log.isTraceEnabled(); 40 | } 41 | 42 | @Override 43 | public void error(String s, Throwable e) { 44 | log.error(s, e); 45 | } 46 | 47 | @Override 48 | public void error(String s) { 49 | log.error(s); 50 | } 51 | 52 | @Override 53 | public void debug(String s) { 54 | log.debug(s); 55 | } 56 | 57 | @Override 58 | public void trace(String s) { 59 | log.trace(s); 60 | } 61 | 62 | @Override 63 | public void warn(String s) { 64 | log.warn(s); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/executor/result/DefaultResultContext.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.executor.result; 17 | 18 | import org.apache.ibatis.session.ResultContext; 19 | 20 | /** 21 | * @author Clinton Begin 22 | */ 23 | public class DefaultResultContext implements ResultContext { 24 | // 结果对象 25 | private T resultObject; 26 | // 结果计数(表明这是第几个结果对象) 27 | private int resultCount; 28 | // 使用完毕(结果已经被取走) 29 | private boolean stopped; 30 | 31 | public DefaultResultContext() { 32 | resultObject = null; 33 | resultCount = 0; 34 | stopped = false; 35 | } 36 | 37 | @Override 38 | public T getResultObject() { 39 | return resultObject; 40 | } 41 | 42 | @Override 43 | public int getResultCount() { 44 | return resultCount; 45 | } 46 | 47 | @Override 48 | public boolean isStopped() { 49 | return stopped; 50 | } 51 | 52 | public void nextResultObject(T resultObject) { 53 | resultCount++; 54 | this.resultObject = resultObject; 55 | } 56 | 57 | @Override 58 | public void stop() { 59 | this.stopped = true; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/type/ByteArrayTypeHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.type; 17 | 18 | import java.sql.CallableStatement; 19 | import java.sql.PreparedStatement; 20 | import java.sql.ResultSet; 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * @author Clinton Begin 25 | */ 26 | public class ByteArrayTypeHandler extends BaseTypeHandler { 27 | 28 | @Override 29 | public void setNonNullParameter(PreparedStatement ps, int i, byte[] parameter, JdbcType jdbcType) 30 | throws SQLException { 31 | ps.setBytes(i, parameter); 32 | } 33 | 34 | @Override 35 | public byte[] getNullableResult(ResultSet rs, String columnName) 36 | throws SQLException { 37 | return rs.getBytes(columnName); 38 | } 39 | 40 | @Override 41 | public byte[] getNullableResult(ResultSet rs, int columnIndex) 42 | throws SQLException { 43 | return rs.getBytes(columnIndex); 44 | } 45 | 46 | @Override 47 | public byte[] getNullableResult(CallableStatement cs, int columnIndex) 48 | throws SQLException { 49 | return cs.getBytes(columnIndex); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/type/ObjectTypeHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.type; 17 | 18 | import java.sql.CallableStatement; 19 | import java.sql.PreparedStatement; 20 | import java.sql.ResultSet; 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * @author Clinton Begin 25 | */ 26 | public class ObjectTypeHandler extends BaseTypeHandler { 27 | 28 | @Override 29 | public void setNonNullParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) 30 | throws SQLException { 31 | ps.setObject(i, parameter); 32 | } 33 | 34 | @Override 35 | public Object getNullableResult(ResultSet rs, String columnName) 36 | throws SQLException { 37 | return rs.getObject(columnName); 38 | } 39 | 40 | @Override 41 | public Object getNullableResult(ResultSet rs, int columnIndex) 42 | throws SQLException { 43 | return rs.getObject(columnIndex); 44 | } 45 | 46 | @Override 47 | public Object getNullableResult(CallableStatement cs, int columnIndex) 48 | throws SQLException { 49 | return cs.getObject(columnIndex); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/type/StringTypeHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.type; 17 | 18 | import java.sql.CallableStatement; 19 | import java.sql.PreparedStatement; 20 | import java.sql.ResultSet; 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * @author Clinton Begin 25 | */ 26 | public class StringTypeHandler extends BaseTypeHandler { 27 | 28 | @Override 29 | public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType) 30 | throws SQLException { 31 | ps.setString(i, parameter); 32 | } 33 | 34 | @Override 35 | public String getNullableResult(ResultSet rs, String columnName) 36 | throws SQLException { 37 | return rs.getString(columnName); 38 | } 39 | 40 | @Override 41 | public String getNullableResult(ResultSet rs, int columnIndex) 42 | throws SQLException { 43 | return rs.getString(columnIndex); 44 | } 45 | 46 | @Override 47 | public String getNullableResult(CallableStatement cs, int columnIndex) 48 | throws SQLException { 49 | return cs.getString(columnIndex); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/mapping/DatabaseIdProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2019 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 org.apache.ibatis.mapping; 17 | 18 | import java.sql.SQLException; 19 | import java.util.Properties; 20 | 21 | import javax.sql.DataSource; 22 | 23 | /** 24 | * Should return an id to identify the type of this database. 25 | * That id can be used later on to build different queries for each database type 26 | * This mechanism enables supporting multiple vendors or versions 27 | * 28 | * @author Eduardo Macarron 29 | * 30 | * MyBatis 可以根据不同的数据库厂商执行不同的语句,这种多厂商的支持是基于映射语句中的 databaseId 属性。 31 | * MyBatis 会加载不带 databaseId 属性和带有匹配当前数据库 databaseId 属性的所有语句。 32 | * 如果同时找到带有 databaseId 和不带 databaseId 的相同语句,则后者会被舍弃。 33 | * 34 | * 35 | * config文件中配置: 36 | * 37 | * 38 | * 39 | * 40 | * 41 | */ 42 | public interface DatabaseIdProvider { 43 | 44 | default void setProperties(Properties p) { 45 | // NOP 46 | } 47 | 48 | String getDatabaseId(DataSource dataSource) throws SQLException; 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/type/NStringTypeHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.type; 17 | 18 | import java.sql.CallableStatement; 19 | import java.sql.PreparedStatement; 20 | import java.sql.ResultSet; 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * @author Clinton Begin 25 | */ 26 | public class NStringTypeHandler extends BaseTypeHandler { 27 | 28 | @Override 29 | public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType) 30 | throws SQLException { 31 | ps.setNString(i, parameter); 32 | } 33 | 34 | @Override 35 | public String getNullableResult(ResultSet rs, String columnName) 36 | throws SQLException { 37 | return rs.getNString(columnName); 38 | } 39 | 40 | @Override 41 | public String getNullableResult(ResultSet rs, int columnIndex) 42 | throws SQLException { 43 | return rs.getNString(columnIndex); 44 | } 45 | 46 | @Override 47 | public String getNullableResult(CallableStatement cs, int columnIndex) 48 | throws SQLException { 49 | return cs.getNString(columnIndex); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/type/SqlDateTypeHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.type; 17 | 18 | import java.sql.CallableStatement; 19 | import java.sql.Date; 20 | import java.sql.PreparedStatement; 21 | import java.sql.ResultSet; 22 | import java.sql.SQLException; 23 | 24 | /** 25 | * @author Clinton Begin 26 | */ 27 | public class SqlDateTypeHandler extends BaseTypeHandler { 28 | 29 | @Override 30 | public void setNonNullParameter(PreparedStatement ps, int i, Date parameter, JdbcType jdbcType) 31 | throws SQLException { 32 | ps.setDate(i, parameter); 33 | } 34 | 35 | @Override 36 | public Date getNullableResult(ResultSet rs, String columnName) 37 | throws SQLException { 38 | return rs.getDate(columnName); 39 | } 40 | 41 | @Override 42 | public Date getNullableResult(ResultSet rs, int columnIndex) 43 | throws SQLException { 44 | return rs.getDate(columnIndex); 45 | } 46 | 47 | @Override 48 | public Date getNullableResult(CallableStatement cs, int columnIndex) 49 | throws SQLException { 50 | return cs.getDate(columnIndex); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/org/apache/ibatis/type/SqlTimeTypeHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009-2015 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 org.apache.ibatis.type; 17 | 18 | import java.sql.CallableStatement; 19 | import java.sql.PreparedStatement; 20 | import java.sql.ResultSet; 21 | import java.sql.SQLException; 22 | import java.sql.Time; 23 | 24 | /** 25 | * @author Clinton Begin 26 | */ 27 | public class SqlTimeTypeHandler extends BaseTypeHandler