Skip to content

Commit

Permalink
Anontated use of some prism APIs - candidates for refactor / removal
Browse files Browse the repository at this point in the history
  - one use only - public method has only one use in midPoint
      probably code should be somewhere else
  - unused - no users in midPoint - candidate for deprecation / deletion
  • Loading branch information
tonydamage committed Apr 22, 2024
1 parent bc1fc68 commit f3b583f
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import com.evolveum.midpoint.prism.polystring.PolyString;
import com.evolveum.midpoint.util.MiscUtil;

import com.evolveum.midpoint.util.annotation.OneUseOnly;
import com.evolveum.midpoint.util.annotation.Unused;

import org.apache.commons.lang3.BooleanUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -97,7 +100,6 @@ default boolean hasCompleteDefinition() {
*
* TODO consider removing this method
*/
@VisibleForTesting
void setElementName(QName elementName);

/**
Expand Down Expand Up @@ -131,6 +133,7 @@ default String getDisplayName() {
*
* @return help message for the item
*/
@Unused
default String getHelp() {
return getDefinition() == null ? null : getDefinition().getHelp();
}
Expand Down Expand Up @@ -281,6 +284,7 @@ default V getAnyValue(@NotNull ValueSelector<V> selector) {
/**
* Type override, also for compatibility.
*/
@OneUseOnly("connectorConfiguration")
<X> X[] getRealValuesArray(Class<X> type);

/**
Expand All @@ -306,6 +310,7 @@ default V getAnyValue(@NotNull ValueSelector<V> selector) {
.collect(Collectors.toList());
}

@OneUseOnly("Delta serialization")
@Experimental // Do NOT use !!!!
@NotNull
default Collection<Object> getRealValuesOrRawTypes() {
Expand Down Expand Up @@ -360,6 +365,7 @@ default boolean add(@NotNull V newValue) throws SchemaException {
* or during overwriting existing value with a different one. The "difference" is taken using the
* DEFAULT_FOR_EQUALS (DATA) equivalence strategy.
*/
@OneUseOnly("convenience")
boolean add(@NotNull V newValue, @NotNull EquivalenceStrategy strategy) throws SchemaException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,13 @@ public interface PrismContainer<C extends Containerable>
*/
void trim();

@Deprecated
<IV extends PrismValue,ID extends ItemDefinition<?>,I extends Item<IV,ID>> I findItem(QName itemQName, Class<I> type);

@Override
<IV extends PrismValue,ID extends ItemDefinition<?>> PartiallyResolvedItem<IV,ID> findPartial(ItemPath path);

@Deprecated
<IV extends PrismValue,ID extends ItemDefinition<?>,I extends Item<IV,ID>> I findCreateItem(QName itemQName, Class<I> type, boolean create) throws SchemaException;

<IV extends PrismValue,ID extends ItemDefinition<?>,I extends Item<IV,ID>> I findItem(ItemPath path, Class<I> type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.stream.Collectors;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.util.annotation.Unused;
import com.evolveum.midpoint.util.exception.CommonException;

import org.jetbrains.annotations.Contract;
Expand Down Expand Up @@ -59,6 +60,7 @@ static <T extends Containerable> T asContainerable(PrismContainerValue<T> value)
* @return set of properties that the property container contains.
*/
@NotNull
@Unused
Set<PrismProperty<?>> getProperties();

Long getId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

import java.io.Serializable;

/**
* Fixme: Rename this to its actual use and meaning - item path representation normalized for textual search (used in indexing)
*
*/
public interface CanonicalItemPath extends Serializable {

int size();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.evolveum.midpoint.util.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;

import static java.lang.annotation.RetentionPolicy.SOURCE;

@Documented
@Retention(SOURCE)
public @interface OneUseOnly {
String value();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.evolveum.midpoint.util.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;

import static java.lang.annotation.RetentionPolicy.SOURCE;

@Documented
@Retention(SOURCE)
public @interface Unused {
}

0 comments on commit f3b583f

Please sign in to comment.