public interface Config extends PluginFile
FileDataType
. This value can be of any type, and the class should
typically be implemented through an enumModifier and Type | Method and Description |
---|---|
default <G,T extends Collection<G>> |
as(Class<? extends Collection> collection,
Class<G> type)
Attempts to return the
Config 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
Config value as a casted type. |
default <T> T |
as(Class<T> c)
Attempts to return the
Config value as a casted type. |
static Map<String,Object> |
getConfigSectionValue(Object o)
Returns a
Map representative of the passed Object that represents
a section of a YAML file. |
default Config |
retrieve(FileDataType t)
Facade method for
retrieve(FileDataType, Config) |
static <T extends FileDataType> |
retrieve(T file,
Config config)
Retrieves an anonymous value which can utilize a
Config parameter to retrieve data from any source |
default Config |
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)
Config
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)
Config
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)
Config
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 Config set(Object val)
FileDataType
val
- The value to setConfig
valuestatic Map<String,Object> getConfigSectionValue(Object o)
Map
representative of the passed Object that represents
a section of a YAML file. This method neglects the implementation of the
section (whether it be ConfigurationSection
or just a
Map
), and returns the appropriate value.o
- The object to interpretMap
representing the sectionstatic <T extends FileDataType> Config retrieve(T file, Config config)
Config
parameter to retrieve data from any sourceT
- Represents a FileDataType
passed to the methodfile
- The FileDataType
to useconfig
- The Config
value to search withdefault Config retrieve(FileDataType t)
retrieve(FileDataType, Config)
t
- A FileDataType
to retrieve this config value fromretrieve(FileDataType, Config)
Copyright © 2015. All rights reserved.