if ( oldValue == null || newRawValue == null )
{
throw new IllegalArgumentException( "Expected non-null value." ); //$NON-NLS-1$
}
IAttribute attribute = oldValue.getAttribute();
boolean modify = false;
if ( oldValue != null && newRawValue != null && newRawValue instanceof byte[] )
{
byte[] newValue = ( byte[] ) newRawValue;
if ( !Utils.equals( oldValue.getBinaryValue(), newValue ) )
{
modify = true;
}
}
else if ( oldValue != null && newRawValue != null && newRawValue instanceof String )
{
String newValue = ( String ) newRawValue;
if ( !oldValue.getStringValue().equals( newValue ) )
{
modify = true;
}
}
if ( modify )
{
if ( oldValue.isEmpty() )
{
EventRegistry.suspendEventFiringInCurrentThread();
attribute.deleteEmptyValue();
EventRegistry.resumeEventFiringInCurrentThread();
Value value = new Value( attribute, newRawValue );
attribute.addValue( value );
}
else
{
IValue newValue = new Value( attribute, newRawValue );
attribute.modifyValue( oldValue, newValue );
}
}
}