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
Showing
28 changed files
with
642 additions
and
409 deletions.
There are no files selected for viewing
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
7 changes: 7 additions & 0 deletions
7
src/main/java/com/tvd12/properties/file/bean/Transformer.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,7 @@ | ||
package com.tvd12.properties.file.bean; | ||
|
||
public interface Transformer { | ||
|
||
public Object transform(Object input); | ||
|
||
} |
9 changes: 5 additions & 4 deletions
9
src/main/java/com/tvd12/properties/file/constant/Constants.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 |
---|---|---|
@@ -1,13 +1,14 @@ | ||
package com.tvd12.properties.file.constant; | ||
|
||
public interface Constants { | ||
public final class Constants { | ||
|
||
static final String COMMENT = "written by com.tvd12:properties-file"; | ||
|
||
static final String DATE_FORMATS[] = { | ||
public static final String COMMENT = "written by com.tvd12:properties-file"; | ||
public static final String DATE_FORMATS[] = { | ||
"yyyy-MM-dd'T'HH:mm:ss.SSSZ", | ||
"YYYY-MM-DD HH:MM:SS", | ||
"EEE MMM dd kk:mm:ss z yyyy" | ||
}; | ||
|
||
private Constants() { | ||
} | ||
} |
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
48 changes: 48 additions & 0 deletions
48
src/main/java/com/tvd12/properties/file/reflect/ReflectionClassUtils.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,48 @@ | ||
package com.tvd12.properties.file.reflect; | ||
|
||
import java.lang.reflect.Field; | ||
import java.lang.reflect.Method; | ||
import java.lang.reflect.Modifier; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public final class ReflectionClassUtils { | ||
|
||
private ReflectionClassUtils() { | ||
} | ||
|
||
public static Set<Field> getValidFields(Class<?> clazz) { | ||
Class<?> current = clazz; | ||
Set<Field> answer = new HashSet<>(); | ||
while(current != Object.class) { | ||
Field[] fields = current.getDeclaredFields(); | ||
for(Field field : fields) { | ||
int modifiers = field.getModifiers(); | ||
if((modifiers & Modifier.STATIC) != 0) | ||
continue; | ||
answer.add(field); | ||
} | ||
current = current.getSuperclass(); | ||
} | ||
return answer; | ||
} | ||
|
||
public static Set<Method> getPublicMethods(Class<?> clazz) { | ||
Class<?> current = clazz; | ||
Set<Method> answer = new HashSet<>(); | ||
while(current != Object.class) { | ||
Method[] methods = current.getDeclaredMethods(); | ||
for(Method method : methods) { | ||
int modifiers = method.getModifiers(); | ||
if((modifiers & Modifier.PUBLIC) == 0) | ||
continue; | ||
if((modifiers & Modifier.ABSTRACT) != 0) | ||
continue; | ||
answer.add(method); | ||
} | ||
current = current.getSuperclass(); | ||
} | ||
return answer; | ||
} | ||
|
||
} |
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
Oops, something went wrong.