1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-24 02:08:48 +00:00

feat: 重命名NotSave为ReadOnly

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-10-26 17:04:15 +08:00
parent 5bb985e9eb
commit 7a12e0ce9b
2 changed files with 21 additions and 21 deletions

View File

@ -1,19 +1,19 @@
package pw.yumc.YumCore.config.annotation; package pw.yumc.YumCore.config.annotation;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** /**
* 忽略配置保存 * 只读配置
* *
* @author * @author
* @since 2016年10月24日 上午00:11 * @since 2016年10月24日 上午00:11
*/ */
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
@Documented @Documented
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface NotSave { public @interface ReadOnly {
} }

View File

@ -14,8 +14,8 @@ import pw.yumc.YumCore.bukkit.Log;
import pw.yumc.YumCore.commands.exception.CommandParseException; import pw.yumc.YumCore.commands.exception.CommandParseException;
import pw.yumc.YumCore.config.annotation.ConfigNode; import pw.yumc.YumCore.config.annotation.ConfigNode;
import pw.yumc.YumCore.config.annotation.Default; import pw.yumc.YumCore.config.annotation.Default;
import pw.yumc.YumCore.config.annotation.NotSave;
import pw.yumc.YumCore.config.annotation.Nullable; import pw.yumc.YumCore.config.annotation.Nullable;
import pw.yumc.YumCore.config.annotation.ReadOnly;
import pw.yumc.YumCore.config.exception.ConfigParseException; import pw.yumc.YumCore.config.exception.ConfigParseException;
/** /**
@ -192,7 +192,7 @@ public abstract class AbstractInjectConfig {
*/ */
protected void setConfig(String path, Field field) { protected void setConfig(String path, Field field) {
try { try {
if (field.getAnnotation(NotSave.class) == null) { if (field.getAnnotation(ReadOnly.class) == null) {
config.set(path, field.get(this)); config.set(path, field.get(this));
} }
} catch (IllegalArgumentException | IllegalAccessException e) { } catch (IllegalArgumentException | IllegalAccessException e) {