refactor(nacos-api:config): Modify ConfigYype to be an enumeration class
This commit is contained in:
parent
22df13b0e2
commit
44e3c5e224
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 = the "License");
|
* Licensed under the Apache License, Version 2.0 = the "License"");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
@ -20,36 +20,45 @@ package com.alibaba.nacos.api.config;
|
|||||||
* @author liaochuntao
|
* @author liaochuntao
|
||||||
* @date 2019-06-14 21:12
|
* @date 2019-06-14 21:12
|
||||||
**/
|
**/
|
||||||
public class ConfigType {
|
public enum ConfigType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* config type is "properties"
|
* config type is "properties"
|
||||||
*/
|
*/
|
||||||
public static final String PROPERTIES = "properties";
|
PROPERTIES("properties"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* config type is "xml"
|
* config type is "xml"
|
||||||
*/
|
*/
|
||||||
public static final String XML = "xml";
|
XML("xml"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* config type is "json"
|
* config type is "json"
|
||||||
*/
|
*/
|
||||||
public static final String JSON = "json";
|
JSON("json"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* config type is "text"
|
* config type is "text"
|
||||||
*/
|
*/
|
||||||
public static final String TEXT = "text";
|
TEXT("text"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* config type is "html"
|
* config type is "html"
|
||||||
*/
|
*/
|
||||||
public static final String HTML = "html";
|
HTML("html"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* config type is "yaml"
|
* config type is "yaml"
|
||||||
*/
|
*/
|
||||||
public static final String YAML = "yaml";
|
YAML("yaml");
|
||||||
|
|
||||||
|
String type;
|
||||||
|
|
||||||
|
ConfigType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ package com.alibaba.nacos.api.config.annotation;
|
|||||||
|
|
||||||
import com.alibaba.nacos.api.annotation.NacosProperties;
|
import com.alibaba.nacos.api.annotation.NacosProperties;
|
||||||
import com.alibaba.nacos.api.common.Constants;
|
import com.alibaba.nacos.api.common.Constants;
|
||||||
|
import com.alibaba.nacos.api.config.ConfigType;
|
||||||
import com.alibaba.nacos.api.config.convert.NacosConfigConverter;
|
import com.alibaba.nacos.api.config.convert.NacosConfigConverter;
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
@ -48,6 +49,13 @@ public @interface NacosConfigListener {
|
|||||||
*/
|
*/
|
||||||
String dataId();
|
String dataId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nacos Config type
|
||||||
|
*
|
||||||
|
* @return "properties"
|
||||||
|
*/
|
||||||
|
ConfigType type() default ConfigType.PROPERTIES;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify {@link NacosConfigConverter Nacos configuraion convertor} class to convert target type instance.
|
* Specify {@link NacosConfigConverter Nacos configuraion convertor} class to convert target type instance.
|
||||||
*
|
*
|
||||||
|
@ -55,7 +55,7 @@ public @interface NacosConfigurationProperties {
|
|||||||
*
|
*
|
||||||
* @return default value is <code>false</code>
|
* @return default value is <code>false</code>
|
||||||
*/
|
*/
|
||||||
String type() default ConfigType.PROPERTIES;
|
ConfigType type() default ConfigType.PROPERTIES;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It indicates the properties of current doBind bean is auto-refreshed when Nacos configuration is changed.
|
* It indicates the properties of current doBind bean is auto-refreshed when Nacos configuration is changed.
|
||||||
|
Loading…
Reference in New Issue
Block a user