All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kapil.framework.reader.IMessageReader Maven / Gradle / Ivy

Go to download

This is a set of utilities and classes that I have found useful over the years. In my career spanning over a decade, I have time and again written the same code or some part of the code over and over again. I never found the time to collate the details in a reusable library. This project will be a collection of such files. The work that I have been doing is more than 5 years old, however the project has been conceived in 2011.

The newest version!
/*******************************************************************************
 * Copyright 2011 @ Kapil Viren Ahuja
 * 
 * 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.kapil.framework.reader;

import java.util.List;
import java.util.Locale;

/**
 * 

* An interface that provides functions to read messages based a key from an underlying data source. * The interface also provides the method for implementations to read messages for a specific locale. *

* *

* Once the {@link IMessageReader} has been created, there is no provision to add more datasources to the same. *

*/ public interface IMessageReader { /** * Reads a string message from the underlying data sources based on a key. * * @param key a {@link String} representing unique identifier for the message. * * @return {@link String} containing the message for the key passed */ String getMessage(String key); /** * Reads a localised string message from the underlying data sources based on a key. * * @param key a {@link String} representing unique identifier for the message. * @param locale a {@link String} representing the locale for which the message needs to be located. * * @return {@link String} containing the message for the key passed */ String getMessage(String key, Locale locale); /** * Reads a boolean property from a data source, provided a string key to locate the property. * * @param key Key to locate the property. * @return A boolean value. */ public abstract boolean getBooleanProperty(String name); /** * Reads an integer property from a data source, provided a string key to locate the property. * * @param key Key to locate the property. * @return An integer value. */ public abstract int getIntegerProperty(String name); /** *

* Returns a list of property values sharing the same name. *

* * @param name A {@link java.lang.String} containing property name. * @return A {@link java.util.List} of {@link java.lang.String} values containing all values available for the * property. */ public abstract List getList(String name); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy