@ SuppressWarnings ( "unchecked" ) public < T > T getValue ( final ShardingPropertiesConstant shardingPropertiesConstant ) { if ( cachedProperties . containsKey ( shardingPropertiesConstant ) ) { return ( T ) cachedProperties . get ( shardingPropertiesConstant ) ; } String value = props . getProperty ( shardingPropertiesConstant . getKey ( ) ) ; if ( Strings . isNullOrEmpty ( value ) ) { Object obj = props . get ( shardingPropertiesConstant . getKey ( ) ) ; if ( null == obj ) { value = shardingPropertiesConstant . getDefaultValue ( ) ; } else { value = obj . toString ( ) ; } } Object result ; if ( boolean . class == shardingPropertiesConstant . getType ( ) ) { result = Boolean . valueOf ( value ) ; } else if ( int . class == shardingPropertiesConstant . getType ( ) ) { result = Integer . valueOf ( value ) ; } else if ( long . class == shardingPropertiesConstant . getType ( ) ) { result = Long . valueOf ( value ) ; } else { result = value ; } cachedProperties . put ( shardingPropertiesConstant , result ) ; return ( T ) result ; }
Get property value .