本文整理汇总了Java中org.ini4j.Wini.get方法的典型用法代码示例。如果您正苦于以下问题:Java Wini.get方法的具体用法?Java Wini.get怎么用?Java Wini.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ini4j.Wini
的用法示例。
在下文中一共展示了Wini.get方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sample01
import org.ini4j.Wini; //导入方法依赖的package包/类
void sample01(String filename) throws IOException
{
Wini ini = new Wini(new File(filename));
int age = ini.get("happy", "age", int.class);
double height = ini.get("happy", "height", double.class);
String dir = ini.get("happy", "homeDir");
//}
//| ... assuming there is a section with name <<<happy>>>, which contains at least
//| the following options: <<<age>>>, <<<height>>> and <<<homeDir>>>, something like
//| this:
//|
//|+---------+
//| [happy]
//| age = 99
//| height = 77.66
//| homeDir = /home/happy
//|+---------+
//|
//|
assertEquals(DwarfsData.happy.age, age);
assertEquals(DwarfsData.happy.height, height, Helper.DELTA);
assertEquals(DwarfsData.happy.homeDir, dir);
}
示例2: AbstractContext
import org.ini4j.Wini; //导入方法依赖的package包/类
public AbstractContext() {
// Exists only to defeat instantiation
try {
StringBuilder sb = new StringBuilder();
sb.append(System.getProperty("user.home"));
sb.append(File.separator);
sb.append(".river-framework");
sb.append(File.separator);
sb.append(getConfigurationFileName());
String location = sb.toString();
Wini context = new Wini(new File(location));
testDatabaseServer = context.get("default", "test-database-server");
testDatabasePath = context.get("default", "test-database-path");
remoteDatabaseServer = context.get("default", "remote-database-server");
remoteDatabasePath = context.get("default", "remote-database-path");
} catch (Exception e) {
throw new RiverException(e);
}
}
示例3: unserialize
import org.ini4j.Wini; //导入方法依赖的package包/类
@Override
public void unserialize(Wini ini) {
String fontFamily = ini.get(INI_SECTION_TICKER, INI_VALUE_FONT_FAMILY);
if (fontFamily != null && fontFamily.length() > 0) {
this.fontFamily = fontFamily;
}
int fontSize = ini.get(INI_SECTION_TICKER, INI_VALUE_FONT_SIZE, int.class);
if (fontSize > 0) {
this.fontSize = fontSize;
}
String backgroundColor = ini.get(INI_SECTION_TICKER, INI_VALUE_BACKGROUND_COLOR);
if (backgroundColor != null && backgroundColor.length() > 0) {
this.backgroundColor = Color.web(backgroundColor);
}
String textColor = ini.get(INI_SECTION_TICKER, INI_VALUE_TEXT_COLOR);
if (textColor != null && textColor.length() > 0) {
this.textColor = Color.web(textColor);
}
}
示例4: create
import org.ini4j.Wini; //导入方法依赖的package包/类
/**
* Creates a car counter instance.
*
* @param ini the configuration file.
* @return the car counter.
*/
public CarCounter create(Wini ini)
{
String implementation = ini.get("Counting", "implementation", String.class);
if ("opencv".equals(implementation))
{
return new OpencvCarCounter();
}
else if ("noop".equals(implementation))
{
return new NoopCarCounter();
}
else
{
throw new IllegalStateException("Unknown counting backend: " + implementation);
}
}
示例5: DefaultProcessor
import org.ini4j.Wini; //导入方法依赖的package包/类
public DefaultProcessor(Wini ini)
{
dateTimeExtractor = new MotionDateTimeExtractor();// TODO: via config
carCounter = new CarCounterFactory().create(ini);
storage = new StorageFactory().create(ini);
String incoming = ini.get("Processing", "incoming", String.class);
Preconditions.checkState(StringUtils.isNotBlank(incoming), "An incoming directory is required");
incomingDirectory = Paths.get(incoming);
if (!Files.isDirectory(incomingDirectory))
{
throw new IllegalStateException("Incoming path is not an existing directory: " + incoming);
}
String data = ini.get("Processing", "data", String.class);
Preconditions.checkState(StringUtils.isNotBlank(data), "An data directory is required");
dataDirectory = Paths.get(data);
if (!Files.isDirectory(dataDirectory))
{
throw new IllegalStateException("Data path is not an existing directory: " + data);
}
logger.info(String.format("Starting processor: incoming:[%s] data:[%s]", incoming, data));
}
示例6: getUrl
import org.ini4j.Wini; //导入方法依赖的package包/类
public static String getUrl(String tipo, String servico) throws CteException {
try {
ConfiguracoesIniciais config = ConfiguracoesIniciais.getInstance();
String secao = tipo + "_" + config.getEstado() + "_"
+ (config.getAmbiente().equals(ConstantesCte.AMBIENTE.HOMOLOGACAO) ? "H" : "P");
InputStream is = WebServiceUtil.class.getResourceAsStream("/WebServicesCte.ini");
Wini ini = new Wini(is);
String url = ini.get(secao, "Usar");
if (url == null) {
url = secao;
}
if (!config.getEstado().equals(Estados.MG)
|| !config.getEstado().equals(Estados.MS)
|| !config.getEstado().equals(Estados.MT)
|| !config.getEstado().equals(Estados.RS)
|| !config.getEstado().equals(Estados.SP)
|| !config.getEstado().equals(Estados.PR)) {
secao = url;
}
if (servico.equals(ConstantesCte.SERVICOS.DISTRIBUICAO_DFE)) {
url = ini.get("CTe_AN_"+(config.getAmbiente().equals(ConstantesCte.AMBIENTE.HOMOLOGACAO) ? "H" : "P"), servico);
} else {
url = ini.get(secao, servico + "_" + config.getVersao());
}
System.out.println("Versão Cte: " + config.getVersao() + " - WebService: " + url);
return url;
} catch (IOException e) {
throw new CteException(e.getMessage());
}
}
示例7: getUrlConsultaCadastro
import org.ini4j.Wini; //导入方法依赖的package包/类
public static String getUrlConsultaCadastro(String uf) throws NfeException {
String tipo = ConstantesUtil.NFE;
String servico = ConstantesUtil.SERVICOS.CONSULTA_CADASTRO;
try {
ConfiguracoesIniciaisNfe config = ConfiguracoesIniciaisNfe.getInstance();
String secao = tipo + "_" + uf.toUpperCase() + "_"
+ (config.getAmbiente().equals(ConstantesUtil.AMBIENTE.HOMOLOGACAO) ? "H" : "P");
InputStream is = WebServiceUtil.class.getResourceAsStream("/WebServices.ini");
Wini ini = new Wini(is);
String url = ini.get(secao, "Usar");
url = ini.get(secao, servico);
if(ObjetoUtil.isEmpty(url)){
throw new NfeException("WebService de "+servico+" não encontrado para "+uf);
}
System.out.println("WebService - " + url);
return url;
} catch (IOException e) {
throw new NfeException(e.getMessage());
}
}
示例8: load
import org.ini4j.Wini; //导入方法依赖的package包/类
public void load() throws IOException {
if (this.inifile == null || this.inifile.isEmpty()) {
return;
}
File f = new File(this.inifile);
if (f.exists() && f.isFile()) {
Wini ini = new Wini(f);
String bindHost = ini.get("server", "host", String.class);
Integer bindPort = ini.get("server", "port", Integer.class);
Integer threadNum = ini.get("server", "thread", Integer.class);
String redisHost = ini.get("redis", "host", String.class);
Integer redisPort = ini.get("redis", "port", Integer.class);
Integer redisDb = ini.get("redis", "db", Integer.class);
Integer interval = ini.get("watch", "interval", Integer.class);
if (bindHost != null) {
this.bindHost = bindHost;
}
if (bindPort != null) {
this.bindPort = bindPort;
}
if(threadNum != null) {
this.threadNum = threadNum;
}
if (redisHost != null) {
this.redisHost = redisHost;
}
if (redisPort != null) {
this.redisPort = redisPort;
}
if (redisDb != null) {
this.redisDb = redisDb;
}
if (interval != null) {
this.interval = interval;
}
}
}
示例9: getDefaultLanguages
import org.ini4j.Wini; //导入方法依赖的package包/类
/**
* Gets an arraylist of languages to compile by default.
*
* @return
*/
public static ArrayList<String> getDefaultLanguages() {
String defaultLang = ALL_LANG;
Wini settingsini = ModManager.LoadSettingsINI();
String modmakerLanguage = settingsini.get("Settings", "modmaker_language");
if (modmakerLanguage != null && !modmakerLanguage.equals("")) {
//language setting exists
defaultLang = modmakerLanguage;
}
return getLanguages(defaultLang);
}
示例10: unserialize
import org.ini4j.Wini; //导入方法依赖的package包/类
@Override
public void unserialize(Wini ini) {
posX = ini.get(INI_SECTION_PROJECTOR, INI_VALUE_POSX, int.class);
posY = ini.get(INI_SECTION_PROJECTOR, INI_VALUE_POSY, int.class);
width = ini.get(INI_SECTION_PROJECTOR, INI_VALUE_WIDTH, int.class);
height = ini.get(INI_SECTION_PROJECTOR, INI_VALUE_HEIGHT, int.class);
}
示例11: unserialize
import org.ini4j.Wini; //导入方法依赖的package包/类
@Override
public void unserialize(Wini ini) {
String tickerMessage = ini.get(INI_SECTION_TICKER, INI_VALUE_MESSAGE);
if (tickerMessage != null && tickerMessage.length() > 0) {
this.tickerMessage = tickerMessage;
}
int webserverPort = ini.get(INI_SECTION_WEBSERVER, INI_VALUE_PORT, int.class);
if (webserverPort > 0) {
this.webserverPort = webserverPort;
}
projectorSettings.unserialize(ini);
tickerStyle.unserialize(ini);
}
示例12: create
import org.ini4j.Wini; //导入方法依赖的package包/类
public Storage create(Wini ini)
{
String implementation = ini.get("Storage", "implementation", String.class);
if ("sqlite".equals(implementation))
{
return new SqliteStorage(ini);
}
else
{
throw new IllegalStateException("Unknown storage backend: " + implementation);
}
}
示例13: getUrl
import org.ini4j.Wini; //导入方法依赖的package包/类
public static String getUrl(String tipo, String servico) throws NfeException {
try {
ConfiguracoesIniciaisNfe config = ConfiguracoesIniciaisNfe.getInstance();
String secao = tipo + "_" + config.getEstado() + "_"
+ (config.getAmbiente().equals(ConstantesUtil.AMBIENTE.HOMOLOGACAO) ? "H" : "P");
InputStream is = WebServiceUtil.class.getResourceAsStream("/WebServices.ini");
Wini ini = new Wini(is);
String url = ini.get(secao, "Usar");
if (servico.equals(ConstantesUtil.SERVICOS.DISTRIBUICAO_DFE) || servico.equals(ConstantesUtil.SERVICOS.MANIFESTACAO)) {
secao = config.getAmbiente().equals(ConstantesUtil.AMBIENTE.HOMOLOGACAO) ? "NFe_AN_H" : "NFe_AN_P";
if (servico.equals(ConstantesUtil.SERVICOS.MANIFESTACAO)) {
servico = ConstantesUtil.SERVICOS.EVENTO;
}
} else if (!servico.equals(ConstantesUtil.SERVICOS.URL_CONSULTANFCE)
&& !servico.equals(ConstantesUtil.SERVICOS.URL_QRCODE) && ObjetoUtil.differentNull(url)) {
secao = url;
} else if(config.isContigenciaSCAN()){
//SVC-RS
if(config.getEstado().equals(Estados.GO)
|| config.getEstado().equals(Estados.AM)
|| config.getEstado().equals(Estados.BA)
|| config.getEstado().equals(Estados.CE)
|| config.getEstado().equals(Estados.MA)
|| config.getEstado().equals(Estados.MS)
|| config.getEstado().equals(Estados.MT)
|| config.getEstado().equals(Estados.PA)
|| config.getEstado().equals(Estados.PE)
|| config.getEstado().equals(Estados.PI)
|| config.getEstado().equals(Estados.PR)){
secao = tipo + "_SVRS_" + (config.getAmbiente().equals(ConstantesUtil.AMBIENTE.HOMOLOGACAO) ? "H" : "P");
//SVC-AN
}else{
secao = tipo + "_SVAN_" + (config.getAmbiente().equals(ConstantesUtil.AMBIENTE.HOMOLOGACAO) ? "H" : "P");
}
}
url = ini.get(secao, servico);
if(ObjetoUtil.isEmpty(url)){
throw new NfeException("WebService de "+servico+" não encontrado para "+config.getEstado().getNome());
}
System.out.println("WebService - " + url);
return url;
} catch (IOException e) {
throw new NfeException(e.getMessage());
}
}