Package de.mhus.lib.core
Class AbstractProperties
- java.lang.Object
-
- de.mhus.lib.core.MLog
-
- de.mhus.lib.core.lang.MObject
-
- de.mhus.lib.core.AbstractProperties
-
- All Implemented Interfaces:
ILog,IProperties,IReadProperties,MNlsProvider,Nls,Serializable,Iterable<Map.Entry<String,Object>>,Map<String,Object>
- Direct Known Subclasses:
MNls,MProperties,PropertiesSubset,ResourceNode
public abstract class AbstractProperties extends MObject implements IProperties
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractProperties()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(Object key)Objectget(Object key)booleangetBoolean(String name)booleangetBoolean(String name, boolean def)CalendargetCalendar(String name)DategetDate(String name)doublegetDouble(String name, double def)floatgetFloat(String name, float def)StringgetFormatted(String name, String def, Object... values)intgetInt(String name, int def)longgetLong(String name, long def)NumbergetNumber(String name, Number def)abstract ObjectgetProperty(String name)Overwrite this function to provide values in string format.StringgetString(String name)StringgetString(String name, String def)abstract booleanisEditable()Overwrite this function and return true if the property set can be edited.booleanisEmpty()abstract booleanisProperty(String name)Return true if the property exists.Iterator<Map.Entry<String,Object>>iterator()abstract Set<String>keys()Set<String>keySet()Objectput(String key, Object value)voidputAll(Map<? extends String,? extends Object> m)voidputReadProperties(IReadProperties m)Objectremove(Object key)abstract voidremoveProperty(String key)Remove the property field in the list of properties.voidsetBoolean(String name, boolean value)voidsetCalendar(String name, Calendar value)voidsetDate(String name, Date value)voidsetDouble(String name, double value)voidsetFloat(String name, float value)voidsetInt(String name, int value)voidsetLong(String name, long value)voidsetNumber(String name, Number value)abstract voidsetProperty(String key, Object value)Overwrite this function to allow changes in properties.voidsetString(String name, String value)abstract intsize()Map<String,Object>toMap()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.mhus.lib.core.IProperties
clear
-
Methods inherited from interface de.mhus.lib.core.IReadProperties
containsValue, entrySet, values
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsValue, entrySet, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll, values
-
-
-
-
Method Detail
-
getProperty
public abstract Object getProperty(String name)
Overwrite this function to provide values in string format.- Specified by:
getPropertyin interfaceIReadProperties- Parameters:
name-- Returns:
- null if the property not exists or the property value.
-
getString
public String getString(String name, String def)
- Specified by:
getStringin interfaceIReadProperties
-
getString
public String getString(String name) throws de.mhus.lib.errors.MException
- Specified by:
getStringin interfaceIReadProperties- Throws:
de.mhus.lib.errors.MException
-
getBoolean
public boolean getBoolean(String name, boolean def)
- Specified by:
getBooleanin interfaceIReadProperties
-
getBoolean
public boolean getBoolean(String name) throws de.mhus.lib.errors.MException
- Specified by:
getBooleanin interfaceIReadProperties- Throws:
de.mhus.lib.errors.MException
-
getInt
public int getInt(String name, int def)
- Specified by:
getIntin interfaceIReadProperties
-
getLong
public long getLong(String name, long def)
- Specified by:
getLongin interfaceIReadProperties
-
getFloat
public float getFloat(String name, float def)
- Specified by:
getFloatin interfaceIReadProperties
-
getDouble
public double getDouble(String name, double def)
- Specified by:
getDoublein interfaceIReadProperties
-
getCalendar
public Calendar getCalendar(String name) throws de.mhus.lib.errors.MException
- Specified by:
getCalendarin interfaceIReadProperties- Throws:
de.mhus.lib.errors.MException
-
getDate
public Date getDate(String name)
- Specified by:
getDatein interfaceIReadProperties
-
setString
public void setString(String name, String value)
- Specified by:
setStringin interfaceIProperties
-
setInt
public void setInt(String name, int value)
- Specified by:
setIntin interfaceIProperties
-
setLong
public void setLong(String name, long value)
- Specified by:
setLongin interfaceIProperties
-
setDouble
public void setDouble(String name, double value)
- Specified by:
setDoublein interfaceIProperties
-
setFloat
public void setFloat(String name, float value)
- Specified by:
setFloatin interfaceIProperties
-
setBoolean
public void setBoolean(String name, boolean value)
- Specified by:
setBooleanin interfaceIProperties
-
setCalendar
public void setCalendar(String name, Calendar value)
- Specified by:
setCalendarin interfaceIProperties
-
setDate
public void setDate(String name, Date value)
- Specified by:
setDatein interfaceIProperties
-
setNumber
public void setNumber(String name, Number value)
- Specified by:
setNumberin interfaceIProperties
-
getNumber
public Number getNumber(String name, Number def)
- Specified by:
getNumberin interfaceIReadProperties
-
isProperty
public abstract boolean isProperty(String name)
Return true if the property exists.- Specified by:
isPropertyin interfaceIReadProperties- Parameters:
name-- Returns:
- if exists
-
removeProperty
public abstract void removeProperty(String key)
Remove the property field in the list of properties.- Specified by:
removePropertyin interfaceIProperties- Parameters:
key-
-
setProperty
public abstract void setProperty(String key, Object value)
Overwrite this function to allow changes in properties.- Parameters:
key-value-
-
isEditable
public abstract boolean isEditable()
Overwrite this function and return true if the property set can be edited.- Specified by:
isEditablein interfaceIProperties- Returns:
- if is editable
-
keys
public abstract Set<String> keys()
- Specified by:
keysin interfaceIReadProperties- Returns:
- the keys
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceIReadProperties- Specified by:
containsKeyin interfaceMap<String,Object>
-
putReadProperties
public void putReadProperties(IReadProperties m)
-
getFormatted
public String getFormatted(String name, String def, Object... values)
- Specified by:
getFormattedin interfaceIProperties
-
-