From 53c73fe2e6e02d9895d4c0ad60091a28514abe22 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 11 Oct 2013 08:21:43 +0200 Subject: [PATCH] Set changed values differently. --- .../net/pterodactylus/sone/data/ImageImpl.java | 29 ++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/data/ImageImpl.java b/src/main/java/net/pterodactylus/sone/data/ImageImpl.java index c8f7a9b..1309a80 100644 --- a/src/main/java/net/pterodactylus/sone/data/ImageImpl.java +++ b/src/main/java/net/pterodactylus/sone/data/ImageImpl.java @@ -206,13 +206,28 @@ public class ImageImpl implements Image { checkState(!key.isPresent() || (ImageImpl.this.key == null) || key.get().equals(ImageImpl.this.key), "can not change key once set"); checkState(!width.isPresent() || (ImageImpl.this.width == 0) || width.get().equals(ImageImpl.this.width), "can not change width once set"); checkState(!height.isPresent() || (ImageImpl.this.height == 0) || height.get().equals(ImageImpl.this.height), "can not change height once set"); - ImageImpl.this.sone = sone.or(ImageImpl.this.sone); - ImageImpl.this.creationTime = creationTime.or(ImageImpl.this.creationTime); - ImageImpl.this.key = key.or(ImageImpl.this.key); - ImageImpl.this.title = title.or(ImageImpl.this.title); - ImageImpl.this.description = description.or(ImageImpl.this.description); - ImageImpl.this.width = width.or(ImageImpl.this.width); - ImageImpl.this.height = height.or(ImageImpl.this.height); + + if (sone.isPresent()) { + ImageImpl.this.sone = sone.get(); + } + if (creationTime.isPresent()) { + ImageImpl.this.creationTime = creationTime.get(); + } + if (key.isPresent()) { + ImageImpl.this.key = key.get(); + } + if (title.isPresent()) { + ImageImpl.this.title = title.get(); + } + if (description.isPresent()) { + ImageImpl.this.description = description.get(); + } + if (width.isPresent()) { + ImageImpl.this.width = width.get(); + } + if (height.isPresent()) { + ImageImpl.this.height = height.get(); + } return ImageImpl.this; } -- 2.7.4