summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
52e49d6)
Our contract is quite crisp, make sure we hide static utility
methods.
JIRA: YANGTOOLS-1177
Change-Id: I9718b7a05cc44906d710a93beaaddd8c12ae93bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
*/
abstract Map<Descendant, @Nullable Object> indexValues(Object values);
*/
abstract Map<Descendant, @Nullable Object> indexValues(Object values);
+ @Override
+ public final String toString() {
+ return MoreObjects.toStringHelper(this).add("paths", descendants).toString();
+ }
+
/**
* Encode a path for storage. Single-element paths are squashed to their only element. The inverse operation is
* {@link #decodePath(Object)}.
/**
* Encode a path for storage. Single-element paths are squashed to their only element. The inverse operation is
* {@link #decodePath(Object)}.
* @param path Path to encode
* @return Encoded path.
*/
* @param path Path to encode
* @return Encoded path.
*/
- static final Object encodePath(final List<NodeIdentifier> path) {
+ @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
+ justification = "https://github.com/spotbugs/spotbugs/issues/811")
+ private static Object encodePath(final List<NodeIdentifier> path) {
return path.size() == 1 ? path.get(0) : ImmutableList.copyOf(path);
}
return path.size() == 1 ? path.get(0) : ImmutableList.copyOf(path);
}
* @param obj Encoded path
* @return Decoded path
*/
* @param obj Encoded path
* @return Decoded path
*/
- static final @NonNull ImmutableList<NodeIdentifier> decodePath(final Object obj) {
+ private static @NonNull ImmutableList<NodeIdentifier> decodePath(final Object obj) {
return obj instanceof NodeIdentifier ? ImmutableList.of((NodeIdentifier) obj)
: (ImmutableList<NodeIdentifier>) obj;
}
return obj instanceof NodeIdentifier ? ImmutableList.of((NodeIdentifier) obj)
: (ImmutableList<NodeIdentifier>) obj;
}
- static final @NonNull Descendant decodeDescendant(final Object obj) {
+ @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
+ justification = "https://github.com/spotbugs/spotbugs/issues/811")
+ private static @NonNull Descendant decodeDescendant(final Object obj) {
return Descendant.of(Collections2.transform(decodePath(obj), NodeIdentifier::getNodeType));
}
return Descendant.of(Collections2.transform(decodePath(obj), NodeIdentifier::getNodeType));
}
* @param path Descendant path
* @return Value for the descendant
*/
* @param path Descendant path
* @return Value for the descendant
*/
- static final @Nullable Object extractValue(final Map<List<NodeIdentifier>, Object> valueCache,
+ @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
+ justification = "https://github.com/spotbugs/spotbugs/issues/811")
+ private static @Nullable Object extractValue(final Map<List<NodeIdentifier>, Object> valueCache,
final DataContainerNode<?> data, final List<NodeIdentifier> path) {
return valueCache.computeIfAbsent(path, key -> extractValue(data, key));
}
final DataContainerNode<?> data, final List<NodeIdentifier> path) {
return valueCache.computeIfAbsent(path, key -> extractValue(data, key));
}
current = (DataContainerNode<?>) next;
}
}
current = (DataContainerNode<?>) next;
}
}
-
- @Override
- public final String toString() {
- return MoreObjects.toStringHelper(this).add("paths", descendants).toString();
- }