forked from alibaba/COLA
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
fulan.zjf
committed
Mar 7, 2019
1 parent
138c0d1
commit 40dbe44
Showing
177 changed files
with
5,675 additions
and
49 deletions.
There are no files selected for viewing
3 changes: 0 additions & 3 deletions
3
...ources/archetype-resources/__rootArtifactId__-domain/src/main/resources/sample.properties
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
...ources/archetype-resources/__rootArtifactId__-domain/src/test/resources/sample.properties
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...hetype/src/main/resources/archetype-resources/start/src/main/resources/logback-spring.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#set( $symbol_pound = '#' ) | ||
#set( $symbol_dollar = '$' ) | ||
#set( $symbol_escape = '\' ) | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<configuration> | ||
<!-- https://github.com/spring-projects/spring-boot/blob/v1.4.2.RELEASE/spring-boot/src/main/resources/org/springframework/boot/logging/logback/defaults.xml --> | ||
<include resource="org/springframework/boot/logging/logback/defaults.xml" /> | ||
|
||
<property name="APP_NAME" value="${rootArtifactId}" /> | ||
<property name="LOG_PATH" value="${symbol_dollar}{user.home}/${symbol_dollar}{APP_NAME}/logs" /> | ||
<property name="LOG_FILE" value="${symbol_dollar}{LOG_PATH}/application.log" /> | ||
|
||
<appender name="APPLICATION" | ||
class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<file>${symbol_dollar}{LOG_FILE}</file> | ||
<encoder> | ||
<pattern>${symbol_dollar}{FILE_LOG_PATTERN}</pattern> | ||
</encoder> | ||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||
<fileNamePattern>${symbol_dollar}{LOG_FILE}.%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||
<maxHistory>7</maxHistory> | ||
<maxFileSize>50MB</maxFileSize> | ||
<totalSizeCap>20GB</totalSizeCap> | ||
</rollingPolicy> | ||
</appender> | ||
|
||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<pattern>${symbol_dollar}{CONSOLE_LOG_PATTERN}</pattern> | ||
<charset>utf8</charset> | ||
</encoder> | ||
</appender> | ||
|
||
<root level="INFO"> | ||
<appender-ref ref="CONSOLE" /> | ||
<appender-ref ref="APPLICATION" /> | ||
</root> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...ork/cola-core/src/main/java/com/alibaba/cola/validator/AbstractValidationInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.alibaba.cola.validator; | ||
|
||
import org.apache.commons.lang3.ClassUtils; | ||
|
||
import java.lang.reflect.Field; | ||
|
||
/** | ||
* AbstractValidationInterceptor | ||
* | ||
* @author Frank Zhang | ||
* @date 2019-03-02 4:44 PM | ||
*/ | ||
public abstract class AbstractValidationInterceptor { | ||
|
||
/** | ||
* Recursively do validation to the target if the field is not primitive or wrapped. | ||
* | ||
* @param target | ||
*/ | ||
protected void validate(Object target){ | ||
doValidation(target); | ||
Field[] fields = target.getClass().getDeclaredFields(); | ||
for (Field field : fields){ | ||
if(isChildField(field.getType())){ | ||
continue; | ||
} | ||
Object fieldValue = null; | ||
try { | ||
field.setAccessible(true); | ||
fieldValue = field.get(target); | ||
} catch (IllegalAccessException e) { | ||
continue; | ||
} | ||
|
||
//Recursively validate | ||
validate(fieldValue); | ||
} | ||
} | ||
|
||
private boolean isChildField(Class type){ | ||
return type.equals(String.class) || ClassUtils.isPrimitiveOrWrapper(type); | ||
} | ||
|
||
abstract protected void doValidation(Object target); | ||
} |
Oops, something went wrong.