@Test( expected = NullPointerException.class ) public void setStyleProperty_RejectsNullKeys() { ElementStyleSheet sheet = new ElementStyleSheet(); sheet.setStyleProperty( null, "" ); }
public void setStyleProperty( final StyleKey key, final Object value ) { if ( key == null ) { throw new NullPointerException( "ElementStyleSheet.setStyleProperty: key is null." ); } final int identifier = key.identifier; if ( value == null ) { if ( properties != null ) { if ( properties[ identifier ] == null ) { return; } putInCache( key, null, SOURCE_UNDEFINED ); updateChangeTracker( key, null ); styleChangeSupport.fireStyleRemoved( key ); } return; } if ( key.getValueType().isAssignableFrom( value.getClass() ) == false ) { throw new ClassCastException( "Value for key " + key.getName() + " is not assignable: " + value.getClass() + " is not assignable from " + key.getValueType() ); } ensurePropertiesReady(); if ( ObjectUtilities.equal( properties[ identifier ], value ) ) { return; } putInCache( key, value, SOURCE_DIRECT ); updateChangeTracker( key, value ); styleChangeSupport.fireStyleChanged( key, value ); }
ElementStyleSheet extends AbstractStyleSheet implements Serializable, Cloneable { public void setStyleProperty( final StyleKey key, final Object value ) { if ( key == null ) { throw new NullPointerException( "ElementStyleSheet.setStyleProperty: key is null." ); } final int identifier = key.identifier; if ( value == null ) { if ( properties != null ) { if ( properties[ identifier ] == null ) { return; } putInCache( key, null, SOURCE_UNDEFINED ); updateChangeTracker( key, null ); styleChangeSupport.fireStyleRemoved( key ); } return; } if ( key.getValueType().isAssignableFrom( value.getClass() ) == false ) { throw new ClassCastException( "Value for key " + key.getName() + " is not assignable: " + value.getClass() + " is not assignable from " + key.getValueType() ); } ensurePropertiesReady(); if ( ObjectUtilities.equal( properties[ identifier ], value ) ) { return; } putInCache( key, value, SOURCE_DIRECT ); updateChangeTracker( key, value ); styleChangeSupport.fireStyleChanged( key, value ); } }
ElementStyleSheet extends AbstractStyleSheet implements Serializable, Cloneable { public void setStyleProperty( final StyleKey key, final Object value ) { if ( key == null ) { throw new NullPointerException( "ElementStyleSheet.setStyleProperty: key is null." ); } final int identifier = key.identifier; if ( value == null ) { if ( properties != null ) { if ( properties[ identifier ] == null ) { return; } putInCache( key, null, SOURCE_UNDEFINED ); updateChangeTracker( key, null ); styleChangeSupport.fireStyleRemoved( key ); } return; } if ( key.getValueType().isAssignableFrom( value.getClass() ) == false ) { throw new ClassCastException( "Value for key " + key.getName() + " is not assignable: " + value.getClass() + " is not assignable from " + key.getValueType() ); } ensurePropertiesReady(); if ( ObjectUtilities.equal( properties[ identifier ], value ) ) { return; } putInCache( key, value, SOURCE_DIRECT ); updateChangeTracker( key, value ); styleChangeSupport.fireStyleChanged( key, value ); } ElementStyleSheet(); }
ElementStyleSheet extends AbstractStyleSheet implements Serializable, Cloneable { public void setStyleProperty( final StyleKey key, final Object value ) { if ( key == null ) { throw new NullPointerException( "ElementStyleSheet.setStyleProperty: key is null." ); } final int identifier = key.identifier; if ( value == null ) { if ( properties != null ) { if ( properties[ identifier ] == null ) { return; } putInCache( key, null, SOURCE_UNDEFINED ); updateChangeTracker( key, null ); styleChangeSupport.fireStyleRemoved( key ); } return; } if ( key.getValueType().isAssignableFrom( value.getClass() ) == false ) { throw new ClassCastException( "Value for key " + key.getName() + " is not assignable: " + value.getClass() + " is not assignable from " + key.getValueType() ); } ensurePropertiesReady(); if ( ObjectUtilities.equal( properties[ identifier ], value ) ) { return; } putInCache( key, value, SOURCE_DIRECT ); updateChangeTracker( key, value ); styleChangeSupport.fireStyleChanged( key, value ); } ElementStyleSheet(); long getChangeTracker(); boolean isLocalKey( final StyleKey key ); final Object[] toArray(); Object getStyleProperty( final StyleKey key, final Object defaultValue ); void setBooleanStyleProperty( final StyleKey key, final boolean value ); void setStyleProperty( final StyleKey key, final Object value ); ElementStyleSheet clone(); ElementStyleSheet derive( final boolean preserveId ); StyleKey[] getDefinedPropertyNamesArray(); void addListener( final StyleChangeListener l ); void removeListener( final StyleChangeListener l ); StyleKey[] getPropertyKeys(); List<StyleKey> getPropertyKeyList(); void addAll( final ElementStyleSheet sourceStyleSheet ); void addInherited( final ElementStyleSheet sourceStyleSheet ); void addInherited( final SimpleStyleSheet sourceStyleSheet ); void addDefault( final ElementStyleSheet sourceStyleSheet ); void clear(); long getModificationCount(); long getChangeTrackerHash(); void copyFrom( final ElementStyleSheet style ); }
ElementStyleSheet extends AbstractStyleSheet implements Serializable, Cloneable { public void setStyleProperty( final StyleKey key, final Object value ) { if ( key == null ) { throw new NullPointerException( "ElementStyleSheet.setStyleProperty: key is null." ); } final int identifier = key.identifier; if ( value == null ) { if ( properties != null ) { if ( properties[ identifier ] == null ) { return; } putInCache( key, null, SOURCE_UNDEFINED ); updateChangeTracker( key, null ); styleChangeSupport.fireStyleRemoved( key ); } return; } if ( key.getValueType().isAssignableFrom( value.getClass() ) == false ) { throw new ClassCastException( "Value for key " + key.getName() + " is not assignable: " + value.getClass() + " is not assignable from " + key.getValueType() ); } ensurePropertiesReady(); if ( ObjectUtilities.equal( properties[ identifier ], value ) ) { return; } putInCache( key, value, SOURCE_DIRECT ); updateChangeTracker( key, value ); styleChangeSupport.fireStyleChanged( key, value ); } ElementStyleSheet(); long getChangeTracker(); boolean isLocalKey( final StyleKey key ); final Object[] toArray(); Object getStyleProperty( final StyleKey key, final Object defaultValue ); void setBooleanStyleProperty( final StyleKey key, final boolean value ); void setStyleProperty( final StyleKey key, final Object value ); ElementStyleSheet clone(); ElementStyleSheet derive( final boolean preserveId ); StyleKey[] getDefinedPropertyNamesArray(); void addListener( final StyleChangeListener l ); void removeListener( final StyleChangeListener l ); StyleKey[] getPropertyKeys(); List<StyleKey> getPropertyKeyList(); void addAll( final ElementStyleSheet sourceStyleSheet ); void addInherited( final ElementStyleSheet sourceStyleSheet ); void addInherited( final SimpleStyleSheet sourceStyleSheet ); void addDefault( final ElementStyleSheet sourceStyleSheet ); void clear(); long getModificationCount(); long getChangeTrackerHash(); void copyFrom( final ElementStyleSheet style );  }