private Optional getValueOfPrimitive ( Class type , String key ) { if ( type . equals ( String . class ) ) { return configurationUtil . get ( key ) ; } else if ( type . equals ( Boolean . class ) || type . equals ( boolean . class ) ) { return configurationUtil . getBoolean ( key ) ; } else if ( type . equals ( Float . class ) || type . equals ( float . class ) ) { return configurationUtil . getFloat ( key ) ; } else if ( type . equals ( Double . class ) || type . equals ( double . class ) ) { return configurationUtil . getDouble ( key ) ; } else if ( type . equals ( Integer . class ) || type . equals ( int . class ) ) { return configurationUtil . getInteger ( key ) ; } else if ( type . equals ( Long . class ) || type . equals ( long . class ) ) { return configurationUtil . getLong ( key ) ; } else { return Optional . empty ( ) ; } }
Returns a value of a primitive configuration type