Skip to content

Commit

Permalink
Remove default Item.getRealValue()
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Dec 12, 2018
1 parent 7eaa178 commit 33c751e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
Expand Up @@ -221,10 +221,7 @@ public interface Item<V extends PrismValue, D extends ItemDefinition> extends It
* - Objectable in PrismObjectValue
*/
@Nullable
default Object getRealValue() {
V value = getValue();
return value != null ? value.getRealValue() : null;
}
Object getRealValue();

/**
* Returns (potentially empty) collection of "real values".
Expand Down
Expand Up @@ -26,6 +26,7 @@
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.exception.SystemException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.xml.namespace.QName;
import java.lang.reflect.Constructor;
Expand Down Expand Up @@ -211,6 +212,13 @@ protected Object getPathComponent() {
}
}

@Nullable
@Override
public Object getRealValue() {
V value = getValue();
return value != null ? value.getRealValue() : null;
}

@NotNull
public ItemPath getPath() {
if (parent == null) {
Expand Down
Expand Up @@ -145,8 +145,7 @@ public Collection<C> getRealValues() {

@Override
public C getRealValue() {
//noinspection unchecked
return (C) super.getRealValue();
return getValue().getRealValue();
}

@NotNull
Expand Down
Expand Up @@ -141,8 +141,8 @@ public T getAnyRealValue() {

@Override
public T getRealValue() {
//noinspection unchecked
return (T) super.getRealValue();
PrismPropertyValue<T> value = getValue();
return value != null ? value.getRealValue() : null;
}

/**
Expand Down
Expand Up @@ -57,6 +57,7 @@ public PrismReferenceImpl(QName name) {
/**
* {@inheritDoc}
*/
@NotNull
public PrismReferenceValue getValue() {
// I know of no reason why we should not return a value if it's only one (even for multivalued items) (see MID-3922)
// TODO reconsider this
Expand Down Expand Up @@ -96,7 +97,7 @@ private PrismReferenceValue getValue(String oid) {

@Override
public Referencable getRealValue() {
return (Referencable) super.getRealValue();
return getValue().getRealValue();
}

@NotNull
Expand Down

0 comments on commit 33c751e

Please sign in to comment.