├── .travis.yml ├── LICENSE.txt ├── README.md ├── pom.xml ├── src ├── main │ ├── java │ │ └── org │ │ │ └── jfaster │ │ │ └── mango │ │ │ ├── annotation │ │ │ ├── AutoGenerated.java │ │ │ ├── AutoGeneratedID.java │ │ │ ├── Column.java │ │ │ ├── DB.java │ │ │ ├── DatabaseShardingBy.java │ │ │ ├── ID.java │ │ │ ├── Ignore.java │ │ │ ├── Mapper.java │ │ │ ├── Rename.java │ │ │ ├── Result.java │ │ │ ├── Results.java │ │ │ ├── ReturnGeneratedId.java │ │ │ ├── SQL.java │ │ │ ├── Sharding.java │ │ │ ├── ShardingBy.java │ │ │ ├── TableShardingBy.java │ │ │ ├── Transfer.java │ │ │ ├── UseMaster.java │ │ │ ├── UseSqlGenerator.java │ │ │ ├── UseTransactionForBatchUpdate.java │ │ │ └── package-info.java │ │ │ ├── binding │ │ │ ├── BindingException.java │ │ │ ├── BindingParameter.java │ │ │ ├── BindingParameterInvoker.java │ │ │ ├── BoundSql.java │ │ │ ├── DefaultInvocationContext.java │ │ │ ├── DefaultParameterContext.java │ │ │ ├── InvocationContext.java │ │ │ ├── InvocationContextFactory.java │ │ │ ├── ParameterContext.java │ │ │ ├── TransferableBindingParameterInvoker.java │ │ │ └── package-info.java │ │ │ ├── crud │ │ │ ├── Builder.java │ │ │ ├── BuilderFactory.java │ │ │ ├── BuildinSqlGenerator.java │ │ │ ├── CrudDao.java │ │ │ ├── CrudException.java │ │ │ ├── CrudMeta.java │ │ │ ├── NamedCrudDao.java │ │ │ ├── NamedSqlGenerator.java │ │ │ ├── buildin │ │ │ │ ├── builder │ │ │ │ │ ├── AbstractBuildinBuilder.java │ │ │ │ │ ├── BuildinAddBuilder.java │ │ │ │ │ ├── BuildinCountBuilder.java │ │ │ │ │ ├── BuildinDeleteBuilder.java │ │ │ │ │ ├── BuildinGetAllBuilder.java │ │ │ │ │ ├── BuildinGetBuilder.java │ │ │ │ │ └── BuildinUpdateBuilder.java │ │ │ │ └── factory │ │ │ │ │ ├── AbstractBuildinBuilderFactory.java │ │ │ │ │ ├── BuildinAddAndReturnGeneratedIdBuilderFactory.java │ │ │ │ │ ├── BuildinAddBuilderFactory.java │ │ │ │ │ ├── BuildinBatchAddBuilderFactory.java │ │ │ │ │ ├── BuildinBatchUpdateBuilderFactory.java │ │ │ │ │ ├── BuildinCountBuilderFactory.java │ │ │ │ │ ├── BuildinDeleteBuilderFactory.java │ │ │ │ │ ├── BuildinFindAllBuilderFactory.java │ │ │ │ │ ├── BuildinFindAllPageBuilderFactory.java │ │ │ │ │ ├── BuildinFindAllSortBuilderFactory.java │ │ │ │ │ ├── BuildinFindManyBuilderFactory.java │ │ │ │ │ ├── BuildinFindOneBuilderFactory.java │ │ │ │ │ ├── BuildinGetOneBuilderFactory.java │ │ │ │ │ └── BuildinUpdateBuilderFactory.java │ │ │ ├── named │ │ │ │ ├── builder │ │ │ │ │ ├── AbstractNamedBuilder.java │ │ │ │ │ ├── NamedCountBuilder.java │ │ │ │ │ ├── NamedDeleteBuilder.java │ │ │ │ │ └── NamedQueryBuilder.java │ │ │ │ ├── factory │ │ │ │ │ ├── AbstractNamedBuilderFactory.java │ │ │ │ │ ├── NamedCountBuilderFactory.java │ │ │ │ │ ├── NamedDeleteBuilderFactory.java │ │ │ │ │ └── NamedQueryBuilderFactory.java │ │ │ │ └── parser │ │ │ │ │ ├── MethodNameInfo.java │ │ │ │ │ ├── MethodNameParser.java │ │ │ │ │ ├── OpUnit.java │ │ │ │ │ ├── OrderType.java │ │ │ │ │ ├── OrderUnit.java │ │ │ │ │ └── op │ │ │ │ │ ├── AbstractOp.java │ │ │ │ │ ├── BetweenOp.java │ │ │ │ │ ├── EqualsOp.java │ │ │ │ │ ├── FalseOp.java │ │ │ │ │ ├── GreaterThanEqualOp.java │ │ │ │ │ ├── GreaterThanOp.java │ │ │ │ │ ├── InOp.java │ │ │ │ │ ├── IsNullOp.java │ │ │ │ │ ├── LessThanEqualOp.java │ │ │ │ │ ├── LessThanOp.java │ │ │ │ │ ├── NotInOp.java │ │ │ │ │ ├── NotNullOp.java │ │ │ │ │ ├── NotOp.java │ │ │ │ │ ├── Op.java │ │ │ │ │ ├── Param0Op.java │ │ │ │ │ ├── Param1ForCollectionOp.java │ │ │ │ │ ├── Param1Op.java │ │ │ │ │ ├── Param2Op.java │ │ │ │ │ └── TrueOp.java │ │ │ └── package-info.java │ │ │ ├── datasource │ │ │ ├── AbstractDataSourceFactory.java │ │ │ ├── DataSourceFactory.java │ │ │ ├── DataSourceFactoryGroup.java │ │ │ ├── DataSourceType.java │ │ │ ├── DriverManagerDataSource.java │ │ │ ├── MasterSlaveDataSourceFactory.java │ │ │ ├── SimpleDataSourceFactory.java │ │ │ └── package-info.java │ │ │ ├── descriptor │ │ │ ├── Generic.java │ │ │ ├── MethodDescriptor.java │ │ │ ├── Methods.java │ │ │ ├── ParamNameResolver.java │ │ │ ├── ParameterDescriptor.java │ │ │ ├── ReturnDescriptor.java │ │ │ ├── SqlGenerator.java │ │ │ ├── TypeWithAnnotationDescriptor.java │ │ │ └── package-info.java │ │ │ ├── exception │ │ │ ├── DescriptionException.java │ │ │ ├── IncorrectParameterTypeException.java │ │ │ ├── InitializationException.java │ │ │ ├── MangoException.java │ │ │ ├── UncheckedException.java │ │ │ └── package-info.java │ │ │ ├── invoker │ │ │ ├── InvokerCache.java │ │ │ ├── PropertyTransfer.java │ │ │ ├── TransferableInvoker.java │ │ │ ├── TransferablePropertyInvoker.java │ │ │ ├── UnreachablePropertyException.java │ │ │ ├── package-info.java │ │ │ └── transfer │ │ │ │ ├── IntegerListToStringTransfer.java │ │ │ │ ├── LongListToStringTransfer.java │ │ │ │ ├── StringListToStringTransfer.java │ │ │ │ ├── enums │ │ │ │ ├── EnumToIntegerTransfer.java │ │ │ │ └── EnumToStringTransfer.java │ │ │ │ └── json │ │ │ │ ├── ObjectToFastjsonTransfer.java │ │ │ │ └── ObjectToGsonTransfer.java │ │ │ ├── jdbc │ │ │ ├── AbstractFallbackSQLExceptionTranslator.java │ │ │ ├── ArrayListSuppliter.java │ │ │ ├── ArrayResultSetExtractor.java │ │ │ ├── GeneratedKeyHolder.java │ │ │ ├── HashSetSupplier.java │ │ │ ├── JdbcOperations.java │ │ │ ├── JdbcTemplate.java │ │ │ ├── LinkedListSuppliter.java │ │ │ ├── ListResultSetExtractor.java │ │ │ ├── ListSupplier.java │ │ │ ├── ObjectResultSetExtractor.java │ │ │ ├── ResultSetExtractor.java │ │ │ ├── SQLErrorCodeSQLExceptionTranslator.java │ │ │ ├── SQLErrorCodes.java │ │ │ ├── SQLErrorCodesFactory.java │ │ │ ├── SQLExceptionSubclassTranslator.java │ │ │ ├── SQLExceptionTranslator.java │ │ │ ├── SQLStateSQLExceptionTranslator.java │ │ │ ├── SetResultSetExtractor.java │ │ │ ├── SetSupplier.java │ │ │ ├── exception │ │ │ │ ├── BadSqlGrammarException.java │ │ │ │ ├── CannotAcquireLockException.java │ │ │ │ ├── CannotSerializeTransactionException.java │ │ │ │ ├── ConcurrencyFailureException.java │ │ │ │ ├── DataAccessException.java │ │ │ │ ├── DataAccessResourceFailureException.java │ │ │ │ ├── DataIntegrityViolationException.java │ │ │ │ ├── DataRetrievalFailureException.java │ │ │ │ ├── DeadlockLoserDataAccessException.java │ │ │ │ ├── DuplicateKeyException.java │ │ │ │ ├── IncorrectResultSetColumnCountException.java │ │ │ │ ├── InvalidDataAccessApiUsageException.java │ │ │ │ ├── InvalidDataAccessResourceUsageException.java │ │ │ │ ├── InvalidResultSetAccessException.java │ │ │ │ ├── MetaDataAccessException.java │ │ │ │ ├── NonTransientDataAccessException.java │ │ │ │ ├── PermissionDeniedDataAccessException.java │ │ │ │ ├── PessimisticLockingFailureException.java │ │ │ │ ├── QueryTimeoutException.java │ │ │ │ ├── RecoverableDataAccessException.java │ │ │ │ ├── TransientDataAccessException.java │ │ │ │ ├── TransientDataAccessResourceException.java │ │ │ │ ├── UncategorizedDataAccessException.java │ │ │ │ └── UncategorizedSQLException.java │ │ │ └── package-info.java │ │ │ ├── mapper │ │ │ ├── AbstractRowMapper.java │ │ │ ├── BeanPropertyRowMapper.java │ │ │ ├── MappingException.java │ │ │ ├── RowMapper.java │ │ │ ├── SingleColumnRowMapper.java │ │ │ └── package-info.java │ │ │ ├── operator │ │ │ ├── AbstractOperator.java │ │ │ ├── BatchUpdateOperator.java │ │ │ ├── Config.java │ │ │ ├── Mango.java │ │ │ ├── Operator.java │ │ │ ├── OperatorFactory.java │ │ │ ├── QueryOperator.java │ │ │ ├── UpdateOperator.java │ │ │ ├── generator │ │ │ │ ├── AbstractDataSourceGenerator.java │ │ │ │ ├── DataSourceGenerator.java │ │ │ │ ├── DataSourceGeneratorFactory.java │ │ │ │ ├── ShardedDataSourceGenerator.java │ │ │ │ ├── ShardedTableGenerator.java │ │ │ │ ├── SimpleDataSourceGenerator.java │ │ │ │ ├── SimpleTableGenerator.java │ │ │ │ ├── TableGenerator.java │ │ │ │ └── TableGeneratorFactory.java │ │ │ └── package-info.java │ │ │ ├── page │ │ │ ├── Direction.java │ │ │ ├── InvocationPageHandler.java │ │ │ ├── MySQLPageHandler.java │ │ │ ├── OraclePageHandler.java │ │ │ ├── Order.java │ │ │ ├── Page.java │ │ │ ├── PageHandler.java │ │ │ ├── PageResult.java │ │ │ ├── Sort.java │ │ │ └── package-info.java │ │ │ ├── parser │ │ │ ├── ASTAndNode.java │ │ │ ├── ASTBlank.java │ │ │ ├── ASTBlock.java │ │ │ ├── ASTDelete.java │ │ │ ├── ASTEQNode.java │ │ │ ├── ASTElseIfStatement.java │ │ │ ├── ASTElseStatement.java │ │ │ ├── ASTExpression.java │ │ │ ├── ASTExpressionParameter.java │ │ │ ├── ASTFalse.java │ │ │ ├── ASTGENode.java │ │ │ ├── ASTGTNode.java │ │ │ ├── ASTGlobalTable.java │ │ │ ├── ASTIfStatement.java │ │ │ ├── ASTInsert.java │ │ │ ├── ASTIntegerLiteral.java │ │ │ ├── ASTJDBCIterableParameter.java │ │ │ ├── ASTJDBCParameter.java │ │ │ ├── ASTJoinParameter.java │ │ │ ├── ASTLENode.java │ │ │ ├── ASTLTNode.java │ │ │ ├── ASTMerge.java │ │ │ ├── ASTNENode.java │ │ │ ├── ASTNotNode.java │ │ │ ├── ASTNull.java │ │ │ ├── ASTOrNode.java │ │ │ ├── ASTQuoteText.java │ │ │ ├── ASTReplace.java │ │ │ ├── ASTRootNode.java │ │ │ ├── ASTSelect.java │ │ │ ├── ASTStringLiteral.java │ │ │ ├── ASTText.java │ │ │ ├── ASTTrimComma.java │ │ │ ├── ASTTrue.java │ │ │ ├── ASTTruncate.java │ │ │ ├── ASTUpdate.java │ │ │ ├── AbstractDMLNode.java │ │ │ ├── AbstractExpression.java │ │ │ ├── AbstractRenderableNode.java │ │ │ ├── AbstractStringNode.java │ │ │ ├── EmptyArrayException.java │ │ │ ├── EmptyCollectionException.java │ │ │ ├── EmptyObjectException.java │ │ │ ├── JJTParserState.java │ │ │ ├── MathUtils.java │ │ │ ├── Node.java │ │ │ ├── NodeInfo.java │ │ │ ├── ParameterBean.java │ │ │ ├── ParseException.java │ │ │ ├── Parser.java │ │ │ ├── ParserConstants.java │ │ │ ├── ParserTokenManager.java │ │ │ ├── ParserTreeConstants.java │ │ │ ├── ParserVisitor.java │ │ │ ├── SimpleCharStream.java │ │ │ ├── SimpleNode.java │ │ │ ├── SqlParser.java │ │ │ ├── SqlParserException.java │ │ │ ├── Token.java │ │ │ ├── TokenMgrError.java │ │ │ ├── package-info.java │ │ │ └── visitor │ │ │ │ ├── CheckAndBindVisitor.java │ │ │ │ ├── InterablePropertyCollectVisitor.java │ │ │ │ ├── NodeCollectVisitor.java │ │ │ │ ├── ParameterExpandVisitor.java │ │ │ │ └── TextBlankJoinVisitor.java │ │ │ ├── plugin │ │ │ ├── listener │ │ │ │ ├── ConsoleLoggerListener.java │ │ │ │ ├── ForceCheckAutoCommitListener.java │ │ │ │ ├── Log4J2LoggerListener.java │ │ │ │ ├── Log4JLoggerListener.java │ │ │ │ ├── NoLoggerListener.java │ │ │ │ ├── Slf4JLoggerListener.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── spring │ │ │ │ ├── AbstractMangoFactoryBean.java │ │ │ │ ├── DefaultMangoFactoryBean.java │ │ │ │ ├── MangoDaoScanner.java │ │ │ │ └── package-info.java │ │ │ ├── sharding │ │ │ ├── DatabaseShardingStrategy.java │ │ │ ├── ModHundredTableShardingStrategy.java │ │ │ ├── ModTenTableShardingStrategy.java │ │ │ ├── NotUseDatabaseShardingStrategy.java │ │ │ ├── NotUseShardingStrategy.java │ │ │ ├── NotUseTableShardingStrategy.java │ │ │ ├── ShardingStrategy.java │ │ │ ├── TableShardingStrategy.java │ │ │ └── package-info.java │ │ │ ├── transaction │ │ │ ├── ConnectionHolder.java │ │ │ ├── DataSourceMonitor.java │ │ │ ├── DataSourceUtils.java │ │ │ ├── Transaction.java │ │ │ ├── TransactionAction.java │ │ │ ├── TransactionFactory.java │ │ │ ├── TransactionImpl.java │ │ │ ├── TransactionIsolationLevel.java │ │ │ ├── TransactionStatus.java │ │ │ ├── TransactionSynchronizationManager.java │ │ │ ├── TransactionTemplate.java │ │ │ ├── exception │ │ │ │ ├── CannotCreateTransactionException.java │ │ │ │ ├── CannotGetJdbcConnectionException.java │ │ │ │ ├── IllegalTransactionStateException.java │ │ │ │ ├── TransactionException.java │ │ │ │ └── TransactionSystemException.java │ │ │ └── package-info.java │ │ │ ├── type │ │ │ ├── BaseTypeHandler.java │ │ │ ├── BigDecimalTypeHandler.java │ │ │ ├── BigIntegerTypeHandler.java │ │ │ ├── BlobByteObjectArrayTypeHandler.java │ │ │ ├── BlobTypeHandler.java │ │ │ ├── BooleanTypeHandler.java │ │ │ ├── ByteArrayTypeHandler.java │ │ │ ├── ByteArrayUtils.java │ │ │ ├── ByteObjectArrayTypeHandler.java │ │ │ ├── ByteTypeHandler.java │ │ │ ├── CharacterTypeHandler.java │ │ │ ├── ClobTypeHandler.java │ │ │ ├── DateOnlyTypeHandler.java │ │ │ ├── DateTypeHandler.java │ │ │ ├── DoubleTypeHandler.java │ │ │ ├── FloatTypeHandler.java │ │ │ ├── IntegerTypeHandler.java │ │ │ ├── LongTypeHandler.java │ │ │ ├── NClobTypeHandler.java │ │ │ ├── NStringTypeHandler.java │ │ │ ├── ShortTypeHandler.java │ │ │ ├── SqlDateTypeHandler.java │ │ │ ├── SqlTimeTypeHandler.java │ │ │ ├── SqlTimestampTypeHandler.java │ │ │ ├── StringTypeHandler.java │ │ │ ├── TimeOnlyTypeHandler.java │ │ │ ├── TypeException.java │ │ │ ├── TypeHandler.java │ │ │ ├── TypeHandlerRegistry.java │ │ │ └── package-info.java │ │ │ └── util │ │ │ ├── Arrays.java │ │ │ ├── HashUtil.java │ │ │ ├── IterObj.java │ │ │ ├── Iterables.java │ │ │ ├── Iterators.java │ │ │ ├── Joiner.java │ │ │ ├── NestedProperty.java │ │ │ ├── Objects.java │ │ │ ├── PatternMatchUtils.java │ │ │ ├── Primitives.java │ │ │ ├── PropertyTokenizer.java │ │ │ ├── ScriptRunner.java │ │ │ ├── Strings.java │ │ │ ├── Ticker.java │ │ │ ├── ToStringHelper.java │ │ │ ├── bean │ │ │ ├── BeanUtil.java │ │ │ └── PropertyMeta.java │ │ │ ├── jdbc │ │ │ ├── JdbcType.java │ │ │ ├── OperatorType.java │ │ │ ├── ResultSetWrapper.java │ │ │ └── SQLType.java │ │ │ ├── local │ │ │ ├── CacheLoader.java │ │ │ ├── DoubleCheckCache.java │ │ │ ├── LoadingCache.java │ │ │ └── package-info.java │ │ │ ├── logging │ │ │ ├── AbstractInternalLogger.java │ │ │ ├── ConsoleLogger.java │ │ │ ├── ConsoleLoggerFactory.java │ │ │ ├── FormattingTuple.java │ │ │ ├── InternalLogLevel.java │ │ │ ├── InternalLogger.java │ │ │ ├── InternalLoggerFactory.java │ │ │ ├── Log4J2Logger.java │ │ │ ├── Log4J2LoggerFactory.java │ │ │ ├── Log4JLogger.java │ │ │ ├── Log4JLoggerFactory.java │ │ │ ├── MangoLogger.java │ │ │ ├── MessageFormatter.java │ │ │ ├── NoLogger.java │ │ │ ├── NoLoggerFactory.java │ │ │ ├── Slf4JLogger.java │ │ │ ├── Slf4JLoggerFactory.java │ │ │ ├── StringUtil.java │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── reflect │ │ │ ├── AbstractInvocationHandler.java │ │ │ ├── BeanInstantiationException.java │ │ │ ├── DynamicTokens.java │ │ │ ├── Reflection.java │ │ │ ├── TokenTuple.java │ │ │ ├── TypeCapture.java │ │ │ ├── TypeParameter.java │ │ │ ├── TypeResolver.java │ │ │ ├── TypeToken.java │ │ │ ├── TypeVisitor.java │ │ │ ├── TypeWrapper.java │ │ │ └── Types.java │ └── jjtree │ │ └── parser.jjt └── test │ ├── java │ └── org │ │ └── jfaster │ │ └── mango │ │ ├── BTTest.java │ │ ├── ByteTest.java │ │ ├── DbTest.java │ │ ├── GeneratedLongTest.java │ │ ├── GlobalTableTest.java │ │ ├── binding │ │ ├── BindingParameterTest.java │ │ ├── DefaultInvocationContextTest.java │ │ ├── DefaultParameterContextTest.java │ │ └── InvocationContextFactoryTest.java │ │ ├── crud │ │ ├── CrudDaoTest.java │ │ ├── CrudMetaTest.java │ │ ├── CrudOrder.java │ │ ├── CrudOrderA.java │ │ ├── CrudOrderB.java │ │ ├── CustomCrudDaoTest.java │ │ ├── InternalCrudDaoInheritTest.java │ │ ├── InternalCrudDaoTest.java │ │ ├── Order.java │ │ ├── Order2.java │ │ ├── Order3.java │ │ ├── buildin │ │ │ ├── builder │ │ │ │ ├── BuildinAddBuilderTest.java │ │ │ │ ├── BuildinDeleteBuilderTest.java │ │ │ │ ├── BuildinGetAllBuilderTest.java │ │ │ │ ├── BuildinGetBuilderTest.java │ │ │ │ └── BuildinUpdateBuilderTest.java │ │ │ └── factory │ │ │ │ ├── BuildinAddAndReturnGeneratedIdBuilderFactoryTest.java │ │ │ │ ├── BuildinAddBuilderFactoryTest.java │ │ │ │ ├── BuildinBatchAddBuilderFactoryTest.java │ │ │ │ ├── BuildinBatchUpdateBuilderFactoryTest.java │ │ │ │ ├── BuildinDeleteBuilderFactoryTest.java │ │ │ │ ├── BuildinFindAllBuilderFactoryTest.java │ │ │ │ ├── BuildinFindAllPageBuilderFactoryTest.java │ │ │ │ ├── BuildinFindAllSortBuilderFactoryTest.java │ │ │ │ ├── BuildinFindManyBuilderFactoryTest.java │ │ │ │ ├── BuildinFindOneBuilderFactoryTest.java │ │ │ │ ├── BuildinGetOneBuilderFactoryTest.java │ │ │ │ └── BuildinUpdateBuilderFactoryTest.java │ │ └── named │ │ │ ├── builder │ │ │ ├── NamedCountBuilderTest.java │ │ │ ├── NamedDeleteBuilderTest.java │ │ │ └── NamedQueryBuilderTest.java │ │ │ ├── factory │ │ │ ├── NamedCountBuilderFactoryTest.java │ │ │ ├── NamedDeleteBuilderFactoryTest.java │ │ │ └── NamedQueryBuilderFactoryTest.java │ │ │ └── parser │ │ │ ├── MethodNameParserTest.java │ │ │ ├── OpUnitTest.java │ │ │ └── op │ │ │ ├── BetweenOpTest.java │ │ │ ├── EqualsOpTest.java │ │ │ ├── IsNullOpTest.java │ │ │ └── LessThanOpTest.java │ │ ├── dao │ │ └── type │ │ │ └── AllTypeTest.java │ │ ├── descriptor │ │ └── MethodsTest.java │ │ ├── exception │ │ ├── IllegalStateExceptionTest.java │ │ ├── IncorrectParameterTypeExceptionTest.java │ │ ├── IncorrectSqlExceptionTest.java │ │ └── JdkExceptionTest.java │ │ ├── invoker │ │ ├── TransferablePropertyInvokerTest.java │ │ └── transfer │ │ │ ├── IntegerListToStringTransferTest.java │ │ │ ├── LongListToStringTransferTest.java │ │ │ ├── StringListToStringTransferTest.java │ │ │ ├── enums │ │ │ ├── EnumToIntegerTransferTest.java │ │ │ └── EnumToStringTransferTest.java │ │ │ └── json │ │ │ ├── ObjectToFastjsonTransferTest.java │ │ │ └── ObjectToGsonTransferTest.java │ │ ├── jdbc │ │ ├── AbstractRowMapperTest.java │ │ ├── BeanPropertyRowMapperTest.java │ │ ├── MapperTest.java │ │ └── exception │ │ │ ├── BadSqlGrammarExceptionTest.java │ │ │ ├── DataRetrievalFailureExceptionTest.java │ │ │ └── DuplicateKeyExceptionTest.java │ │ ├── operator │ │ ├── BatchUpdateOperatorTest.java │ │ ├── QueryOperatorTest.java │ │ ├── UnreadableParameterExceptionTest.java │ │ └── UpdateOperatorTest.java │ │ ├── page │ │ ├── MySQLPageHandlerTest.java │ │ ├── PageTest.java │ │ └── SortTest.java │ │ ├── parser │ │ ├── ParserTest.java │ │ └── visitor │ │ │ └── ParameterExpandVisitorTest.java │ │ ├── plugin │ │ └── spring │ │ │ ├── MangoDaoScannerTest.java │ │ │ └── TestDao.java │ │ ├── proxy │ │ └── ProxyTest.java │ │ ├── sharding │ │ ├── BillShardingTest.java │ │ ├── DatabaseSharding2Test.java │ │ ├── DatabaseShardingTest.java │ │ ├── OrderShardingTest.java │ │ ├── ShardingExceptionTest.java │ │ └── TableShardingTest.java │ │ ├── support │ │ ├── DataSourceConfig.java │ │ ├── JdbcOperationsAdapter.java │ │ ├── MockDB.java │ │ ├── MockRename.java │ │ ├── MockReturnGeneratedId.java │ │ ├── MockSQL.java │ │ ├── MockSharding.java │ │ ├── MockShardingBy.java │ │ ├── ParserVisitorAdapter.java │ │ ├── Randoms.java │ │ ├── ResultSetMetaDataAapter.java │ │ ├── Table.java │ │ └── model4table │ │ │ ├── Account.java │ │ │ ├── BT.java │ │ │ ├── Bill.java │ │ │ ├── LongIdMsg.java │ │ │ ├── Msg.java │ │ │ ├── Order.java │ │ │ ├── Person.java │ │ │ ├── Position.java │ │ │ ├── Product.java │ │ │ ├── TableIncludeAllTypes.java │ │ │ └── User.java │ │ ├── transaction │ │ ├── ParallelTransactionTest.java │ │ ├── TransactionForBatchUpdateTest.java │ │ ├── TransactionTemplateTest.java │ │ └── TransactionTest.java │ │ ├── type │ │ ├── BaseTypeHandlerTest.java │ │ ├── BigDecimalTypeHandlerTest.java │ │ ├── BigIntegerTypeHandlerTest.java │ │ ├── BlobByteObjectArrayTypeHandlerTest.java │ │ ├── BlobTypeHandlerTest.java │ │ ├── BooleanTypeHandlerTest.java │ │ ├── ByteArrayTypeHandlerTest.java │ │ ├── ByteObjectArrayTypeHandlerTest.java │ │ ├── ByteTypeHandlerTest.java │ │ ├── CharacterTypeHandlerTest.java │ │ ├── ClobTypeHandlerTest.java │ │ ├── DateOnlyTypeHandlerTest.java │ │ ├── DateTypeHandlerTest.java │ │ ├── DoubleTypeHandlerTest.java │ │ ├── FloatTypeHandlerTest.java │ │ ├── IntegerTypeHandlerTest.java │ │ ├── LongTypeHandlerTest.java │ │ ├── NClobTypeHandlerTest.java │ │ ├── NStringTypeHandlerTest.java │ │ ├── ShortTypeHandlerTest.java │ │ ├── SqlDateTypeHandlerTest.java │ │ ├── SqlTimeTypeHandlerTest.java │ │ ├── SqlTimetampTypeHandlerTest.java │ │ ├── StringTypeHandlerTest.java │ │ ├── TimeOnlyTypeHandlerTest.java │ │ └── TypeHandlerRegistryTest.java │ │ ├── usesjava8 │ │ └── UseActualParamNameTest.java │ │ └── util │ │ ├── PropertyTokenizerTest.java │ │ ├── bean │ │ ├── A.java │ │ ├── BeanUtilTest.java │ │ ├── SubClass.java │ │ └── SuperClass.java │ │ ├── logging │ │ └── ConsoleLoggerTest.java │ │ └── reflect │ │ ├── DynamicTokensTest.java │ │ ├── ReflectionTest.java │ │ ├── TypeTokenTest.java │ │ └── TypesTest.java │ └── resources │ ├── hsqldb │ ├── account.sql │ ├── bill_partition.sql │ ├── bt.sql │ ├── byte_info.sql │ ├── database.properties │ ├── database1.properties │ ├── database2.properties │ ├── database3.properties │ ├── database4.properties │ ├── long_id_msg.sql │ ├── msg.sql │ ├── msg_partition.sql │ ├── msg_router1.sql │ ├── msg_router2.sql │ ├── msg_router3.sql │ ├── order.sql │ ├── order_partition.sql │ ├── person.sql │ ├── position.sql │ ├── product_partition.sql │ ├── table_include_all_types.sql │ └── user.sql │ ├── logback-test.xml │ ├── mysql │ ├── account.sql │ ├── bill_partition.sql │ ├── bt.sql │ ├── byte_info.sql │ ├── database.properties │ ├── database1.properties │ ├── database2.properties │ ├── database3.properties │ ├── database4.properties │ ├── long_id_msg.sql │ ├── msg.sql │ ├── msg_partition.sql │ ├── msg_router1.sql │ ├── msg_router2.sql │ ├── msg_router3.sql │ ├── order.sql │ ├── order_partition.sql │ ├── person.sql │ ├── position.sql │ ├── product_partition.sql │ ├── table_include_all_types.sql │ └── user.sql │ └── plugin │ └── spring │ └── applicationContext.xml └── travis └── after_success.sh /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | sudo: false 3 | 4 | jdk: 5 | - openjdk8 6 | - openjdk11 7 | 8 | after_success: 9 | - chmod -R 777 ./travis/after_success.sh 10 | - ./travis/after_success.sh 11 | 12 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/annotation/AutoGenerated.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.annotation; 18 | 19 | import java.lang.annotation.*; 20 | 21 | /** 22 | * 指定数据库的自增ID 23 | * 24 | * @author ash 25 | */ 26 | @Target({ElementType.FIELD}) 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Documented 29 | public @interface AutoGenerated { 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/annotation/AutoGeneratedID.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.annotation; 18 | 19 | import java.lang.annotation.*; 20 | 21 | /** 22 | * 指定CRUD中的主键ID+指定数据库的自增ID 23 | * 等于同时使用@AutoGenerated与@ID 24 | * 25 | * @author ash 26 | */ 27 | @Target({ElementType.FIELD}) 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Documented 30 | public @interface AutoGeneratedID { 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/annotation/Column.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.annotation; 18 | 19 | import java.lang.annotation.*; 20 | 21 | /** 22 | * 指定property对应的column 23 | * 24 | * @author ash 25 | */ 26 | @Target({ElementType.FIELD}) 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Documented 29 | public @interface Column { 30 | 31 | String value(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/annotation/ID.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.annotation; 18 | 19 | import java.lang.annotation.*; 20 | 21 | /** 22 | * 指定CRUD中的主键ID 23 | * 24 | * @author ash 25 | */ 26 | @Target({ElementType.FIELD}) 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Documented 29 | public @interface ID { 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/annotation/Ignore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.annotation; 18 | 19 | import java.lang.annotation.*; 20 | 21 | /** 22 | * 忽略属性 23 | * 24 | * @author ash 25 | */ 26 | @Target({ElementType.FIELD}) 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Documented 29 | public @interface Ignore { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/annotation/Mapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.annotation; 18 | 19 | import org.jfaster.mango.mapper.RowMapper; 20 | 21 | import java.lang.annotation.*; 22 | 23 | /** 24 | * @author ash 25 | */ 26 | @Target({ElementType.METHOD, ElementType.TYPE}) 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Documented 29 | public @interface Mapper { 30 | 31 | Class> value(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/annotation/Rename.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.annotation; 18 | 19 | import java.lang.annotation.*; 20 | 21 | /** 22 | * 参数重命名 23 | * 24 | * @author ash 25 | */ 26 | @Target({ElementType.PARAMETER}) 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Documented 29 | public @interface Rename { 30 | 31 | String value(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/annotation/Result.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.annotation; 18 | 19 | import java.lang.annotation.*; 20 | 21 | /** 22 | * 自定义数据库表字段到类属性的映射 23 | * 24 | * @author ash 25 | * @see Results 26 | */ 27 | @Target({ElementType.METHOD, ElementType.TYPE}) 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Documented 30 | public @interface Result { 31 | 32 | /** 33 | * 数据库列 34 | */ 35 | String column(); 36 | 37 | /** 38 | * 对象属性 39 | */ 40 | String property(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/annotation/ReturnGeneratedId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.annotation; 18 | 19 | import java.lang.annotation.*; 20 | 21 | /** 22 | * 用于修饰insert语句,标识方法返回自增id 23 | * 24 | * @author ash 25 | */ 26 | @Target({ElementType.METHOD}) 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Documented 29 | public @interface ReturnGeneratedId { 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/annotation/SQL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.annotation; 18 | 19 | import java.lang.annotation.*; 20 | 21 | /** 22 | * 修饰DAO接口中的方法,指明要执行的SQL语句 23 | * 24 | * @author ash 25 | */ 26 | @Target({ElementType.METHOD}) 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Documented 29 | public @interface SQL { 30 | 31 | /** 32 | * 指明要执行的SQL语句 33 | * 34 | * @return 35 | */ 36 | String value(); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/annotation/TableShardingBy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.annotation; 18 | 19 | import java.lang.annotation.*; 20 | 21 | /** 22 | * 用此注解修饰的方法参数或参数中的某个属性将被作为参数传入 23 | * {@link org.jfaster.mango.sharding.TableShardingStrategy#getTargetTable(String, Object)}中 24 | * 25 | * @author ash 26 | */ 27 | @Target({ElementType.PARAMETER}) 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Documented 30 | public @interface TableShardingBy { 31 | 32 | /** 33 | * 如果value等于"",直接取被修饰的参数
34 | * 如果value不等于"",取被修饰参数的value属性 35 | * 36 | * @return 37 | */ 38 | String value() default ""; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/annotation/Transfer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.annotation; 18 | 19 | import org.jfaster.mango.invoker.PropertyTransfer; 20 | 21 | import java.lang.annotation.*; 22 | 23 | /** 24 | * @author ash 25 | */ 26 | @Target({ElementType.FIELD}) 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Documented 29 | public @interface Transfer { 30 | 31 | Class> value(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/annotation/UseMaster.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.annotation; 18 | 19 | import java.lang.annotation.*; 20 | 21 | /** 22 | * 强制使用主库 23 | * 24 | * @author ash 25 | */ 26 | @Target({ElementType.METHOD, ElementType.TYPE}) 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Documented 29 | public @interface UseMaster { 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/annotation/UseSqlGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.annotation; 18 | 19 | import org.jfaster.mango.descriptor.SqlGenerator; 20 | 21 | import java.lang.annotation.*; 22 | 23 | /** 24 | * 使用SQL生成器 25 | * 26 | * @author ash 27 | */ 28 | @Target({ElementType.METHOD, ElementType.TYPE}) 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Documented 31 | public @interface UseSqlGenerator { 32 | 33 | /** 34 | * 指明要使用的SQL生成器 35 | * 36 | * @return 37 | */ 38 | Class value(); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/annotation/UseTransactionForBatchUpdate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.annotation; 18 | 19 | import java.lang.annotation.*; 20 | 21 | /** 22 | * 在批量操作时使用事务 23 | * 24 | * @author ash 25 | */ 26 | @Target({ElementType.METHOD, ElementType.TYPE}) 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Documented 29 | public @interface UseTransactionForBatchUpdate { 30 | 31 | boolean value() default true; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/annotation/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * mango框架所有注解 19 | * 20 | * 依赖包: 21 | * ignore 22 | */ 23 | package org.jfaster.mango.annotation; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/binding/BindingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.binding; 18 | 19 | import org.jfaster.mango.exception.DescriptionException; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public class BindingException extends DescriptionException { 25 | 26 | public BindingException(String msg) { 27 | super(msg); 28 | } 29 | 30 | public BindingException(String msg, Throwable cause) { 31 | super(msg, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/binding/BindingParameterInvoker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.binding; 18 | 19 | import java.lang.reflect.Type; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public interface BindingParameterInvoker { 25 | 26 | /** 27 | * 获得目标类型 28 | */ 29 | Type getTargetType(); 30 | 31 | /** 32 | * 执行get方法 33 | */ 34 | Object invoke(Object obj); 35 | 36 | /** 37 | * 获得绑定参数 38 | */ 39 | BindingParameter getBindingParameter(); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/binding/InvocationContextFactory.java: -------------------------------------------------------------------------------- 1 | package org.jfaster.mango.binding; 2 | 3 | /** 4 | * @author ash 5 | */ 6 | public class InvocationContextFactory { 7 | 8 | private ParameterContext parameterContext; 9 | 10 | private InvocationContextFactory(ParameterContext parameterContext) { 11 | this.parameterContext = parameterContext; 12 | } 13 | 14 | public static InvocationContextFactory create(ParameterContext parameterContext) { 15 | return new InvocationContextFactory(parameterContext); 16 | } 17 | 18 | public InvocationContext newInvocationContext(Object[] values) { 19 | InvocationContext context = DefaultInvocationContext.create(); 20 | for (int i = 0; i < values.length; i++) { 21 | String parameterName = parameterContext.getParameterNameByPosition(i); 22 | context.addParameter(parameterName, values[i]); 23 | } 24 | return context; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/binding/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * 参数绑定 19 | * 20 | * 依赖包: 21 | * annotation 22 | * descriptor 23 | * exception 24 | * invoker 25 | * type 26 | * util 27 | */ 28 | package org.jfaster.mango.binding; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/Builder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public interface Builder { 23 | 24 | public String buildSql(); 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/CrudException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud; 18 | 19 | import org.jfaster.mango.exception.MangoException; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public class CrudException extends MangoException { 25 | 26 | public CrudException(String msg) { 27 | super(msg); 28 | } 29 | 30 | public CrudException(String msg, Throwable cause) { 31 | super(msg, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/NamedCrudDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud; 18 | 19 | import org.jfaster.mango.annotation.UseSqlGenerator; 20 | import org.jfaster.mango.descriptor.Generic; 21 | import org.jfaster.mango.page.Page; 22 | import org.jfaster.mango.page.PageResult; 23 | import org.jfaster.mango.page.Sort; 24 | 25 | import java.util.List; 26 | import java.util.Optional; 27 | 28 | /** 29 | * @author ash 30 | */ 31 | @UseSqlGenerator(NamedSqlGenerator.class) 32 | public interface NamedCrudDao extends Generic { 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/buildin/builder/AbstractBuildinBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.buildin.builder; 18 | 19 | import org.jfaster.mango.crud.Builder; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public abstract class AbstractBuildinBuilder implements Builder { 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/buildin/builder/BuildinCountBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.buildin.builder; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class BuildinCountBuilder extends AbstractBuildinBuilder { 23 | 24 | private final static String SQL = "select count(1) from #table"; 25 | 26 | @Override 27 | public String buildSql() { 28 | return SQL; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/buildin/builder/BuildinDeleteBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.buildin.builder; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class BuildinDeleteBuilder extends AbstractBuildinBuilder { 23 | 24 | private final static String SQL_TEMPLATE = "delete from #table where %s = :1"; 25 | 26 | private final String columnId; 27 | 28 | public BuildinDeleteBuilder(String colId) { 29 | columnId = colId; 30 | } 31 | 32 | @Override 33 | public String buildSql() { 34 | return String.format(SQL_TEMPLATE, columnId); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/builder/AbstractNamedBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.builder; 18 | 19 | import org.jfaster.mango.crud.Builder; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public abstract class AbstractNamedBuilder implements Builder { 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/builder/NamedCountBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.builder; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class NamedCountBuilder extends AbstractNamedBuilder { 23 | 24 | private final static String SQL_TEMPLATE = "select count(1) from #table %s"; 25 | 26 | private final String tailOfSql; 27 | 28 | public NamedCountBuilder(String tailOfSql) { 29 | this.tailOfSql = tailOfSql; 30 | } 31 | 32 | @Override 33 | public String buildSql() { 34 | return String.format(SQL_TEMPLATE, tailOfSql); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/builder/NamedDeleteBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.builder; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class NamedDeleteBuilder extends AbstractNamedBuilder { 23 | 24 | private final static String SQL_TEMPLATE = "delete from #table %s"; 25 | 26 | private final String tailOfSql; 27 | 28 | public NamedDeleteBuilder(String tailOfSql) { 29 | this.tailOfSql = tailOfSql; 30 | } 31 | 32 | @Override 33 | public String buildSql() { 34 | return String.format(SQL_TEMPLATE, tailOfSql); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/parser/OrderType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public enum OrderType { 23 | 24 | DESC, ASC, NONE 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/parser/op/BetweenOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class BetweenOp extends Param2Op { 23 | 24 | @Override 25 | public String render(String column, String param1, String param2) { 26 | return column + " between " + param1 + " and " + param2; 27 | } 28 | 29 | @Override 30 | public String keyword() { 31 | return "Between"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/parser/op/EqualsOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class EqualsOp extends Param1Op { 23 | 24 | @Override 25 | public String keyword() { 26 | return "Equals"; 27 | } 28 | 29 | @Override 30 | public String operator() { 31 | return "="; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/parser/op/FalseOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class FalseOp extends Param0Op { 23 | 24 | @Override 25 | public String keyword() { 26 | return "False"; 27 | } 28 | 29 | @Override 30 | public String render(String column) { 31 | return column + " = false"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/parser/op/GreaterThanEqualOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class GreaterThanEqualOp extends Param1Op { 23 | 24 | @Override 25 | public String keyword() { 26 | return "GreaterThanEqual"; 27 | } 28 | 29 | @Override 30 | public String operator() { 31 | return ">="; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/parser/op/GreaterThanOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class GreaterThanOp extends Param1Op { 23 | 24 | @Override 25 | public String keyword() { 26 | return "GreaterThan"; 27 | } 28 | 29 | @Override 30 | public String operator() { 31 | return ">"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/parser/op/InOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class InOp extends Param1ForCollectionOp { 23 | 24 | @Override 25 | public String keyword() { 26 | return "In"; 27 | } 28 | 29 | @Override 30 | public String operator() { 31 | return "in"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/parser/op/IsNullOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class IsNullOp extends Param0Op { 23 | 24 | @Override 25 | public String keyword() { 26 | return "IsNull"; 27 | } 28 | 29 | @Override 30 | public String render(String column) { 31 | return column + " is null"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/parser/op/LessThanEqualOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class LessThanEqualOp extends Param1Op { 23 | 24 | @Override 25 | public String keyword() { 26 | return "LessThanEqual"; 27 | } 28 | 29 | @Override 30 | public String operator() { 31 | return "<="; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/parser/op/LessThanOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class LessThanOp extends Param1Op { 23 | 24 | @Override 25 | public String keyword() { 26 | return "LessThan"; 27 | } 28 | 29 | @Override 30 | public String operator() { 31 | return "<"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/parser/op/NotInOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class NotInOp extends Param1ForCollectionOp { 23 | 24 | @Override 25 | public String keyword() { 26 | return "NotIn"; 27 | } 28 | 29 | @Override 30 | public String operator() { 31 | return "not in"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/parser/op/NotNullOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class NotNullOp extends Param0Op { 23 | 24 | @Override 25 | public String keyword() { 26 | return "NotNull"; 27 | } 28 | 29 | @Override 30 | public String render(String column) { 31 | return column + " not null"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/parser/op/NotOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class NotOp extends Param1Op { 23 | 24 | @Override 25 | public String keyword() { 26 | return "Not"; 27 | } 28 | 29 | @Override 30 | public String operator() { 31 | return "<>"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/parser/op/Op.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public interface Op { 23 | 24 | public String keyword(); 25 | 26 | public int paramCount(); 27 | 28 | public String render(String column, String[] params); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/named/parser/op/TrueOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class TrueOp extends Param0Op { 23 | 24 | @Override 25 | public String keyword() { 26 | return "True"; 27 | } 28 | 29 | @Override 30 | public String render(String column) { 31 | return column + " = true"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/crud/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * 类似于spring-data-jpa的数据访问方式 19 | */ 20 | package org.jfaster.mango.crud; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/datasource/DataSourceFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.datasource; 18 | 19 | import javax.sql.DataSource; 20 | 21 | /** 22 | * 数据源工厂 23 | * 24 | * @author ash 25 | */ 26 | public interface DataSourceFactory { 27 | 28 | public String getName(); 29 | 30 | public DataSource getMasterDataSource(); 31 | 32 | public DataSource getSlaveDataSource(Class daoClass); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/datasource/DataSourceType.java: -------------------------------------------------------------------------------- 1 | package org.jfaster.mango.datasource; 2 | 3 | /** 4 | * 数据源类型 5 | * 6 | * @author ash 7 | */ 8 | public enum DataSourceType { 9 | 10 | MASTER, // 主库 11 | SLAVE, // 从库 12 | ; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/datasource/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * 数据源工厂 19 | * 20 | * 依赖包: 21 | * none 22 | */ 23 | package org.jfaster.mango.datasource; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/descriptor/Generic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.descriptor; 18 | 19 | /** 20 | * @author 21 | */ 22 | public interface Generic { 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/descriptor/SqlGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.descriptor; 18 | 19 | 20 | import javax.annotation.Nullable; 21 | 22 | /** 23 | * SQL生成器 24 | * 25 | * @author ash 26 | */ 27 | public interface SqlGenerator { 28 | 29 | @Nullable 30 | String generateSql(MethodDescriptor md); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/descriptor/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * 方法描述 19 | * 20 | * 依赖包: 21 | * annotation 22 | * exception 23 | * util 24 | */ 25 | package org.jfaster.mango.descriptor; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/exception/DescriptionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.exception; 18 | 19 | /** 20 | * DAO描述异常 21 | * 22 | * @author ash 23 | */ 24 | public class DescriptionException extends MangoException { 25 | 26 | public DescriptionException(String msg) { 27 | super(msg); 28 | } 29 | 30 | public DescriptionException(String msg, Throwable cause) { 31 | super(msg, cause); 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/exception/IncorrectParameterTypeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.exception; 18 | 19 | /** 20 | * 错误的参数类型异常 21 | * 22 | * @author ash 23 | */ 24 | public class IncorrectParameterTypeException extends MangoException { 25 | 26 | public IncorrectParameterTypeException(String message) { 27 | super(message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/exception/InitializationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.exception; 18 | 19 | /** 20 | * 预加载异常 21 | * 22 | * @author ash 23 | */ 24 | public class InitializationException extends MangoException { 25 | 26 | public InitializationException(String msg) { 27 | super(msg); 28 | } 29 | 30 | public InitializationException(String msg, Throwable cause) { 31 | super(msg, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/exception/UncheckedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.exception; 18 | 19 | /** 20 | * Unchecked {@link Exception} 21 | * 22 | * @author ash 23 | */ 24 | public class UncheckedException extends MangoException { 25 | 26 | public UncheckedException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/exception/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * 异常 19 | * 20 | * 依赖包: 21 | * none 22 | */ 23 | package org.jfaster.mango.exception; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/invoker/PropertyTransfer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.invoker; 18 | 19 | import javax.annotation.Nullable; 20 | import java.lang.reflect.Type; 21 | 22 | /** 23 | * @author ash 24 | */ 25 | public interface PropertyTransfer { 26 | 27 | @Nullable 28 | COLUMN propertyToColumn(@Nullable PROPERTY propertyValue); 29 | 30 | @Nullable 31 | PROPERTY columnToProperty(@Nullable COLUMN columnValue, Type actualPropertyType); 32 | 33 | default boolean isCheckType() { 34 | return true; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/invoker/TransferableInvoker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.invoker; 18 | 19 | import javax.annotation.Nullable; 20 | import java.lang.reflect.Type; 21 | 22 | /** 23 | * 属性调用器,封装get与set方法调用,同时具备转换功能 24 | * 25 | * @author ash 26 | */ 27 | public interface TransferableInvoker { 28 | 29 | String getName(); 30 | 31 | Object invokeGet(Object obj); 32 | 33 | void invokeSet(Object object, @Nullable Object columnValue); 34 | 35 | Type getColumnType(); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/invoker/UnreachablePropertyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.invoker; 18 | 19 | import org.jfaster.mango.exception.MangoException; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public class UnreachablePropertyException extends MangoException { 25 | 26 | public UnreachablePropertyException(String msg) { 27 | super(msg); 28 | } 29 | 30 | public UnreachablePropertyException(String msg, Throwable cause) { 31 | super(msg, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/invoker/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * '函数式'调用器 19 | * 20 | * 依赖包: 21 | * annotation 22 | * exception 23 | * util 24 | */ 25 | package org.jfaster.mango.invoker; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/ArrayListSuppliter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | /** 23 | * @author ash 24 | */ 25 | public class ArrayListSuppliter implements ListSupplier { 26 | 27 | @Override 28 | public List get(Class clazz) { 29 | return new ArrayList(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/HashSetSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc; 18 | 19 | import java.util.HashSet; 20 | import java.util.Set; 21 | 22 | /** 23 | * @author ash 24 | */ 25 | public class HashSetSupplier implements SetSupplier { 26 | 27 | @Override 28 | public Set get(Class clazz) { 29 | return new HashSet(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/LinkedListSuppliter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc; 18 | 19 | import java.util.LinkedList; 20 | import java.util.List; 21 | 22 | /** 23 | * @author ash 24 | */ 25 | public class LinkedListSuppliter implements ListSupplier { 26 | 27 | @Override 28 | public List get(Class clazz) { 29 | return new LinkedList(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/ListSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public interface ListSupplier { 25 | 26 | public List get(Class clazz); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/ResultSetExtractor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc; 18 | 19 | 20 | import java.sql.ResultSet; 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * @author ash 25 | */ 26 | public interface ResultSetExtractor { 27 | 28 | 29 | T extractData(ResultSet rs) throws SQLException; 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/SQLExceptionTranslator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc; 18 | 19 | import org.jfaster.mango.jdbc.exception.DataAccessException; 20 | 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * @author ash 25 | */ 26 | public interface SQLExceptionTranslator { 27 | 28 | DataAccessException translate(String sql, SQLException ex); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/SetSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc; 18 | 19 | import java.util.Set; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public interface SetSupplier { 25 | 26 | public Set get(Class clazz); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/BadSqlGrammarException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * 错误的sql语法异常 21 | * 22 | * @author ash 23 | */ 24 | public class BadSqlGrammarException extends InvalidDataAccessResourceUsageException { 25 | 26 | public BadSqlGrammarException(String msg) { 27 | super(msg); 28 | } 29 | 30 | public BadSqlGrammarException(String msg, Throwable cause) { 31 | super(msg, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/CannotAcquireLockException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class CannotAcquireLockException extends PessimisticLockingFailureException { 23 | 24 | public CannotAcquireLockException(String msg) { 25 | super(msg); 26 | } 27 | 28 | public CannotAcquireLockException(String msg, Throwable cause) { 29 | super(msg, cause); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/CannotSerializeTransactionException.java: -------------------------------------------------------------------------------- 1 | package org.jfaster.mango.jdbc.exception; 2 | 3 | /** 4 | * @author ash 5 | */ 6 | public class CannotSerializeTransactionException extends PessimisticLockingFailureException { 7 | 8 | public CannotSerializeTransactionException(String msg) { 9 | super(msg); 10 | } 11 | 12 | public CannotSerializeTransactionException(String msg, Throwable cause) { 13 | super(msg, cause); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/ConcurrencyFailureException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * @author ash 21 | * @see OptimisticLockingFailureException 22 | * @see PessimisticLockingFailureException 23 | * @see CannotAcquireLockException 24 | * @see DeadlockLoserDataAccessException 25 | */ 26 | public class ConcurrencyFailureException extends DataAccessException { 27 | 28 | public ConcurrencyFailureException(String msg) { 29 | super(msg); 30 | } 31 | 32 | public ConcurrencyFailureException(String msg, Throwable cause) { 33 | super(msg, cause); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/DataAccessException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | import org.jfaster.mango.exception.MangoException; 20 | 21 | /** 22 | * 所的数据访问异常继承此类 23 | * 24 | * @author ash 25 | */ 26 | public abstract class DataAccessException extends MangoException { 27 | 28 | public DataAccessException(String msg) { 29 | super(msg); 30 | } 31 | 32 | public DataAccessException(String msg, Throwable cause) { 33 | super(msg, cause); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/DataAccessResourceFailureException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * 资源失效异常 21 | * 22 | * @author ash 23 | */ 24 | public class DataAccessResourceFailureException extends NonTransientDataAccessException { 25 | 26 | public DataAccessResourceFailureException(String msg) { 27 | super(msg); 28 | } 29 | 30 | public DataAccessResourceFailureException(String msg, Throwable cause) { 31 | super(msg, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/DataIntegrityViolationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * 数据不一致异常 21 | * 22 | * @author ash 23 | */ 24 | public class DataIntegrityViolationException extends NonTransientDataAccessException { 25 | 26 | public DataIntegrityViolationException(String msg) { 27 | super(msg); 28 | } 29 | 30 | public DataIntegrityViolationException(String msg, Throwable cause) { 31 | super(msg, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/DataRetrievalFailureException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * 数据获取失败异常 21 | * 22 | * @author ash 23 | */ 24 | public class DataRetrievalFailureException extends NonTransientDataAccessException { 25 | 26 | public DataRetrievalFailureException(String msg) { 27 | super(msg); 28 | } 29 | 30 | public DataRetrievalFailureException(String msg, Throwable cause) { 31 | super(msg, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/DeadlockLoserDataAccessException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class DeadlockLoserDataAccessException extends PessimisticLockingFailureException { 23 | 24 | public DeadlockLoserDataAccessException(String msg) { 25 | super(msg); 26 | } 27 | 28 | public DeadlockLoserDataAccessException(String msg, Throwable cause) { 29 | super(msg, cause); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/DuplicateKeyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * 主键重复异常 21 | * 22 | * @author ash 23 | */ 24 | public class DuplicateKeyException extends DataIntegrityViolationException { 25 | 26 | public DuplicateKeyException(String msg) { 27 | super(msg); 28 | } 29 | 30 | public DuplicateKeyException(String msg, Throwable cause) { 31 | super(msg, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/IncorrectResultSetColumnCountException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * 错误的返回结果数量异常 21 | * 22 | * @author ash 23 | */ 24 | public class IncorrectResultSetColumnCountException extends DataRetrievalFailureException { 25 | 26 | 27 | public IncorrectResultSetColumnCountException(String msg) { 28 | super(msg); 29 | } 30 | 31 | public IncorrectResultSetColumnCountException(String msg, Throwable cause) { 32 | super(msg, cause); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/InvalidDataAccessApiUsageException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class InvalidDataAccessApiUsageException extends NonTransientDataAccessException { 23 | 24 | public InvalidDataAccessApiUsageException(String msg) { 25 | super(msg); 26 | } 27 | 28 | public InvalidDataAccessApiUsageException(String msg, Throwable cause) { 29 | super(msg, cause); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/InvalidDataAccessResourceUsageException.java: -------------------------------------------------------------------------------- 1 | package org.jfaster.mango.jdbc.exception; 2 | 3 | /** 4 | * 访问数据错误异常继承此类 5 | * 6 | * @author ash 7 | */ 8 | public class InvalidDataAccessResourceUsageException extends NonTransientDataAccessException { 9 | 10 | public InvalidDataAccessResourceUsageException(String msg) { 11 | super(msg); 12 | } 13 | 14 | public InvalidDataAccessResourceUsageException(String msg, Throwable cause) { 15 | super(msg, cause); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/InvalidResultSetAccessException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class InvalidResultSetAccessException extends InvalidDataAccessResourceUsageException { 23 | 24 | public InvalidResultSetAccessException(String msg) { 25 | super(msg); 26 | } 27 | 28 | public InvalidResultSetAccessException(String msg, Throwable cause) { 29 | super(msg, cause); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/MetaDataAccessException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | import org.jfaster.mango.exception.MangoException; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public class MetaDataAccessException extends MangoException { 25 | 26 | public MetaDataAccessException(String message) { 27 | super(message); 28 | } 29 | 30 | public MetaDataAccessException(String message, Throwable cause) { 31 | super(message, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/NonTransientDataAccessException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * 所有非暂时性数据访问异常继承此类 21 | * 22 | * @author ash 23 | * @see java.sql.SQLNonTransientException 24 | */ 25 | public abstract class NonTransientDataAccessException extends DataAccessException { 26 | 27 | public NonTransientDataAccessException(String msg) { 28 | super(msg); 29 | } 30 | 31 | public NonTransientDataAccessException(String msg, Throwable cause) { 32 | super(msg, cause); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/PermissionDeniedDataAccessException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class PermissionDeniedDataAccessException extends NonTransientDataAccessException { 23 | 24 | public PermissionDeniedDataAccessException(String msg) { 25 | super(msg); 26 | } 27 | 28 | public PermissionDeniedDataAccessException(String msg, Throwable cause) { 29 | super(msg, cause); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/PessimisticLockingFailureException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * @author ash 21 | * @see CannotAcquireLockException 22 | * @see DeadlockLoserDataAccessException 23 | * @see OptimisticLockingFailureException 24 | */ 25 | public class PessimisticLockingFailureException extends ConcurrencyFailureException { 26 | 27 | public PessimisticLockingFailureException(String msg) { 28 | super(msg); 29 | } 30 | 31 | public PessimisticLockingFailureException(String msg, Throwable cause) { 32 | super(msg, cause); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/QueryTimeoutException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class QueryTimeoutException extends DataAccessException { 23 | 24 | public QueryTimeoutException(String msg) { 25 | super(msg); 26 | } 27 | 28 | public QueryTimeoutException(String msg, Throwable cause) { 29 | super(msg, cause); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/RecoverableDataAccessException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * @author ash 21 | * @see java.sql.SQLRecoverableException 22 | */ 23 | public class RecoverableDataAccessException extends DataAccessException { 24 | 25 | public RecoverableDataAccessException(String msg) { 26 | super(msg); 27 | } 28 | 29 | public RecoverableDataAccessException(String msg, Throwable cause) { 30 | super(msg, cause); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/TransientDataAccessException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * 所有暂时性数据访问异常继承此类 21 | * 22 | * @author ash 23 | * @see java.sql.SQLTransientException 24 | */ 25 | public class TransientDataAccessException extends DataAccessException { 26 | 27 | public TransientDataAccessException(String msg) { 28 | super(msg); 29 | } 30 | 31 | public TransientDataAccessException(String msg, Throwable cause) { 32 | super(msg, cause); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/TransientDataAccessResourceException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * @author ash 21 | * @see java.sql.SQLTransientConnectionException 22 | */ 23 | public class TransientDataAccessResourceException extends TransientDataAccessException { 24 | 25 | public TransientDataAccessResourceException(String msg) { 26 | super(msg); 27 | } 28 | 29 | public TransientDataAccessResourceException(String msg, Throwable cause) { 30 | super(msg, cause); 31 | } 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/exception/UncategorizedDataAccessException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.jdbc.exception; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class UncategorizedDataAccessException extends NonTransientDataAccessException { 23 | 24 | public UncategorizedDataAccessException(String msg, Throwable cause) { 25 | super(msg, cause); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/jdbc/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * jdbc 19 | * 20 | * 依赖包: 21 | * binding 22 | * exception 23 | * mapper 24 | * transaction 25 | * type 26 | * util 27 | */ 28 | package org.jfaster.mango.jdbc; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/mapper/MappingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.mapper; 18 | 19 | import org.jfaster.mango.exception.MangoException; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public class MappingException extends MangoException { 25 | 26 | public MappingException(String msg) { 27 | super(msg); 28 | } 29 | 30 | public MappingException(String msg, Throwable cause) { 31 | super(msg, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/mapper/RowMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.mapper; 18 | 19 | import java.sql.ResultSet; 20 | import java.sql.SQLException; 21 | 22 | /** 23 | * @author ash 24 | */ 25 | public interface RowMapper { 26 | 27 | T mapRow(ResultSet rs, int rowNum) throws SQLException; 28 | 29 | Class getMappedClass(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/mapper/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * 表数据到对象映射 19 | * 20 | * 依赖包: 21 | * exception 22 | * invoker 23 | * type 24 | * util 25 | */ 26 | package org.jfaster.mango.mapper; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/operator/Operator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.operator; 18 | 19 | 20 | import org.jfaster.mango.descriptor.MethodDescriptor; 21 | 22 | /** 23 | * db操作接口 24 | * 25 | * @author ash 26 | */ 27 | public interface Operator { 28 | 29 | Object execute(Object[] values); 30 | 31 | MethodDescriptor getMethodDescriptor(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/operator/generator/DataSourceGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.operator.generator; 18 | 19 | import org.jfaster.mango.binding.InvocationContext; 20 | 21 | import javax.sql.DataSource; 22 | 23 | /** 24 | * @author ash 25 | */ 26 | public interface DataSourceGenerator { 27 | 28 | public DataSource getDataSource(InvocationContext context, Class daoClass); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/operator/generator/TableGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.operator.generator; 18 | 19 | import org.jfaster.mango.binding.InvocationContext; 20 | 21 | import javax.annotation.Nullable; 22 | 23 | /** 24 | * 表名生成器,生成的表名用于替换掉SQL中的#table 25 | * 26 | * @author ash 27 | */ 28 | public interface TableGenerator { 29 | 30 | @Nullable 31 | public String getTable(InvocationContext context); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/operator/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * 数据访问操作 19 | * 20 | * 依赖包: 21 | * annotation 22 | * binding 23 | * datasource 24 | * descriptor 25 | * exception 26 | * page 27 | * invoker 28 | * jdbc 29 | * mapper 30 | * parser 31 | * sharding 32 | * stat 33 | * type 34 | * util 35 | */ 36 | package org.jfaster.mango.operator; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/page/Direction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.page; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public enum Direction { 23 | 24 | ASC, DESC; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/page/PageHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.page; 18 | 19 | import org.jfaster.mango.binding.BoundSql; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public interface PageHandler { 25 | 26 | void handlePage(BoundSql boundSql, Page page); 27 | 28 | void handleSort(BoundSql boundSql, Sort sort); 29 | 30 | void handleCount(BoundSql boundSql); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/page/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * 拦截器 19 | * 20 | * 依赖包: 21 | * binding 22 | * descriptor 23 | * util 24 | * jdbc 25 | */ 26 | package org.jfaster.mango.page; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/ASTBlank.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class ASTBlank extends AbstractStringNode { 23 | 24 | public ASTBlank(int i) { 25 | super(i); 26 | } 27 | 28 | public ASTBlank(Parser p, int i) { 29 | super(p, i); 30 | } 31 | 32 | @Override 33 | public Object jjtAccept(ParserVisitor visitor, Object data) { 34 | return visitor.visit(this, data); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/ASTDelete.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | import org.jfaster.mango.util.jdbc.SQLType; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public class ASTDelete extends AbstractDMLNode { 25 | 26 | public ASTDelete(int id) { 27 | super(id); 28 | } 29 | 30 | public ASTDelete(Parser p, int id) { 31 | super(p, id); 32 | } 33 | 34 | @Override 35 | public SQLType getSQLType() { 36 | return SQLType.DELETE; 37 | } 38 | 39 | @Override 40 | public Object jjtAccept(ParserVisitor visitor, Object data) { 41 | return visitor.visit(this, data); 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/ASTInsert.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | import org.jfaster.mango.util.jdbc.SQLType; 20 | 21 | public class ASTInsert extends AbstractDMLNode { 22 | 23 | public ASTInsert(int id) { 24 | super(id); 25 | } 26 | 27 | public ASTInsert(Parser p, int id) { 28 | super(p, id); 29 | } 30 | 31 | @Override 32 | public SQLType getSQLType() { 33 | return SQLType.INSERT; 34 | } 35 | 36 | @Override 37 | public Object jjtAccept(ParserVisitor visitor, Object data) { 38 | return visitor.visit(this, data); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/ASTMerge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | import org.jfaster.mango.util.jdbc.SQLType; 20 | 21 | public class ASTMerge extends AbstractDMLNode { 22 | 23 | public ASTMerge(int id) { 24 | super(id); 25 | } 26 | 27 | public ASTMerge(Parser p, int id) { 28 | super(p, id); 29 | } 30 | 31 | @Override 32 | public SQLType getSQLType() { 33 | return SQLType.MERGE; 34 | } 35 | 36 | @Override 37 | public Object jjtAccept(ParserVisitor visitor, Object data) { 38 | return visitor.visit(this, data); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/ASTQuoteText.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class ASTQuoteText extends AbstractStringNode { 23 | 24 | public ASTQuoteText(int i) { 25 | super(i); 26 | } 27 | 28 | public ASTQuoteText(Parser p, int i) { 29 | super(p, i); 30 | } 31 | 32 | @Override 33 | public Object jjtAccept(ParserVisitor visitor, Object data) { 34 | return visitor.visit(this, data); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/ASTReplace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | import org.jfaster.mango.util.jdbc.SQLType; 20 | 21 | public class ASTReplace extends AbstractDMLNode { 22 | 23 | public ASTReplace(int id) { 24 | super(id); 25 | } 26 | 27 | public ASTReplace(Parser p, int id) { 28 | super(p, id); 29 | } 30 | 31 | @Override 32 | public SQLType getSQLType() { 33 | return SQLType.REPLACE; 34 | } 35 | 36 | @Override 37 | public Object jjtAccept(ParserVisitor visitor, Object data) { 38 | return visitor.visit(this, data); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/ASTSelect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | import org.jfaster.mango.util.jdbc.SQLType; 20 | 21 | public class ASTSelect extends AbstractDMLNode { 22 | 23 | public ASTSelect(int id) { 24 | super(id); 25 | } 26 | 27 | public ASTSelect(Parser p, int id) { 28 | super(p, id); 29 | } 30 | 31 | @Override 32 | public SQLType getSQLType() { 33 | return SQLType.SELECT; 34 | } 35 | 36 | @Override 37 | public Object jjtAccept(ParserVisitor visitor, Object data) { 38 | return visitor.visit(this, data); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/ASTStringLiteral.java: -------------------------------------------------------------------------------- 1 | package org.jfaster.mango.parser; 2 | 3 | import org.jfaster.mango.binding.InvocationContext; 4 | 5 | public class ASTStringLiteral extends AbstractExpression { 6 | 7 | private String value; 8 | 9 | public ASTStringLiteral(int i) { 10 | super(i); 11 | } 12 | 13 | public ASTStringLiteral(Parser p, int i) { 14 | super(p, i); 15 | } 16 | 17 | public void init(String str) { 18 | value = str.substring(1, str.length() - 1); 19 | } 20 | 21 | @Override 22 | public boolean evaluate(InvocationContext context) { 23 | return !value.isEmpty(); 24 | } 25 | 26 | @Override 27 | public Object value(InvocationContext context) { 28 | return value; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | return super.toString() + "[" + value + "]"; 34 | } 35 | 36 | @Override 37 | public Object jjtAccept(ParserVisitor visitor, Object data) { 38 | return visitor.visit(this, data); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/ASTText.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class ASTText extends AbstractStringNode { 23 | 24 | public ASTText(int i) { 25 | super(i); 26 | } 27 | 28 | public ASTText(Parser p, int i) { 29 | super(p, i); 30 | } 31 | 32 | @Override 33 | public Object jjtAccept(ParserVisitor visitor, Object data) { 34 | return visitor.visit(this, data); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/ASTTruncate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | import org.jfaster.mango.util.jdbc.SQLType; 20 | 21 | public class ASTTruncate extends AbstractDMLNode { 22 | 23 | public ASTTruncate(int id) { 24 | super(id); 25 | } 26 | 27 | public ASTTruncate(Parser p, int id) { 28 | super(p, id); 29 | } 30 | 31 | @Override 32 | public SQLType getSQLType() { 33 | return SQLType.TRANCATE; 34 | } 35 | 36 | @Override 37 | public Object jjtAccept(ParserVisitor visitor, Object data) { 38 | return visitor.visit(this, data); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/ASTUpdate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | import org.jfaster.mango.util.jdbc.SQLType; 20 | 21 | public class ASTUpdate extends AbstractDMLNode { 22 | 23 | public ASTUpdate(int id) { 24 | super(id); 25 | } 26 | 27 | public ASTUpdate(Parser p, int id) { 28 | super(p, id); 29 | } 30 | 31 | @Override 32 | public SQLType getSQLType() { 33 | return SQLType.UPDATE; 34 | } 35 | 36 | @Override 37 | public Object jjtAccept(ParserVisitor visitor, Object data) { 38 | return visitor.visit(this, data); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/AbstractRenderableNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | import org.jfaster.mango.binding.InvocationContext; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public abstract class AbstractRenderableNode extends SimpleNode { 25 | 26 | public AbstractRenderableNode next; 27 | 28 | public AbstractRenderableNode(int i) { 29 | super(i); 30 | } 31 | 32 | public AbstractRenderableNode(Parser p, int i) { 33 | super(p, i); 34 | } 35 | 36 | /** 37 | * 渲染sql与args 38 | */ 39 | public abstract boolean render(InvocationContext context); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/EmptyArrayException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class EmptyArrayException extends EmptyObjectException { 23 | 24 | public EmptyArrayException(String msg) { 25 | super(msg); 26 | } 27 | 28 | public EmptyArrayException(String msg, Throwable cause) { 29 | super(msg, cause); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/EmptyCollectionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class EmptyCollectionException extends EmptyObjectException { 23 | 24 | public EmptyCollectionException(String msg) { 25 | super(msg); 26 | } 27 | 28 | public EmptyCollectionException(String msg, Throwable cause) { 29 | super(msg, cause); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/EmptyObjectException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | import org.jfaster.mango.exception.MangoException; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public class EmptyObjectException extends MangoException { 25 | 26 | public EmptyObjectException(String msg) { 27 | super(msg); 28 | } 29 | 30 | public EmptyObjectException(String msg, Throwable cause) { 31 | super(msg, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/NodeInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | import java.util.LinkedList; 20 | import java.util.List; 21 | 22 | /** 23 | * @author ash 24 | */ 25 | public class NodeInfo { 26 | 27 | public List jdbcParameters = new LinkedList(); 28 | public List jdbcIterableParameters = new LinkedList(); 29 | public List globalTables = new LinkedList(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/ParameterBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | import org.jfaster.mango.binding.BindingParameter; 20 | import org.jfaster.mango.binding.BindingParameterInvoker; 21 | 22 | /** 23 | * @author ash 24 | */ 25 | public interface ParameterBean { 26 | 27 | public BindingParameter getBindingParameter(); 28 | 29 | public void setBindingParameter(BindingParameter bindingParameter); 30 | 31 | public void setBindingParameterInvoker(BindingParameterInvoker invoker); 32 | 33 | public String getFullName(); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/SqlParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class SqlParser { 23 | 24 | public static ASTRootNode parse(String sql) { 25 | try { 26 | return new Parser(sql.trim()).parse(); 27 | } catch (ParseException e) { 28 | throw new SqlParserException(e.getMessage()); 29 | } 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/SqlParserException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.parser; 18 | 19 | import org.jfaster.mango.exception.MangoException; 20 | 21 | /** 22 | * 解析sql异常 23 | * 24 | * @author ash 25 | */ 26 | public class SqlParserException extends MangoException { 27 | 28 | public SqlParserException(String message) { 29 | super(message); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/parser/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * SQL解析 19 | * 20 | * 依赖包: 21 | * binding 22 | * exception 23 | * type 24 | * util 25 | */ 26 | package org.jfaster.mango.parser; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/plugin/listener/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * logger type 19 | */ 20 | package org.jfaster.mango.plugin.listener; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/plugin/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * 插件 19 | * 20 | * 依赖包: 21 | * annotation 22 | * operator 23 | * sharding 24 | * stat 25 | * transaction 26 | * util 27 | */ 28 | package org.jfaster.mango.plugin; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/plugin/spring/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * integrated spring 19 | */ 20 | package org.jfaster.mango.plugin.spring; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/sharding/DatabaseShardingStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.sharding; 18 | 19 | /** 20 | * 数据库分片策略 21 | * 22 | * @author ash 23 | */ 24 | public interface DatabaseShardingStrategy { 25 | 26 | /** 27 | * 获得数据源工厂名称 28 | * 29 | * @param shardingParameter 取{@link org.jfaster.mango.annotation.DatabaseShardingBy}或{@link org.jfaster.mango.annotation.ShardingBy}修饰的参数 30 | * @return 31 | */ 32 | public String getDataSourceFactoryName(T shardingParameter); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/sharding/ModHundredTableShardingStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.sharding; 18 | 19 | /** 20 | * 模百分表 21 | * 22 | * @author ash 23 | */ 24 | public class ModHundredTableShardingStrategy implements TableShardingStrategy { 25 | 26 | @Override 27 | public String getTargetTable(String table, Number shardingParameter) { 28 | return table + "_" + Math.abs(shardingParameter.longValue() % 100); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/sharding/ModTenTableShardingStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.sharding; 18 | 19 | /** 20 | * 模十分表 21 | * 22 | * @author ash 23 | */ 24 | public class ModTenTableShardingStrategy implements TableShardingStrategy { 25 | 26 | @Override 27 | public String getTargetTable(String table, Number shardingParameter) { 28 | return table + "_" + Math.abs(shardingParameter.longValue() % 10); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/sharding/NotUseDatabaseShardingStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.sharding; 18 | 19 | /** 20 | * {@link org.jfaster.mango.annotation.Sharding#databaseShardingStrategy()}的默认值,表示不使用分库 21 | * 22 | * @author ash 23 | */ 24 | public final class NotUseDatabaseShardingStrategy implements DatabaseShardingStrategy { 25 | 26 | @Override 27 | public String getDataSourceFactoryName(Object shardingParameter) { 28 | throw new UnsupportedOperationException("error, unreachable code"); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/sharding/NotUseTableShardingStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.sharding; 18 | 19 | /** 20 | * {@link org.jfaster.mango.annotation.Sharding#tableShardingStrategy()}的默认值,表示不使用分表 21 | * 22 | * @author ash 23 | */ 24 | public final class NotUseTableShardingStrategy implements TableShardingStrategy { 25 | 26 | @Override 27 | public String getTargetTable(String table, Object shardingParameter) { 28 | throw new UnsupportedOperationException("error, unreachable code"); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/sharding/ShardingStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.sharding; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public interface ShardingStrategy extends DatabaseShardingStrategy, TableShardingStrategy { 23 | 24 | @Override 25 | public String getDataSourceFactoryName(D shardingParameter); 26 | 27 | @Override 28 | public String getTargetTable(String table, T shardingParameter); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/sharding/TableShardingStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.sharding; 18 | 19 | /** 20 | * 分表 21 | * 22 | * @author ash 23 | */ 24 | public interface TableShardingStrategy { 25 | 26 | /** 27 | * 获得分表后的表名 28 | * 29 | * @param table 取{@link org.jfaster.mango.annotation.DB#table()}中的值 30 | * @param shardingParameter 取{@link org.jfaster.mango.annotation.TableShardingBy}或{@link org.jfaster.mango.annotation.ShardingBy}修饰的参数 31 | * @return 32 | */ 33 | public String getTargetTable(String table, T shardingParameter); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/sharding/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * 数据库分片与表分片(也即分库分表) 19 | * 20 | * 依赖包: 21 | * none 22 | */ 23 | package org.jfaster.mango.sharding; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/transaction/Transaction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.transaction; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public interface Transaction { 23 | 24 | public void commit(); 25 | 26 | public void rollback(); 27 | 28 | public boolean isRollbackOnly(); 29 | 30 | public void setRollbackOnly(boolean rollbackOnly); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/transaction/TransactionAction.java: -------------------------------------------------------------------------------- 1 | package org.jfaster.mango.transaction; 2 | 3 | /** 4 | * @author ash 5 | */ 6 | public interface TransactionAction { 7 | 8 | void doInTransaction(TransactionStatus status); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/transaction/TransactionStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.transaction; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class TransactionStatus { 23 | 24 | private boolean rollbackOnly = false; 25 | 26 | public boolean isRollbackOnly() { 27 | return rollbackOnly; 28 | } 29 | 30 | public void setRollbackOnly(boolean rollbackOnly) { 31 | this.rollbackOnly = rollbackOnly; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/transaction/exception/CannotCreateTransactionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.transaction.exception; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class CannotCreateTransactionException extends TransactionException { 23 | 24 | public CannotCreateTransactionException(String msg) { 25 | super(msg); 26 | } 27 | 28 | public CannotCreateTransactionException(String msg, Throwable cause) { 29 | super(msg, cause); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/transaction/exception/CannotGetJdbcConnectionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.transaction.exception; 18 | 19 | import org.jfaster.mango.jdbc.exception.DataAccessResourceFailureException; 20 | 21 | /** 22 | * 不能获得jdbc连接异常 23 | * 24 | * @author ash 25 | */ 26 | public class CannotGetJdbcConnectionException extends DataAccessResourceFailureException { 27 | 28 | public CannotGetJdbcConnectionException(String message, Throwable cause) { 29 | super(message, cause); 30 | } 31 | 32 | public CannotGetJdbcConnectionException(String message) { 33 | super(message); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/transaction/exception/IllegalTransactionStateException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.transaction.exception; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class IllegalTransactionStateException extends TransactionException { 23 | 24 | public IllegalTransactionStateException(String msg) { 25 | super(msg); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/transaction/exception/TransactionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.transaction.exception; 18 | 19 | import org.jfaster.mango.exception.MangoException; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public abstract class TransactionException extends MangoException { 25 | 26 | public TransactionException(String msg) { 27 | super(msg); 28 | } 29 | 30 | public TransactionException(String msg, Throwable cause) { 31 | super(msg, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/transaction/exception/TransactionSystemException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.transaction.exception; 18 | 19 | /** 20 | * 事务相关异常 21 | * 22 | * @author ash 23 | */ 24 | public class TransactionSystemException extends TransactionException { 25 | 26 | 27 | public TransactionSystemException(String msg) { 28 | super(msg); 29 | } 30 | 31 | public TransactionSystemException(String msg, Throwable cause) { 32 | super(msg, cause); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/transaction/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * 事务 19 | * 20 | * 依赖包: 21 | * exception 22 | * operator.Mango 23 | * util 24 | */ 25 | package org.jfaster.mango.transaction; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/type/TypeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.type; 18 | 19 | import org.jfaster.mango.exception.MangoException; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public class TypeException extends MangoException { 25 | 26 | public TypeException(String msg) { 27 | super(msg); 28 | } 29 | 30 | public TypeException(String msg, Throwable cause) { 31 | super(msg, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/type/TypeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.type; 18 | 19 | import java.sql.PreparedStatement; 20 | import java.sql.ResultSet; 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * @author Clinton Begin 25 | * @author ash 26 | */ 27 | public interface TypeHandler { 28 | 29 | void setParameter(PreparedStatement ps, int index, T parameter) throws SQLException; 30 | 31 | T getResult(ResultSet rs, int index) throws SQLException; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/type/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * java类型到jdbc类型 19 | * 20 | * 依赖包: 21 | * exception 22 | * util 23 | */ 24 | package org.jfaster.mango.type; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/Arrays.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.util; 18 | 19 | import java.lang.reflect.Array; 20 | import java.util.List; 21 | 22 | /** 23 | * @author ash 24 | */ 25 | public class Arrays { 26 | 27 | public static Object toArray(List list, Class clazz) { 28 | Object array = Array.newInstance(clazz, list.size()); 29 | for (int i = 0; i < list.size(); i++) { 30 | Array.set(array, i, list.get(i)); 31 | } 32 | return array; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/Iterables.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.util; 18 | 19 | import java.util.Collection; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public class Iterables { 25 | 26 | public static int size(Iterable iterable) { 27 | return (iterable instanceof Collection) 28 | ? ((Collection) iterable).size() 29 | : Iterators.size(iterable.iterator()); 30 | } 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/Iterators.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.util; 18 | 19 | import java.util.Iterator; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public class Iterators { 25 | 26 | public static int size(Iterator iterator) { 27 | int count = 0; 28 | while (iterator.hasNext()) { 29 | iterator.next(); 30 | count++; 31 | } 32 | return count; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/NestedProperty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.util; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class NestedProperty { 23 | 24 | private StringBuilder nestedProperty = new StringBuilder(); 25 | private int num = 0; 26 | 27 | public void append(String property) { 28 | if (num++ == 0) { 29 | nestedProperty.append(property); 30 | } else { 31 | nestedProperty.append("." + property); 32 | } 33 | } 34 | 35 | public String getNestedProperty() { 36 | return nestedProperty.toString(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/Objects.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.util; 18 | 19 | import javax.annotation.Nullable; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public class Objects { 25 | 26 | public static boolean equal(@Nullable Object a, @Nullable Object b) { 27 | return a == b || (a != null && a.equals(b)); 28 | } 29 | 30 | public static int hashCode(@Nullable Object... objects) { 31 | return java.util.Arrays.hashCode(objects); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/Ticker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.util; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public abstract class Ticker { 23 | 24 | 25 | public abstract long read(); 26 | 27 | public static Ticker systemTicker() { 28 | return SYSTEM_TICKER; 29 | } 30 | 31 | private static final Ticker SYSTEM_TICKER = new Ticker() { 32 | 33 | @Override 34 | public long read() { 35 | return System.nanoTime(); 36 | } 37 | 38 | }; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/jdbc/OperatorType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.util.jdbc; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public enum OperatorType { 23 | 24 | QUERY, 25 | 26 | UPDATE, 27 | 28 | BATCHUPDATE, 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/local/CacheLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.util.local; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public interface CacheLoader { 23 | 24 | public V load(K key); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/local/LoadingCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.util.local; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public interface LoadingCache { 23 | 24 | public V get(K key); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/local/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * local cache 19 | */ 20 | package org.jfaster.mango.util.local; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/logging/ConsoleLoggerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.util.logging; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class ConsoleLoggerFactory extends InternalLoggerFactory { 23 | 24 | public static final InternalLoggerFactory INSTANCE = new ConsoleLoggerFactory(); 25 | 26 | private ConsoleLoggerFactory() { 27 | } 28 | 29 | @Override 30 | protected InternalLogger newInstance(String name) { 31 | return new ConsoleLogger(name); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/logging/InternalLogLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.util.logging; 18 | 19 | /** 20 | * The log level that {@link org.jfaster.mango.util.logging.InternalLogger} can log at. 21 | */ 22 | public enum InternalLogLevel { 23 | /** 24 | * 'TRACE' log level. 25 | */ 26 | TRACE, 27 | /** 28 | * 'DEBUG' log level. 29 | */ 30 | DEBUG, 31 | /** 32 | * 'INFO' log level. 33 | */ 34 | INFO, 35 | /** 36 | * 'WARN' log level. 37 | */ 38 | WARN, 39 | /** 40 | * 'ERROR' log level. 41 | */ 42 | ERROR 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/logging/Log4J2LoggerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.util.logging; 18 | 19 | import org.apache.logging.log4j.LogManager; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public class Log4J2LoggerFactory extends InternalLoggerFactory { 25 | 26 | public static final InternalLoggerFactory INSTANCE = new Log4J2LoggerFactory(); 27 | 28 | private Log4J2LoggerFactory() { 29 | } 30 | 31 | @Override 32 | public InternalLogger newInstance(String name) { 33 | return new Log4J2Logger(LogManager.getLogger(name)); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/logging/NoLoggerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.util.logging; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class NoLoggerFactory extends InternalLoggerFactory { 23 | 24 | public static final InternalLoggerFactory INSTANCE = new NoLoggerFactory(); 25 | 26 | private NoLoggerFactory() { 27 | } 28 | 29 | @Override 30 | protected InternalLogger newInstance(String name) { 31 | return new NoLogger(name); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/logging/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * 日志 19 | */ 20 | package org.jfaster.mango.util.logging; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | /** 18 | * 工具 19 | * 20 | * 依赖包: 21 | * none 22 | */ 23 | package org.jfaster.mango.util; -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/reflect/TokenTuple.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.util.reflect; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class TokenTuple { 23 | 24 | private final TypeToken first; 25 | private final TypeToken second; 26 | 27 | public TokenTuple(TypeToken first, TypeToken second) { 28 | this.first = first; 29 | this.second = second; 30 | } 31 | 32 | public TypeToken getFirst() { 33 | return first; 34 | } 35 | 36 | public TypeToken getSecond() { 37 | return second; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/jfaster/mango/util/reflect/TypeCapture.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.util.reflect; 18 | 19 | import java.lang.reflect.ParameterizedType; 20 | import java.lang.reflect.Type; 21 | 22 | /** 23 | * @author ash 24 | */ 25 | abstract class TypeCapture { 26 | 27 | final Type capture() { 28 | Type superclass = getClass().getGenericSuperclass(); 29 | if (!(superclass instanceof ParameterizedType)) { 30 | throw new IllegalArgumentException(superclass + " isn't parameterized"); 31 | } 32 | return ((ParameterizedType) superclass).getActualTypeArguments()[0]; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/org/jfaster/mango/crud/buildin/builder/BuildinDeleteBuilderTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.buildin.builder; 18 | 19 | import org.junit.Test; 20 | 21 | import static org.hamcrest.MatcherAssert.assertThat; 22 | import static org.hamcrest.Matchers.equalTo; 23 | 24 | /** 25 | * @author ash 26 | */ 27 | public class BuildinDeleteBuilderTest { 28 | 29 | @Test 30 | public void build() throws Exception { 31 | BuildinDeleteBuilder b = new BuildinDeleteBuilder("id2"); 32 | assertThat(b.buildSql(), equalTo("delete from #table where id2 = :1")); 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /src/test/java/org/jfaster/mango/crud/named/builder/NamedCountBuilderTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.builder; 18 | 19 | import org.junit.Test; 20 | 21 | import static org.hamcrest.MatcherAssert.assertThat; 22 | import static org.hamcrest.Matchers.equalTo; 23 | 24 | /** 25 | * @author ash 26 | */ 27 | public class NamedCountBuilderTest { 28 | 29 | @Test 30 | public void buildSql() throws Exception { 31 | NamedCountBuilder b = new NamedCountBuilder("where id = :1"); 32 | assertThat(b.buildSql(), equalTo("select count(1) from #table where id = :1")); 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /src/test/java/org/jfaster/mango/crud/named/builder/NamedDeleteBuilderTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.builder; 18 | 19 | import org.junit.Test; 20 | 21 | import static org.hamcrest.MatcherAssert.assertThat; 22 | import static org.hamcrest.Matchers.equalTo; 23 | 24 | /** 25 | * @author ash 26 | */ 27 | public class NamedDeleteBuilderTest { 28 | 29 | @Test 30 | public void buildSql() throws Exception { 31 | NamedDeleteBuilder b = new NamedDeleteBuilder("where id = :1"); 32 | assertThat(b.buildSql(), equalTo("delete from #table where id = :1")); 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /src/test/java/org/jfaster/mango/crud/named/parser/op/EqualsOpTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | import org.junit.Test; 20 | 21 | import static org.hamcrest.MatcherAssert.assertThat; 22 | import static org.hamcrest.Matchers.equalTo; 23 | 24 | /** 25 | * @author ash 26 | */ 27 | public class EqualsOpTest { 28 | 29 | @Test 30 | public void test() throws Exception { 31 | Op op = new EqualsOp(); 32 | assertThat(op.keyword(), equalTo("Equals")); 33 | assertThat(op.paramCount(), equalTo(1)); 34 | assertThat(op.render("id", new String[] {":1"}), equalTo("id = :1")); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /src/test/java/org/jfaster/mango/crud/named/parser/op/IsNullOpTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | import org.junit.Test; 20 | 21 | import static org.hamcrest.MatcherAssert.assertThat; 22 | import static org.hamcrest.Matchers.equalTo; 23 | 24 | /** 25 | * @author ash 26 | */ 27 | public class IsNullOpTest { 28 | 29 | @Test 30 | public void test() throws Exception { 31 | Op op = new IsNullOp(); 32 | assertThat(op.keyword(), equalTo("IsNull")); 33 | assertThat(op.paramCount(), equalTo(0)); 34 | assertThat(op.render("id", new String[] {}), equalTo("id is null")); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /src/test/java/org/jfaster/mango/crud/named/parser/op/LessThanOpTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.crud.named.parser.op; 18 | 19 | import org.junit.Test; 20 | 21 | import static org.hamcrest.MatcherAssert.assertThat; 22 | import static org.hamcrest.Matchers.equalTo; 23 | 24 | /** 25 | * @author ash 26 | */ 27 | public class LessThanOpTest { 28 | 29 | @Test 30 | public void test() throws Exception { 31 | Op op = new LessThanOp(); 32 | assertThat(op.keyword(), equalTo("LessThan")); 33 | assertThat(op.paramCount(), equalTo(1)); 34 | assertThat(op.render("id", new String[] {":1"}), equalTo("id < :1")); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /src/test/java/org/jfaster/mango/plugin/spring/TestDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.plugin.spring; 18 | 19 | import org.jfaster.mango.annotation.DB; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | @DB 25 | public interface TestDao { 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/org/jfaster/mango/support/MockReturnGeneratedId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.support; 18 | 19 | import org.jfaster.mango.annotation.ReturnGeneratedId; 20 | 21 | import java.lang.annotation.Annotation; 22 | 23 | /** 24 | * @author ash 25 | */ 26 | public class MockReturnGeneratedId implements Annotation, ReturnGeneratedId { 27 | 28 | @Override 29 | public Class annotationType() { 30 | throw new UnsupportedOperationException(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/jfaster/mango/support/model4table/Person.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.support.model4table; 18 | 19 | /** 20 | * @author ash 21 | */ 22 | public class Person { 23 | 24 | int id; 25 | String name; 26 | 27 | public Person(int id, String name) { 28 | this.id = id; 29 | this.name = name; 30 | } 31 | 32 | public int getId() { 33 | return id; 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/test/java/org/jfaster/mango/util/bean/SubClass.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author ash 3 | */ 4 | 5 | package org.jfaster.mango.util.bean; 6 | 7 | import org.jfaster.mango.annotation.Column; 8 | 9 | /** 10 | * @author ash 11 | */ 12 | public class SubClass extends SuperClass { 13 | 14 | private int price; 15 | 16 | @Column("") 17 | private String tree; 18 | 19 | private int age; 20 | 21 | @Override 22 | public String getTree() { 23 | return tree; 24 | } 25 | 26 | @Override 27 | public void setTree(String tree) { 28 | this.tree = tree; 29 | } 30 | 31 | public int getPrice() { 32 | return price; 33 | } 34 | 35 | public void setPrice(int price) { 36 | this.price = price; 37 | } 38 | 39 | public int getAge() { 40 | return age; 41 | } 42 | 43 | public void setAge(int age) { 44 | this.age = age; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/test/java/org/jfaster/mango/util/bean/SuperClass.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author ash 3 | */ 4 | 5 | package org.jfaster.mango.util.bean; 6 | 7 | import org.jfaster.mango.annotation.ID; 8 | 9 | /** 10 | * @author ash 11 | */ 12 | public class SuperClass { 13 | 14 | @ID 15 | private String id; 16 | 17 | private int uid; 18 | 19 | private String tree; 20 | 21 | public String getId() { 22 | return id; 23 | } 24 | 25 | public void setId(String id) { 26 | this.id = id; 27 | } 28 | 29 | public int getUid() { 30 | return uid; 31 | } 32 | 33 | public void setUid(int uid) { 34 | this.uid = uid; 35 | } 36 | 37 | public String getTree() { 38 | return tree; 39 | } 40 | 41 | public void setTree(String tree) { 42 | this.tree = tree; 43 | } 44 | 45 | public String getKey() { 46 | return "key"; 47 | } 48 | 49 | public void setKey(String key) { 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/test/java/org/jfaster/mango/util/logging/ConsoleLoggerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 mango.jfaster.org 3 | * 4 | * The Mango Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package org.jfaster.mango.util.logging; 18 | 19 | import org.junit.Test; 20 | 21 | /** 22 | * @author ash 23 | */ 24 | public class ConsoleLoggerTest { 25 | 26 | @Test 27 | public void testMsg() throws Exception { 28 | ConsoleLogger logger = new ConsoleLogger("org"); 29 | logger.trace("ok"); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/test/resources/hsqldb/account.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS account; 2 | 3 | CREATE TABLE account 4 | ( 5 | id INTEGER, 6 | balance INTEGER, 7 | PRIMARY KEY (id) 8 | ); -------------------------------------------------------------------------------- /src/test/resources/hsqldb/bt.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS bt; 2 | 3 | CREATE TABLE bt 4 | ( 5 | id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, 6 | is_ok BOOLEAN, 7 | PRIMARY KEY (id) 8 | ); -------------------------------------------------------------------------------- /src/test/resources/hsqldb/byte_info.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS byte_info; 2 | 3 | CREATE TABLE byte_info 4 | ( 5 | id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, 6 | array_byte VARBINARY(1000), 7 | single_byte INTEGER, 8 | PRIMARY KEY (id) 9 | ); -------------------------------------------------------------------------------- /src/test/resources/hsqldb/database.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=org.hsqldb.jdbcDriver 2 | jdbc.url=jdbc:hsqldb:mem:test 3 | jdbc.username=sa 4 | jdbc.password= -------------------------------------------------------------------------------- /src/test/resources/hsqldb/database1.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=org.hsqldb.jdbcDriver 2 | jdbc.url=jdbc:hsqldb:mem:test1 3 | jdbc.username=sa 4 | jdbc.password= -------------------------------------------------------------------------------- /src/test/resources/hsqldb/database2.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=org.hsqldb.jdbcDriver 2 | jdbc.url=jdbc:hsqldb:mem:test2 3 | jdbc.username=sa 4 | jdbc.password= -------------------------------------------------------------------------------- /src/test/resources/hsqldb/database3.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=org.hsqldb.jdbcDriver 2 | jdbc.url=jdbc:hsqldb:mem:test3 3 | jdbc.username=sa 4 | jdbc.password= -------------------------------------------------------------------------------- /src/test/resources/hsqldb/database4.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=org.hsqldb.jdbcDriver 2 | jdbc.url=jdbc:hsqldb:mem:test4 3 | jdbc.username=sa 4 | jdbc.password= -------------------------------------------------------------------------------- /src/test/resources/hsqldb/long_id_msg.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS long_id_msg; 2 | 3 | CREATE TABLE long_id_msg 4 | ( 5 | id BIGINT GENERATED BY DEFAULT AS IDENTITY (START WITH 1000000000000000, INCREMENT BY 1) NOT NULL, 6 | uid INTEGER, 7 | content VARCHAR(25), 8 | PRIMARY KEY (id) 9 | ); -------------------------------------------------------------------------------- /src/test/resources/hsqldb/msg.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS msg; 2 | 3 | CREATE TABLE msg 4 | ( 5 | id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, 6 | uid INTEGER, 7 | content VARCHAR(25), 8 | PRIMARY KEY (id) 9 | ); -------------------------------------------------------------------------------- /src/test/resources/hsqldb/msg_router1.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS msg_0; 2 | DROP TABLE IF EXISTS msg_1; 3 | DROP TABLE IF EXISTS msg_2; 4 | 5 | CREATE TABLE msg_0 6 | ( 7 | id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, 8 | uid INTEGER, 9 | content VARCHAR(25), 10 | PRIMARY KEY (id) 11 | ); 12 | 13 | CREATE TABLE msg_1 14 | ( 15 | id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, 16 | uid INTEGER, 17 | content VARCHAR(25), 18 | PRIMARY KEY (id) 19 | ); 20 | 21 | CREATE TABLE msg_2 22 | ( 23 | id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, 24 | uid INTEGER, 25 | content VARCHAR(25), 26 | PRIMARY KEY (id) 27 | ); 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/test/resources/hsqldb/msg_router2.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS msg_3; 2 | DROP TABLE IF EXISTS msg_4; 3 | DROP TABLE IF EXISTS msg_5; 4 | 5 | CREATE TABLE msg_3 6 | ( 7 | id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, 8 | uid INTEGER, 9 | content VARCHAR(25), 10 | PRIMARY KEY (id) 11 | ); 12 | 13 | CREATE TABLE msg_4 14 | ( 15 | id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, 16 | uid INTEGER, 17 | content VARCHAR(25), 18 | PRIMARY KEY (id) 19 | ); 20 | 21 | CREATE TABLE msg_5 22 | ( 23 | id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, 24 | uid INTEGER, 25 | content VARCHAR(25), 26 | PRIMARY KEY (id) 27 | ); 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/test/resources/hsqldb/msg_router3.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS msg_6; 2 | DROP TABLE IF EXISTS msg_7; 3 | DROP TABLE IF EXISTS msg_8; 4 | DROP TABLE IF EXISTS msg_9; 5 | 6 | CREATE TABLE msg_6 7 | ( 8 | id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, 9 | uid INTEGER, 10 | content VARCHAR(25), 11 | PRIMARY KEY (id) 12 | ); 13 | 14 | CREATE TABLE msg_7 15 | ( 16 | id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, 17 | uid INTEGER, 18 | content VARCHAR(25), 19 | PRIMARY KEY (id) 20 | ); 21 | 22 | CREATE TABLE msg_8 23 | ( 24 | id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, 25 | uid INTEGER, 26 | content VARCHAR(25), 27 | PRIMARY KEY (id) 28 | ); 29 | 30 | CREATE TABLE msg_9 31 | ( 32 | id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, 33 | uid INTEGER, 34 | content VARCHAR(25), 35 | PRIMARY KEY (id) 36 | ); 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/test/resources/hsqldb/order.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS t_order; 2 | 3 | CREATE TABLE t_order 4 | ( 5 | id VARCHAR(100), 6 | uid INTEGER, 7 | price INTEGER, 8 | PRIMARY KEY (id) 9 | ); 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/test/resources/hsqldb/person.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS person; 2 | 3 | CREATE TABLE person 4 | ( 5 | id INTEGER, 6 | name VARCHAR(25), 7 | PRIMARY KEY (id) 8 | ); -------------------------------------------------------------------------------- /src/test/resources/hsqldb/position.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS pos; 2 | 3 | CREATE TABLE pos 4 | ( 5 | x INTEGER, 6 | y INTEGER, 7 | v INTEGER, 8 | PRIMARY KEY (x, y) 9 | ); -------------------------------------------------------------------------------- /src/test/resources/hsqldb/table_include_all_types.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS table_include_all_types; 2 | 3 | CREATE TABLE table_include_all_types 4 | ( 5 | id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, 6 | nav_byte TINYINT, 7 | nav_short SMALLINT, 8 | nav_integer INTEGER, 9 | nav_long BIGINT, 10 | nav_float FLOAT, 11 | nav_double DOUBLE, 12 | nav_bollean BOOLEAN, 13 | nav_char CHAR, 14 | obj_byte TINYINT, 15 | obj_short SMALLINT, 16 | obj_integer INTEGER, 17 | obj_long BIGINT, 18 | obj_float FLOAT, 19 | obj_double DOUBLE, 20 | obj_bollean BOOLEAN, 21 | obj_char CHAR, 22 | obj_string VARCHAR(100), 23 | obj_big_decimal DECIMAL(100,2), 24 | obj_big_integer DECIMAL, 25 | nav_bytes VARBINARY(100), 26 | obj_bytes VARBINARY(100), 27 | obj_date TIMESTAMP, 28 | PRIMARY KEY (id) 29 | ); -------------------------------------------------------------------------------- /src/test/resources/hsqldb/user.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS user; 2 | 3 | CREATE TABLE user 4 | ( 5 | id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, 6 | name VARCHAR(25), 7 | age INTEGER, 8 | gender BOOLEAN, 9 | money BIGINT, 10 | update_time TIMESTAMP, 11 | PRIMARY KEY (id) 12 | ); -------------------------------------------------------------------------------- /src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/test/resources/mysql/account.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS account; 2 | 3 | CREATE TABLE `account` ( 4 | `id` int(11) NOT NULL, 5 | `balance` int(11), 6 | PRIMARY KEY (`id`) 7 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -------------------------------------------------------------------------------- /src/test/resources/mysql/bt.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS bt; 2 | 3 | CREATE TABLE `bt` ( 4 | `id` int(11) NOT NULL AUTO_INCREMENT, 5 | `is_ok` tinyint(1) DEFAULT NULL, 6 | PRIMARY KEY (`id`) 7 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -------------------------------------------------------------------------------- /src/test/resources/mysql/byte_info.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS byte_info; 2 | 3 | CREATE TABLE `byte_info` ( 4 | `id` int(11) NOT NULL AUTO_INCREMENT, 5 | `array_byte` varbinary(1000) NOT NULL, 6 | `single_byte` tinyint(4) NOT NULL, 7 | PRIMARY KEY (`id`) 8 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -------------------------------------------------------------------------------- /src/test/resources/mysql/database.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://localhost:3306/mango 3 | jdbc.username=root 4 | jdbc.password=root -------------------------------------------------------------------------------- /src/test/resources/mysql/database1.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://localhost:3306/mango1 3 | jdbc.username=root 4 | jdbc.password=root -------------------------------------------------------------------------------- /src/test/resources/mysql/database2.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://localhost:3306/mango2 3 | jdbc.username=root 4 | jdbc.password=root -------------------------------------------------------------------------------- /src/test/resources/mysql/database3.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://localhost:3306/mango3 3 | jdbc.username=root 4 | jdbc.password=root -------------------------------------------------------------------------------- /src/test/resources/mysql/database4.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://localhost:3306/mango4 3 | jdbc.username=root 4 | jdbc.password=root -------------------------------------------------------------------------------- /src/test/resources/mysql/long_id_msg.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS long_id_msg; 2 | 3 | CREATE TABLE `long_id_msg` ( 4 | `id` bigint(21) NOT NULL AUTO_INCREMENT, 5 | `uid` int(11) NOT NULL, 6 | `content` varchar(25) NOT NULL, 7 | PRIMARY KEY (`id`) 8 | ) ENGINE=InnoDB AUTO_INCREMENT=1000000000000000 DEFAULT CHARSET=utf8; -------------------------------------------------------------------------------- /src/test/resources/mysql/msg.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS msg; 2 | 3 | CREATE TABLE `msg` ( 4 | `id` int(11) NOT NULL AUTO_INCREMENT, 5 | `uid` int(11) DEFAULT NULL, 6 | `content` varchar(25) DEFAULT NULL, 7 | PRIMARY KEY (`id`) 8 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -------------------------------------------------------------------------------- /src/test/resources/mysql/msg_router1.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS msg_0; 2 | DROP TABLE IF EXISTS msg_1; 3 | DROP TABLE IF EXISTS msg_2; 4 | 5 | CREATE TABLE `msg_0` ( 6 | `id` bigint(21) NOT NULL AUTO_INCREMENT, 7 | `uid` int(11) NOT NULL, 8 | `content` varchar(25) NOT NULL, 9 | PRIMARY KEY (`id`) 10 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 11 | 12 | CREATE TABLE `msg_1` ( 13 | `id` bigint(21) NOT NULL AUTO_INCREMENT, 14 | `uid` int(11) NOT NULL, 15 | `content` varchar(25) NOT NULL, 16 | PRIMARY KEY (`id`) 17 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 18 | 19 | CREATE TABLE `msg_2` ( 20 | `id` bigint(21) NOT NULL AUTO_INCREMENT, 21 | `uid` int(11) NOT NULL, 22 | `content` varchar(25) NOT NULL, 23 | PRIMARY KEY (`id`) 24 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 25 | -------------------------------------------------------------------------------- /src/test/resources/mysql/msg_router2.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS msg_3; 2 | DROP TABLE IF EXISTS msg_4; 3 | DROP TABLE IF EXISTS msg_5; 4 | 5 | CREATE TABLE `msg_3` ( 6 | `id` bigint(21) NOT NULL AUTO_INCREMENT, 7 | `uid` int(11) NOT NULL, 8 | `content` varchar(25) NOT NULL, 9 | PRIMARY KEY (`id`) 10 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 11 | 12 | CREATE TABLE `msg_4` ( 13 | `id` bigint(21) NOT NULL AUTO_INCREMENT, 14 | `uid` int(11) NOT NULL, 15 | `content` varchar(25) NOT NULL, 16 | PRIMARY KEY (`id`) 17 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 18 | 19 | CREATE TABLE `msg_5` ( 20 | `id` bigint(21) NOT NULL AUTO_INCREMENT, 21 | `uid` int(11) NOT NULL, 22 | `content` varchar(25) NOT NULL, 23 | PRIMARY KEY (`id`) 24 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 25 | -------------------------------------------------------------------------------- /src/test/resources/mysql/msg_router3.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS msg_6; 2 | DROP TABLE IF EXISTS msg_7; 3 | DROP TABLE IF EXISTS msg_8; 4 | DROP TABLE IF EXISTS msg_9; 5 | 6 | CREATE TABLE `msg_6` ( 7 | `id` bigint(21) NOT NULL AUTO_INCREMENT, 8 | `uid` int(11) NOT NULL, 9 | `content` varchar(25) NOT NULL, 10 | PRIMARY KEY (`id`) 11 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 12 | 13 | CREATE TABLE `msg_7` ( 14 | `id` bigint(21) NOT NULL AUTO_INCREMENT, 15 | `uid` int(11) NOT NULL, 16 | `content` varchar(25) NOT NULL, 17 | PRIMARY KEY (`id`) 18 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 19 | 20 | CREATE TABLE `msg_8` ( 21 | `id` bigint(21) NOT NULL AUTO_INCREMENT, 22 | `uid` int(11) NOT NULL, 23 | `content` varchar(25) NOT NULL, 24 | PRIMARY KEY (`id`) 25 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 26 | 27 | CREATE TABLE `msg_9` ( 28 | `id` bigint(21) NOT NULL AUTO_INCREMENT, 29 | `uid` int(11) NOT NULL, 30 | `content` varchar(25) NOT NULL, 31 | PRIMARY KEY (`id`) 32 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -------------------------------------------------------------------------------- /src/test/resources/mysql/order.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS t_order; 2 | 3 | CREATE TABLE `t_order` ( 4 | `id` varchar(25) NOT NULL, 5 | `uid` int(11) NOT NULL, 6 | `price` int(11) NOT NULL, 7 | PRIMARY KEY (`id`) 8 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 9 | -------------------------------------------------------------------------------- /src/test/resources/mysql/person.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS person; 2 | 3 | CREATE TABLE `person` ( 4 | `id` int(11) NOT NULL, 5 | `name` varchar(25) DEFAULT NULL, 6 | PRIMARY KEY (`id`) 7 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -------------------------------------------------------------------------------- /src/test/resources/mysql/position.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `pos`; 2 | 3 | CREATE TABLE `pos` ( 4 | `x` int(11) NOT NULL, 5 | `y` int(11) NOT NULL, 6 | `v` int(11) NOT NULL, 7 | PRIMARY KEY (`x`,`y`) 8 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -------------------------------------------------------------------------------- /src/test/resources/mysql/table_include_all_types.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `table_include_all_types`; 2 | 3 | CREATE TABLE `table_include_all_types` ( 4 | `id` int(11) NOT NULL AUTO_INCREMENT, 5 | `nav_byte` int(11) DEFAULT NULL, 6 | `nav_short` int(11) DEFAULT NULL, 7 | `nav_integer` int(11) DEFAULT NULL, 8 | `nav_long` bigint(21) DEFAULT NULL, 9 | `nav_float` float(11,2) DEFAULT NULL, 10 | `nav_double` double(11,2) DEFAULT NULL, 11 | `nav_bollean` tinyint(11) DEFAULT NULL, 12 | `nav_char` char(50) DEFAULT NULL, 13 | `obj_byte` int(11) DEFAULT NULL, 14 | `obj_short` int(11) DEFAULT NULL, 15 | `obj_integer` int(11) DEFAULT NULL, 16 | `obj_long` bigint(21) DEFAULT NULL, 17 | `obj_float` float DEFAULT NULL, 18 | `obj_double` double DEFAULT NULL, 19 | `obj_bollean` tinyint(4) DEFAULT NULL, 20 | `obj_char` char(50) DEFAULT NULL, 21 | `obj_string` varchar(100) DEFAULT NULL, 22 | `obj_big_decimal` decimal(50,2) DEFAULT NULL, 23 | `obj_big_integer` decimal(50,0) DEFAULT NULL, 24 | `nav_bytes` varbinary(100) DEFAULT NULL, 25 | `obj_bytes` varbinary(100) DEFAULT NULL, 26 | `obj_date` timestamp NULL DEFAULT NULL, 27 | PRIMARY KEY (`id`) 28 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -------------------------------------------------------------------------------- /src/test/resources/mysql/user.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS user; 2 | 3 | CREATE TABLE `user` ( 4 | `id` int(11) NOT NULL AUTO_INCREMENT, 5 | `name` varchar(25) DEFAULT NULL, 6 | `age` int(11) DEFAULT NULL, 7 | `gender` tinyint(1) DEFAULT NULL, 8 | `money` bigint(21) DEFAULT NULL, 9 | `update_time` timestamp NULL DEFAULT NULL, 10 | PRIMARY KEY (`id`) 11 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -------------------------------------------------------------------------------- /src/test/resources/plugin/spring/applicationContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | org.jfaster.mango.plugin.spring 9 | 10 | 11 | 12 | 13 | org.jfaster.mango.plugin.spring.DefaultMangoFactoryBean 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /travis/after_success.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $TRAVIS_JDK_VERSION == "openjdk8" ]; then 4 | mvn clean test jacoco:report coveralls:report -DrepoToken=vtcV2hf6u7qBowa7Jvp1ymNA6H2ZPGh6r 5 | fi 6 | --------------------------------------------------------------------------------