private void initialize ( ) throws IllegalArgumentException , IllegalAccessException { Field [ ] fields = this . getClass ( ) . getFields ( ) ; for ( Field f : fields ) { if ( this . getProperty ( f . getName ( ) ) == null ) { System . err . print ( "Property '" + f . getName ( ) + "' not defined in config file" ) ; } if ( f . getType ( ) . equals ( String . class ) ) { f . set ( this , this . getProperty ( f . getName ( ) ) ) ; } else if ( f . getType ( ) . equals ( long . class ) ) { f . setLong ( this , Long . valueOf ( this . getProperty ( f . getName ( ) ) ) ) ; } else if ( f . getType ( ) . equals ( int . class ) ) { f . setInt ( this , Integer . valueOf ( this . getProperty ( f . getName ( ) ) ) ) ; } else if ( f . getType ( ) . equals ( boolean . class ) ) { f . setBoolean ( this , Boolean . valueOf ( this . getProperty ( f . getName ( ) ) ) ) ; } else if ( f . getType ( ) . equals ( String [ ] . class ) ) { f . set ( this , this . getProperty ( f . getName ( ) ) . split ( ";" ) ) ; } else if ( f . getType ( ) . equals ( int [ ] . class ) ) { String [ ] tmp = this . getProperty ( f . getName ( ) ) . split ( ";" ) ; int [ ] ints = new int [ tmp . length ] ; for ( int i = 0 ; i < tmp . length ; i ++ ) { ints [ i ] = Integer . parseInt ( tmp [ i ] ) ; } f . set ( this , ints ) ; } else if ( f . getType ( ) . equals ( long [ ] . class ) ) { String [ ] tmp = this . getProperty ( f . getName ( ) ) . split ( ";" ) ; long [ ] longs = new long [ tmp . length ] ; for ( int i = 0 ; i < tmp . length ; i ++ ) { longs [ i ] = Long . parseLong ( tmp [ i ] ) ; } f . set ( this , longs ) ; } } }
Fills all fields with the data defined in the config file .