@Test public void testGetEnumValue() { final UserSettingsImpl settings = new UserSettingsImpl( "foo" ); settings.putEnumValue( "key", TestEnum.A ); assertEquals( TestEnum.A, settings.getEnumValue( "key", TestEnum.B ) ); }
@SuppressWarnings( "unchecked" ) protected <T extends Enum<T>> T getEnumValue( final String aName, final T aDefault ) { String value = this.properties.getProperty( aName ); if ( value == null ) { return aDefault; } return ( T )Enum.valueOf( aDefault.getClass(), value ); }
UserSettingsImpl implements UserSettings { @SuppressWarnings( "unchecked" ) protected <T extends Enum<T>> T getEnumValue( final String aName, final T aDefault ) { String value = this.properties.getProperty( aName ); if ( value == null ) { return aDefault; } return ( T )Enum.valueOf( aDefault.getClass(), value ); } }
UserSettingsImpl implements UserSettings { @SuppressWarnings( "unchecked" ) protected <T extends Enum<T>> T getEnumValue( final String aName, final T aDefault ) { String value = this.properties.getProperty( aName ); if ( value == null ) { return aDefault; } return ( T )Enum.valueOf( aDefault.getClass(), value ); } UserSettingsImpl( final String aName );  UserSettingsImpl( final String aName, final Properties aProperties ); protected  UserSettingsImpl( final UserSettings aSettings ); }
UserSettingsImpl implements UserSettings { @SuppressWarnings( "unchecked" ) protected <T extends Enum<T>> T getEnumValue( final String aName, final T aDefault ) { String value = this.properties.getProperty( aName ); if ( value == null ) { return aDefault; } return ( T )Enum.valueOf( aDefault.getClass(), value ); } UserSettingsImpl( final String aName );  UserSettingsImpl( final String aName, final Properties aProperties ); protected  UserSettingsImpl( final UserSettings aSettings ); @Override String get( final String aName, final String aDefaultValue ); @Override boolean getBoolean( final String aName, final boolean aDefaultValue ); @Override int getInt( final String aName, final int aDefaultValue ); @Override long getLong( final String aName, final long aDefaultValue ); @Override String getName(); Properties getProperties(); @Override Iterator<Entry<String, Object>> iterator(); @Override void put( final String aName, final String aValue ); @Override void putAll( final Map<?, ?> aSettings ); @Override void putBoolean( final String aName, final boolean aValue ); @Override void putInt( final String aName, final int aValue ); @Override void putLong( final String aName, final long aValue ); }
UserSettingsImpl implements UserSettings { @SuppressWarnings( "unchecked" ) protected <T extends Enum<T>> T getEnumValue( final String aName, final T aDefault ) { String value = this.properties.getProperty( aName ); if ( value == null ) { return aDefault; } return ( T )Enum.valueOf( aDefault.getClass(), value ); } UserSettingsImpl( final String aName );  UserSettingsImpl( final String aName, final Properties aProperties ); protected  UserSettingsImpl( final UserSettings aSettings ); @Override String get( final String aName, final String aDefaultValue ); @Override boolean getBoolean( final String aName, final boolean aDefaultValue ); @Override int getInt( final String aName, final int aDefaultValue ); @Override long getLong( final String aName, final long aDefaultValue ); @Override String getName(); Properties getProperties(); @Override Iterator<Entry<String, Object>> iterator(); @Override void put( final String aName, final String aValue ); @Override void putAll( final Map<?, ?> aSettings ); @Override void putBoolean( final String aName, final boolean aValue ); @Override void putInt( final String aName, final int aValue ); @Override void putLong( final String aName, final long aValue );  }