com.rathravane.till.nv.rrNvReadable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of silt Show documentation
Show all versions of silt Show documentation
A small collection of classes used in various Rathravane systems.
/*
* Copyright 2006-2014, Rathravane LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rathravane.till.nv;
import java.util.Collection;
import java.util.Map;
/**
* A data supplier
*/
public interface rrNvReadable
{
class loadException extends Exception
{
public loadException ( String reason ) { super(reason); }
public loadException ( Throwable cause ) { super(cause); }
private static final long serialVersionUID = 1L;
}
class missingReqdSetting extends Exception
{
public missingReqdSetting ( String key ) { super("Missing required setting \"" + key + "\"" ); fKey = key; }
public missingReqdSetting ( String key, Throwable cause ) { super("Missing required setting \"" + key + "\" because " + cause.getMessage (), cause ); fKey=key; }
private static final long serialVersionUID = 1L;
public final String fKey;
}
class invalidSettingValue extends Exception
{
public invalidSettingValue ( String key ) { super("Invalid setting for \"" + key + "\"" ); fKey=key; }
public invalidSettingValue ( String key, Throwable cause ) { super("Invalid setting for \"" + key + "\" because " + cause.getMessage (), cause ); fKey=key; }
public invalidSettingValue ( String key, String why ) { super("Invalid setting for \"" + key + "\" because " + why ); fKey=key; }
public invalidSettingValue ( String key, Throwable cause, String why ) { super("Invalid setting for \"" + key + "\" because " + why, cause ); fKey=key; }
private static final long serialVersionUID = 1L;
public final String fKey;
}
/**
* For use with systems like Velocity, that introspect for "get(key)" and expect a value or null
* @param key
* @return a value, or null
*/
String get ( String key );
String getString ( String key ) throws missingReqdSetting;
String getString ( String key, String defValue );
char getCharacter ( String key ) throws missingReqdSetting;
char getCharacter ( String key, char defValue );
boolean getBoolean ( String key ) throws missingReqdSetting;
boolean getBoolean ( String key, boolean defValue );
int getInt ( String key ) throws missingReqdSetting;
int getInt ( String key, int defValue );
long getLong ( String key ) throws missingReqdSetting;
long getLong ( String key, long defValue );
double getDouble ( String key ) throws missingReqdSetting;
double getDouble ( String key, double defValue );
byte[] getBytes ( String key ) throws missingReqdSetting, invalidSettingValue;
byte[] getBytes ( String key, byte[] defValue );
/**
* Get a set of strings given a key. Most implementations expect to use "getString()" and then
* split the value by commas.
*
* @param key
* @return a string array
* @throws missingReqdSetting
*/
String[] getStrings ( String key ) throws missingReqdSetting;
String[] getStrings ( String key, String[] defValue );
int size ();
boolean hasValueFor ( String key );
Collection getAllKeys ();
Map getCopyAsMap ();
void copyInto ( rrNvWriteable writeable );
void copyInto ( Map writeable );
void rescan () throws loadException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy