Skip to content

Commit c03fad4

Browse files
committed
Fix minor code conventions for contribution
1 parent bb81f25 commit c03fad4

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

fixture-monkey-api/src/main/java/com/navercorp/fixturemonkey/api/matcher/DefaultMatcherOperatorContainer.java

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
package com.navercorp.fixturemonkey.api.matcher;
2121

22+
import static org.apiguardian.api.API.Status.INTERNAL;
23+
2224
import java.util.ArrayList;
2325
import java.util.Collections;
2426
import java.util.Comparator;
@@ -28,10 +30,16 @@
2830
import java.util.concurrent.atomic.AtomicInteger;
2931
import java.util.stream.Collectors;
3032

33+
import org.apiguardian.api.API;
34+
3135
import com.navercorp.fixturemonkey.api.property.Property;
3236
import com.navercorp.fixturemonkey.api.type.Types;
3337
import com.navercorp.fixturemonkey.api.type.Types.UnidentifiableType;
3438

39+
/**
40+
* It is for internal use only.
41+
*/
42+
@API(since = "1.1.16", status = INTERNAL)
3543
public final class DefaultMatcherOperatorContainer<T>
3644
implements MatcherOperatorRegistry<T>, MatcherOperatorRetriever<T> {
3745
private final AtomicInteger sequenceIssuer = new AtomicInteger(0);
@@ -54,17 +62,21 @@ public List<MatcherOperator<T>> getListByProperty(Property property) {
5462
Class<?> propertyType = Types.getActualType(property.getType());
5563
List<PriorityMatcherOperator<T>> acc = new ArrayList<>(typeUnknownIntrospectors);
5664

57-
if (propertyType != UnidentifiableType.class) {
58-
for (Map.Entry<Class<?>, List<PriorityMatcherOperator<T>>> e : typeAssignableIntrospectors.entrySet()) {
59-
Class<?> anchorType = e.getKey();
60-
if (anchorType.isAssignableFrom(propertyType)) {
61-
acc.addAll(e.getValue());
62-
}
63-
}
65+
if (propertyType == UnidentifiableType.class) {
66+
return typeAssignableIntrospectors.getOrDefault(propertyType, Collections.emptyList()).stream()
67+
.map(it -> (MatcherOperator<T>)it)
68+
.collect(Collectors.toList());
69+
}
6470

65-
acc.addAll(typeAwareIntrospectors.getOrDefault(propertyType, Collections.emptyList()));
71+
for (Map.Entry<Class<?>, List<PriorityMatcherOperator<T>>> e : typeAssignableIntrospectors.entrySet()) {
72+
Class<?> anchorType = e.getKey();
73+
if (anchorType.isAssignableFrom(propertyType)) {
74+
acc.addAll(e.getValue());
75+
}
6676
}
6777

78+
acc.addAll(typeAwareIntrospectors.getOrDefault(propertyType, Collections.emptyList()));
79+
6880
return acc.stream()
6981
.sorted(Comparator.comparingInt(PriorityMatcherOperator::getPriority))
7082
.map(op -> (MatcherOperator<T>)op)

fixture-monkey-api/src/main/java/com/navercorp/fixturemonkey/api/matcher/MatcherOperatorRegistry.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818

1919
package com.navercorp.fixturemonkey.api.matcher;
2020

21-
import static org.apiguardian.api.API.Status.EXPERIMENTAL;
21+
import static org.apiguardian.api.API.Status.INTERNAL;
2222

2323
import org.apiguardian.api.API;
2424

25-
@API(since = "1.1.16", status = EXPERIMENTAL)
25+
/**
26+
* It is for internal use only.
27+
*/
28+
@API(since = "1.1.16", status = INTERNAL)
2629
public interface MatcherOperatorRegistry<T> {
27-
2830
void addFirst(MatcherOperator<T> matcherOperator);
2931

3032
void addLast(MatcherOperator<T> matcherOperator);

fixture-monkey-api/src/main/java/com/navercorp/fixturemonkey/api/matcher/MatcherOperatorRetriever.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,19 @@
1818

1919
package com.navercorp.fixturemonkey.api.matcher;
2020

21+
import static org.apiguardian.api.API.Status.INTERNAL;
22+
2123
import java.util.List;
2224

25+
import org.apiguardian.api.API;
26+
2327
import com.navercorp.fixturemonkey.api.property.Property;
2428

29+
/**
30+
* It is for internal use only.
31+
*/
32+
@API(since = "1.1.16", status = INTERNAL)
2533
public interface MatcherOperatorRetriever<T> {
26-
2734
List<MatcherOperator<T>> getList();
2835

2936
List<MatcherOperator<T>> getListByProperty(Property property);

0 commit comments

Comments
 (0)