public interface ConfigFile extends InfoFile
FileDataType
. This value can be of any type, and the class should
typically be implemented through an enumModifier and Type | Method and Description |
---|---|
static <T extends FileDataType> |
anonMutator(String path,
Object def,
T file) |
default <G,T extends Collection<G>> |
as(Class<? extends Collection> collection,
Class<G> type)
Attempts to return the
ConfigFile value as a casted type. |
default <K,V,M extends Map<K,V>> |
as(Class<? extends Map> map,
Class<K> key,
Class<V> value)
Attempts to return the
ConfigFile value as a casted type. |
default <T> T |
as(Class<T> c)
Attempts to return the
ConfigFile value as a casted type. |
default ConfigFile |
retrieve(FileDataType t)
Facade method for
retrieve(FileDataType, ConfigFile) |
static <T extends FileDataType> |
retrieve(T file,
ConfigFile config)
Retrieves an anonymous value which can utilize a
ConfigFile parameter to retrieve data from any source |
default ConfigFile |
set(Object val)
Sets a value in the
FileDataType |
get, getConfig, getData, getDefault, getFileLocation, getPath, init, save, save
default <T> T as(Class<T> c)
ConfigFile
value as a casted type. If the
value cannot be casted it will attempt to return the default value. If
the default value is inappropriate for the class, the method will
throw a ClassCastException
.T
- The type of the casting classc
- The class type to cast tonull
if unable to cast. If the passed
class parameter is of a primitive type or autoboxed primitive,
then a casted value of -1 is returned, or false
for
booleans. If the passed class parameter is for String
,
then Object.toString()
is called on the value insteaddefault <G,T extends Collection<G>> T as(Class<? extends Collection> collection, Class<G> type)
ConfigFile
value as a casted type. If the
value cannot be casted it will attempt to return the default value. If
the default value is inappropriate for the class, the method will
throw a ClassCastException
. This exception is also throwing if
the type used for the members contained within the collection are
incorrectT
- The type of the casting classG
- The type of the collection's contentscollection
- The collection type to cast totype
- The generic bounding for the collectionnull
if unable to cast. If the passed
class parameter is of a primitive type or autoboxed primitive,
then a casted value of -1 is returned, or false
for
booleans. If the passed class parameter is for String
,
then Object.toString()
is called on the value insteaddefault <K,V,M extends Map<K,V>> M as(Class<? extends Map> map, Class<K> key, Class<V> value)
ConfigFile
value as a casted type. If the
value cannot be casted it will attempt to return the default value. If
the default value is inappropriate for the class, the method will
throw a ClassCastException
. This exception is also throwing if
the type used for the members contained within the collection are
incorrectK
- The type of the keys for this mapV
- The type of the values for this mapM
- The type of the mapmap
- The class object of the map type to usekey
- The class object of the key typesvalue
- The class object of the value typesnull
if unable to cast. If the passed
class parameter is of a primitive type or autoboxed primitive,
then a casted value of -1 is returned, or false
for
booleans. If the passed class parameter is for String
,
then Object.toString()
is called on the value insteaddefault ConfigFile set(Object val)
FileDataType
val
- The value to setConfigFile
valuestatic <T extends FileDataType> ConfigFile retrieve(T file, ConfigFile config)
ConfigFile
parameter to retrieve data from any sourceT
- Represents a FileDataType
passed to the methodfile
- The FileDataType
to useconfig
- The ConfigFile
value to search withdefault ConfigFile retrieve(FileDataType t)
retrieve(FileDataType, ConfigFile)
t
- A FileDataType
to retrieve this config value fromretrieve(FileDataType, ConfigFile)
static <T extends FileDataType> ConfigFile anonMutator(String path, Object def, T file)
Copyright © 2017. All rights reserved.