code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
@Memoized @Override Iterable<? extends RecursableDiffEntity> childEntities() { return singularFields().values(); }
A list of top-level singular field comparison results. <p>All unknown fields are treated as repeated and with {@code ignoringRepeatedFieldOrder()} off, because we don't know their nature. If they're optional, only last element matters, but if they're repeated, all elements matter.
childEntities
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
@Override final void printContents(boolean includeMatches, String fieldPrefix, StringBuilder sb) { if (!includeMatches && isMatched()) { return; } for (int fieldNumber : singularFields().keySet()) { for (SingularField singularField : singularFields().get(fieldNumber)) { singularField.printContents(includeMatches, fieldPrefix, sb); } } }
A list of top-level singular field comparison results. <p>All unknown fields are treated as repeated and with {@code ignoringRepeatedFieldOrder()} off, because we don't know their nature. If they're optional, only last element matters, but if they're repeated, all elements matter.
printContents
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
@Override final boolean isContentEmpty() { return singularFields().isEmpty(); }
A list of top-level singular field comparison results. <p>All unknown fields are treated as repeated and with {@code ignoringRepeatedFieldOrder()} off, because we don't know their nature. If they're optional, only last element matters, but if they're repeated, all elements matter.
isContentEmpty
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
static Builder newBuilder() { return new AutoValue_DiffResult_UnknownFieldSetDiff.Builder(); }
A list of top-level singular field comparison results. <p>All unknown fields are treated as repeated and with {@code ignoringRepeatedFieldOrder()} off, because we don't know their nature. If they're optional, only last element matters, but if they're repeated, all elements matter.
newBuilder
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
@CanIgnoreReturnValue final Builder addSingularField(int fieldNumber, SingularField singularField) { singularFieldsBuilder().put(fieldNumber, singularField); return this; }
A list of top-level singular field comparison results. <p>All unknown fields are treated as repeated and with {@code ignoringRepeatedFieldOrder()} off, because we don't know their nature. If they're optional, only last element matters, but if they're repeated, all elements matter.
addSingularField
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
@CanIgnoreReturnValue final Builder addAllSingularFields(int fieldNumber, Iterable<SingularField> singularFields) { singularFieldsBuilder().putAll(fieldNumber, singularFields); return this; }
A list of top-level singular field comparison results. <p>All unknown fields are treated as repeated and with {@code ignoringRepeatedFieldOrder()} off, because we don't know their nature. If they're optional, only last element matters, but if they're repeated, all elements matter.
addAllSingularFields
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
default void printMessage(Message m, StringBuilder sb) { try { protoPrinter().print(m, sb); } catch (IOException impossible) { throw new AssertionError(impossible); } }
Utilities to support printing messages and proto fields using a {@link TextFormat.Printer}.
printMessage
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
default void printFieldValue(SubScopeId subScopeId, Object o, StringBuilder sb) { switch (subScopeId.kind()) { case FIELD_DESCRIPTOR: printFieldValue(subScopeId.fieldDescriptor(), o, sb); return; case UNKNOWN_FIELD_DESCRIPTOR: printFieldValue(subScopeId.unknownFieldDescriptor(), o, sb); return; case UNPACKED_ANY_VALUE_TYPE: printFieldValue(AnyUtils.valueFieldDescriptor(), o, sb); return; } throw new AssertionError(subScopeId.kind()); }
Utilities to support printing messages and proto fields using a {@link TextFormat.Printer}.
printFieldValue
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
default void printFieldValue(FieldDescriptor field, Object value, StringBuilder sb) { try { protoPrinter().printFieldValue(field, value, sb); } catch (IOException impossible) { throw new AssertionError(impossible); } }
Utilities to support printing messages and proto fields using a {@link TextFormat.Printer}.
printFieldValue
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
default void printFieldValue( UnknownFieldDescriptor unknownField, Object value, StringBuilder sb) { try { TextFormat.printUnknownFieldValue(unknownField.type().wireType(), value, sb); } catch (IOException impossible) { throw new AssertionError(impossible); } }
Utilities to support printing messages and proto fields using a {@link TextFormat.Printer}.
printFieldValue
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
@Memoized @Override Iterable<? extends RecursableDiffEntity> childEntities() { // Assemble the diffs in field number order so it most closely matches the schema. ImmutableList.Builder<RecursableDiffEntity> builder = ImmutableList.builderWithExpectedSize( singularFields().size() + repeatedFields().size() + unknownFields().asSet().size()); Set<Integer> fieldNumbers = Sets.union(singularFields().keySet(), repeatedFields().keySet()); for (int fieldNumber : Ordering.natural().sortedCopy(fieldNumbers)) { builder.addAll(singularFields().get(fieldNumber)); builder.addAll(repeatedFields().get(fieldNumber)); } builder.addAll(unknownFields().asSet()); return builder.build(); }
The result of comparing the message's {@link UnknownFieldSet}s. Not present if unknown fields were not compared.
childEntities
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
final String printToString(boolean reportMismatchesOnly) { StringBuilder sb = new StringBuilder(); if (!isMatched()) { sb.append("Differences were found:\n"); printContents(/* includeMatches = */ false, /* fieldPrefix = */ "", sb); if (!reportMismatchesOnly && isAnyChildMatched()) { sb.append("\nFull diff report:\n"); printContents(/* includeMatches = */ true, /* fieldPrefix = */ "", sb); } } else { sb.append("No differences were found."); if (!reportMismatchesOnly) { if (isAnyChildIgnored()) { sb.append("\nSome fields were ignored for comparison, however.\n"); } else { sb.append("\nFull diff report:\n"); } printContents(/* includeMatches = */ true, /* fieldPrefix = */ "", sb); } } return sb.toString(); }
Prints the full {@link DiffResult} to a human-readable string, for use in test outputs.
printToString
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
@Override final void printContents(boolean includeMatches, String fieldPrefix, StringBuilder sb) { for (RecursableDiffEntity child : childEntities()) { child.printContents(includeMatches, fieldPrefix, sb); } }
Prints the full {@link DiffResult} to a human-readable string, for use in test outputs.
printContents
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
@Override final boolean isContentEmpty() { return Iterables.isEmpty(childEntities()); }
Prints the full {@link DiffResult} to a human-readable string, for use in test outputs.
isContentEmpty
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
static Builder newBuilder() { return new AutoValue_DiffResult.Builder(); }
Prints the full {@link DiffResult} to a human-readable string, for use in test outputs.
newBuilder
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
private static String newFieldPrefix(String rootFieldPrefix, String toAdd) { return rootFieldPrefix.isEmpty() ? toAdd : (rootFieldPrefix + "." + toAdd); }
Prints the full {@link DiffResult} to a human-readable string, for use in test outputs.
newFieldPrefix
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
@CanIgnoreReturnValue final Builder addSingularField(int fieldNumber, SingularField singularField) { singularFieldsBuilder().put(fieldNumber, singularField); return this; }
Prints the full {@link DiffResult} to a human-readable string, for use in test outputs.
addSingularField
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
@CanIgnoreReturnValue final Builder addAllSingularFields(int fieldNumber, Iterable<SingularField> singularFields) { singularFieldsBuilder().putAll(fieldNumber, singularFields); return this; }
Prints the full {@link DiffResult} to a human-readable string, for use in test outputs.
addAllSingularFields
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
@CanIgnoreReturnValue final Builder addRepeatedField(int fieldNumber, RepeatedField repeatedField) { repeatedFieldsBuilder().put(fieldNumber, repeatedField); return this; }
Prints the full {@link DiffResult} to a human-readable string, for use in test outputs.
addRepeatedField
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java
Apache-2.0
@Override void validate(FieldDescriptor fieldDescriptor) {}
Various validators, to ensure that explicit comparison settings made by the user make sense.
validate
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldDescriptorValidator.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldDescriptorValidator.java
Apache-2.0
@Override void validate(FieldDescriptor fieldDescriptor) { checkArgument( !fieldDescriptor.isRepeated(), "%s is a repeated field; repeated fields cannot be absent, only empty", fieldDescriptor); checkArgument( fieldDescriptor.hasPresence(), "%s is a field without presence; it cannot be absent", fieldDescriptor); }
Various validators, to ensure that explicit comparison settings made by the user make sense.
validate
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldDescriptorValidator.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldDescriptorValidator.java
Apache-2.0
@Override void validate(FieldDescriptor fieldDescriptor) { checkArgument( !fieldDescriptor.isMapField(), "%s is a map field; it has no order", fieldDescriptor); checkArgument( fieldDescriptor.isRepeated(), "%s is not a repeated field; it has no order", fieldDescriptor); }
Various validators, to ensure that explicit comparison settings made by the user make sense.
validate
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldDescriptorValidator.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldDescriptorValidator.java
Apache-2.0
@Override void validate(FieldDescriptor fieldDescriptor) { checkArgument( fieldDescriptor.isRepeated(), "%s is not a repeated field or a map field; it cannot contain extra elements", fieldDescriptor); }
Various validators, to ensure that explicit comparison settings made by the user make sense.
validate
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldDescriptorValidator.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldDescriptorValidator.java
Apache-2.0
@Override void validate(FieldDescriptor fieldDescriptor) { checkArgument( fieldDescriptor.getJavaType() == JavaType.DOUBLE, "%s is not a double field", fieldDescriptor); }
Various validators, to ensure that explicit comparison settings made by the user make sense.
validate
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldDescriptorValidator.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldDescriptorValidator.java
Apache-2.0
@Override void validate(FieldDescriptor fieldDescriptor) { checkArgument( fieldDescriptor.getJavaType() == JavaType.FLOAT, "%s is not a float field", fieldDescriptor); }
Various validators, to ensure that explicit comparison settings made by the user make sense.
validate
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldDescriptorValidator.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldDescriptorValidator.java
Apache-2.0
boolean isEmpty() { return children.isEmpty(); }
Returns whether this {@code FieldNumberTree} has no children.
isEmpty
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldNumberTree.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldNumberTree.java
Apache-2.0
FieldNumberTree child(SubScopeId subScopeId) { FieldNumberTree child = children.get(subScopeId); return child == null ? EMPTY : child; }
Returns the {@code FieldNumberTree} corresponding to this sub-field. <p>{@code empty()} if there is none.
child
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldNumberTree.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldNumberTree.java
Apache-2.0
boolean hasChild(SubScopeId subScopeId) { return children.containsKey(subScopeId); }
Returns whether this tree has a child for this node.
hasChild
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldNumberTree.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldNumberTree.java
Apache-2.0
static FieldNumberTree fromMessage( Message message, TypeRegistry typeRegistry, ExtensionRegistry extensionRegistry) { FieldNumberTree tree = new FieldNumberTree(); // Known fields. Map<FieldDescriptor, Object> knownFieldValues = message.getAllFields(); for (FieldDescriptor field : knownFieldValues.keySet()) { SubScopeId subScopeId = SubScopeId.of(field); FieldNumberTree childTree = new FieldNumberTree(); tree.children.put(subScopeId, childTree); if (field.equals(AnyUtils.valueFieldDescriptor())) { // Handle Any protos specially. Optional<Message> unpackedAny = AnyUtils.unpack(message, typeRegistry, extensionRegistry); if (unpackedAny.isPresent()) { tree.children.put( SubScopeId.ofUnpackedAnyValueType(unpackedAny.get().getDescriptorForType()), fromMessage(unpackedAny.get(), typeRegistry, extensionRegistry)); } } else { Object fieldValue = knownFieldValues.get(field); if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) { if (field.isRepeated()) { List<?> valueList = (List<?>) fieldValue; for (Object value : valueList) { childTree.merge(fromMessage((Message) value, typeRegistry, extensionRegistry)); } } else { childTree.merge(fromMessage((Message) fieldValue, typeRegistry, extensionRegistry)); } } } } // Unknown fields. tree.merge(fromUnknownFieldSet(message.getUnknownFields())); return tree; }
Returns whether this tree has a child for this node.
fromMessage
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldNumberTree.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldNumberTree.java
Apache-2.0
static FieldNumberTree fromMessages( Iterable<? extends Message> messages, TypeRegistry typeRegistry, ExtensionRegistry extensionRegistry) { FieldNumberTree tree = new FieldNumberTree(); for (Message message : messages) { if (message != null) { tree.merge(fromMessage(message, typeRegistry, extensionRegistry)); } } return tree; }
Returns whether this tree has a child for this node.
fromMessages
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldNumberTree.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldNumberTree.java
Apache-2.0
private static FieldNumberTree fromUnknownFieldSet(UnknownFieldSet unknownFieldSet) { FieldNumberTree tree = new FieldNumberTree(); for (int fieldNumber : unknownFieldSet.asMap().keySet()) { UnknownFieldSet.Field unknownField = unknownFieldSet.asMap().get(fieldNumber); for (UnknownFieldDescriptor unknownFieldDescriptor : UnknownFieldDescriptor.descriptors(fieldNumber, unknownField)) { SubScopeId subScopeId = SubScopeId.of(unknownFieldDescriptor); FieldNumberTree childTree = new FieldNumberTree(); tree.children.put(subScopeId, childTree); if (unknownFieldDescriptor.type() == UnknownFieldDescriptor.Type.GROUP) { for (Object group : unknownFieldDescriptor.type().getValues(unknownField)) { childTree.merge(fromUnknownFieldSet((UnknownFieldSet) group)); } } } } return tree; }
Returns whether this tree has a child for this node.
fromUnknownFieldSet
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldNumberTree.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldNumberTree.java
Apache-2.0
private void merge(FieldNumberTree other) { for (SubScopeId subScopeId : other.children.keySet()) { FieldNumberTree value = other.children.get(subScopeId); if (!this.children.containsKey(subScopeId)) { this.children.put(subScopeId, value); } else { this.children.get(subScopeId).merge(value); } } }
Adds the other tree onto this one. May destroy {@code other} in the process.
merge
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldNumberTree.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldNumberTree.java
Apache-2.0
private static FieldScope create( FieldScopeLogic logic, Function<? super Optional<Descriptor>, String> usingCorrespondenceStringFunction) { return new AutoValue_FieldScopeImpl(logic, usingCorrespondenceStringFunction); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
create
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
static FieldScope createFromSetFields( Message message, TypeRegistry typeRegistry, ExtensionRegistry extensionRegistry) { return create( FieldScopeLogic.partialScope(message, typeRegistry, extensionRegistry), Functions.constant( String.format( "FieldScopes.fromSetFields({%s})", TextFormat.printer().printToString(message)))); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
createFromSetFields
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
static FieldScope createFromSetFields( Iterable<? extends Message> messages, TypeRegistry typeRegistry, ExtensionRegistry extensionRegistry) { if (emptyOrAllNull(messages)) { return create(FieldScopeLogic.none(), Functions.constant("FieldScopes.fromSetFields([])")); } Optional<Descriptor> optDescriptor = FieldScopeUtil.getSingleDescriptor(messages); checkArgument( optDescriptor.isPresent(), "Cannot create scope from messages with different descriptors: %s", getDescriptors(messages)); return create( FieldScopeLogic.partialScope( messages, optDescriptor.get(), typeRegistry, extensionRegistry), Functions.constant(String.format("FieldScopes.fromSetFields(%s)", formatList(messages)))); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
createFromSetFields
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
static FieldScope createIgnoringFields(Iterable<Integer> fieldNumbers) { return create( FieldScopeLogic.all().ignoringFields(fieldNumbers), FieldScopeUtil.fieldNumbersFunction("FieldScopes.ignoringFields(%s)", fieldNumbers)); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
createIgnoringFields
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
static FieldScope createIgnoringFieldDescriptors(Iterable<FieldDescriptor> fieldDescriptors) { return create( FieldScopeLogic.all().ignoringFieldDescriptors(fieldDescriptors), Functions.constant( String.format("FieldScopes.ignoringFieldDescriptors(%s)", join(fieldDescriptors)))); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
createIgnoringFieldDescriptors
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
static FieldScope createAllowingFields(Iterable<Integer> fieldNumbers) { return create( FieldScopeLogic.none().allowingFields(fieldNumbers), FieldScopeUtil.fieldNumbersFunction("FieldScopes.allowingFields(%s)", fieldNumbers)); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
createAllowingFields
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
static FieldScope createAllowingFieldDescriptors(Iterable<FieldDescriptor> fieldDescriptors) { return create( FieldScopeLogic.none().allowingFieldDescriptors(fieldDescriptors), Functions.constant( String.format("FieldScopes.allowingFieldDescriptors(%s)", join(fieldDescriptors)))); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
createAllowingFieldDescriptors
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
static FieldScope all() { return ALL; }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
all
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
static FieldScope none() { return NONE; }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
none
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
private static boolean emptyOrAllNull(Iterable<?> iterable) { for (Object o : iterable) { if (o != null) { return false; } } return true; }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
emptyOrAllNull
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
@Override String usingCorrespondenceString(Optional<Descriptor> descriptor) { return usingCorrespondenceStringFunction().apply(descriptor); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
usingCorrespondenceString
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
@Override public final FieldScope ignoringFields(int firstFieldNumber, int... rest) { return ignoringFields(asList(firstFieldNumber, rest)); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
ignoringFields
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
@Override public final FieldScope ignoringFields(Iterable<Integer> fieldNumbers) { return create( logic().ignoringFields(fieldNumbers), addUsingCorrespondenceFieldNumbersString(".ignoringFields(%s)", fieldNumbers)); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
ignoringFields
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
@Override public final FieldScope ignoringFieldDescriptors( FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) { return ignoringFieldDescriptors(asList(firstFieldDescriptor, rest)); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
ignoringFieldDescriptors
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
@Override public final FieldScope ignoringFieldDescriptors(Iterable<FieldDescriptor> fieldDescriptors) { return create( logic().ignoringFieldDescriptors(fieldDescriptors), addUsingCorrespondenceFieldDescriptorsString( ".ignoringFieldDescriptors(%s)", fieldDescriptors)); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
ignoringFieldDescriptors
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
@Override public final FieldScope allowingFields(int firstFieldNumber, int... rest) { return allowingFields(asList(firstFieldNumber, rest)); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
allowingFields
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
@Override public final FieldScope allowingFields(Iterable<Integer> fieldNumbers) { return create( logic().allowingFields(fieldNumbers), addUsingCorrespondenceFieldNumbersString(".allowingFields(%s)", fieldNumbers)); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
allowingFields
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
@Override public final FieldScope allowingFieldDescriptors( FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) { return allowingFieldDescriptors(asList(firstFieldDescriptor, rest)); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
allowingFieldDescriptors
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
@Override public final FieldScope allowingFieldDescriptors(Iterable<FieldDescriptor> fieldDescriptors) { return create( logic().allowingFieldDescriptors(fieldDescriptors), addUsingCorrespondenceFieldDescriptorsString( ".allowingFieldDescriptors(%s)", fieldDescriptors)); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
allowingFieldDescriptors
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
private Function<Optional<Descriptor>, String> addUsingCorrespondenceFieldNumbersString( String fmt, Iterable<Integer> fieldNumbers) { return FieldScopeUtil.concat( usingCorrespondenceStringFunction(), FieldScopeUtil.fieldNumbersFunction(fmt, fieldNumbers)); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
addUsingCorrespondenceFieldNumbersString
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
private Function<Optional<Descriptor>, String> addUsingCorrespondenceFieldDescriptorsString( String fmt, Iterable<FieldDescriptor> fieldDescriptors) { return FieldScopeUtil.concat( usingCorrespondenceStringFunction(), Functions.constant(String.format(fmt, join(fieldDescriptors)))); }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
addUsingCorrespondenceFieldDescriptorsString
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
private static Iterable<String> getDescriptors(Iterable<? extends Message> messages) { List<String> descriptors = new ArrayList<>(); for (Message message : messages) { descriptors.add(message == null ? "null" : message.getDescriptorForType().getFullName()); } return descriptors; }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
getDescriptors
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
private static String formatList(Iterable<? extends Message> messages) { List<String> strings = new ArrayList<>(); for (Message message : messages) { strings.add( message == null ? "null" : "{" + TextFormat.printer().printToString(message) + "}"); } return "[" + join(strings) + "]"; }
Implementation of a {@link FieldScope}. It takes a logic component {@link FieldScopeLogic}, and combines it with a human-readable string for use in test failures. <p>{@link FieldScopeLogic} objects may be reused, cached, or otherwise implement particular efficiencies, whereas the human-readable strings are ad-hoc and may be different for otherwise identical logical implementations. For this reason, and to ensure every {@link FieldScope} gets an appropriate testing string, we separate the logic components from the public interface.
formatList
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeImpl.java
Apache-2.0
final boolean contains(Descriptor rootDescriptor, SubScopeId subScopeId) { return policyFor(rootDescriptor, subScopeId).included(); }
Returns whether the given field is included in this FieldScopeLogic.
contains
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override public final FieldScopeLogic subScope(Descriptor rootDescriptor, SubScopeId subScopeId) { FieldScopeResult result = policyFor(rootDescriptor, subScopeId); if (result.recursive()) { return result.included() ? all() : none(); } else { return subScopeImpl(rootDescriptor, subScopeId); } }
Returns a {@code FieldScopeLogic} to handle the message pointed to by this descriptor. <p>Subclasses which can return non-recursive {@link FieldScopeResult}s must override {@link #subScopeImpl} to implement those cases.
subScope
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@ForOverride FieldScopeLogic subScopeImpl(Descriptor rootDescriptor, SubScopeId subScopeId) { throw new UnsupportedOperationException("subScopeImpl not implemented for " + getClass()); }
Returns {@link #subScope} for {@code NONRECURSIVE} results. <p>Throws an {@link UnsupportedOperationException} by default. Subclasses which can return {@code NONRECURSIVE} results must override this method.
subScopeImpl
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override public void validate( Descriptor rootDescriptor, FieldDescriptorValidator fieldDescriptorValidator) {}
Returns an accurate description for debugging purposes. <p>Compare to {@link FieldScope#usingCorrespondenceString(Optional)}, which returns a beautiful error message that makes as much sense to the user as possible. <p>Abstract so subclasses must implement.
validate
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
private static boolean isEmpty(Iterable<?> container) { boolean isEmpty = true; for (Object element : container) { checkNotNull(element); isEmpty = false; } return isEmpty; }
Returns an accurate description for debugging purposes. <p>Compare to {@link FieldScope#usingCorrespondenceString(Optional)}, which returns a beautiful error message that makes as much sense to the user as possible. <p>Abstract so subclasses must implement.
isEmpty
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
FieldScopeLogic ignoringFields(Iterable<Integer> fieldNumbers) { if (isEmpty(fieldNumbers)) { return this; } return and( this, new NegationFieldScopeLogic(new FieldNumbersLogic(fieldNumbers, /* isRecursive = */ true))); }
Returns an accurate description for debugging purposes. <p>Compare to {@link FieldScope#usingCorrespondenceString(Optional)}, which returns a beautiful error message that makes as much sense to the user as possible. <p>Abstract so subclasses must implement.
ignoringFields
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
FieldScopeLogic ignoringFieldDescriptors(Iterable<FieldDescriptor> fieldDescriptors) { if (isEmpty(fieldDescriptors)) { return this; } return and( this, new NegationFieldScopeLogic( new FieldDescriptorsLogic(fieldDescriptors, /* isRecursive = */ true))); }
Returns an accurate description for debugging purposes. <p>Compare to {@link FieldScope#usingCorrespondenceString(Optional)}, which returns a beautiful error message that makes as much sense to the user as possible. <p>Abstract so subclasses must implement.
ignoringFieldDescriptors
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
FieldScopeLogic allowingFields(Iterable<Integer> fieldNumbers) { if (isEmpty(fieldNumbers)) { return this; } return or(this, new FieldNumbersLogic(fieldNumbers, /* isRecursive = */ true)); }
Returns an accurate description for debugging purposes. <p>Compare to {@link FieldScope#usingCorrespondenceString(Optional)}, which returns a beautiful error message that makes as much sense to the user as possible. <p>Abstract so subclasses must implement.
allowingFields
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
FieldScopeLogic allowingFieldsNonRecursive(Iterable<Integer> fieldNumbers) { if (isEmpty(fieldNumbers)) { return this; } return or(this, new FieldNumbersLogic(fieldNumbers, /* isRecursive = */ false)); }
Returns an accurate description for debugging purposes. <p>Compare to {@link FieldScope#usingCorrespondenceString(Optional)}, which returns a beautiful error message that makes as much sense to the user as possible. <p>Abstract so subclasses must implement.
allowingFieldsNonRecursive
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
FieldScopeLogic allowingFieldDescriptors(Iterable<FieldDescriptor> fieldDescriptors) { if (isEmpty(fieldDescriptors)) { return this; } return or(this, new FieldDescriptorsLogic(fieldDescriptors, /* isRecursive = */ true)); }
Returns an accurate description for debugging purposes. <p>Compare to {@link FieldScope#usingCorrespondenceString(Optional)}, which returns a beautiful error message that makes as much sense to the user as possible. <p>Abstract so subclasses must implement.
allowingFieldDescriptors
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
FieldScopeLogic allowingFieldDescriptorsNonRecursive(Iterable<FieldDescriptor> fieldDescriptors) { if (isEmpty(fieldDescriptors)) { return this; } return or(this, new FieldDescriptorsLogic(fieldDescriptors, /* isRecursive = */ false)); }
Returns an accurate description for debugging purposes. <p>Compare to {@link FieldScope#usingCorrespondenceString(Optional)}, which returns a beautiful error message that makes as much sense to the user as possible. <p>Abstract so subclasses must implement.
allowingFieldDescriptorsNonRecursive
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
boolean isAll() { return false; }
Returns whether this is equivalent to {@code FieldScopeLogic.all()}.
isAll
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override public String toString() { return "FieldScopes.all()"; }
Returns whether this is equivalent to {@code FieldScopeLogic.all()}.
toString
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override final FieldScopeResult policyFor(Descriptor rootDescriptor, SubScopeId subScopeId) { return FieldScopeResult.INCLUDED_RECURSIVELY; }
Returns whether this is equivalent to {@code FieldScopeLogic.all()}.
policyFor
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override final boolean isAll() { return true; }
Returns whether this is equivalent to {@code FieldScopeLogic.all()}.
isAll
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override public String toString() { return "FieldScopes.none()"; }
Returns whether this is equivalent to {@code FieldScopeLogic.all()}.
toString
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override final FieldScopeResult policyFor(Descriptor rootDescriptor, SubScopeId subScopeId) { return FieldScopeResult.EXCLUDED_RECURSIVELY; }
Returns whether this is equivalent to {@code FieldScopeLogic.all()}.
policyFor
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
static FieldScopeLogic all() { return ALL; }
Returns whether this is equivalent to {@code FieldScopeLogic.all()}.
all
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
static FieldScopeLogic none() { return NONE; }
Returns whether this is equivalent to {@code FieldScopeLogic.all()}.
none
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override public String toString() { return String.format("PartialScopeLogic(%s)", fieldNumberTree); }
Returns whether this is equivalent to {@code FieldScopeLogic.all()}.
toString
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override final FieldScopeResult policyFor(Descriptor rootDescriptor, SubScopeId subScopeId) { return fieldNumberTree.hasChild(subScopeId) ? FieldScopeResult.INCLUDED_NONRECURSIVELY : FieldScopeResult.EXCLUDED_RECURSIVELY; }
Returns whether this is equivalent to {@code FieldScopeLogic.all()}.
policyFor
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override final FieldScopeLogic subScopeImpl(Descriptor rootDescriptor, SubScopeId subScopeId) { return newPartialScopeLogic(fieldNumberTree.child(subScopeId)); }
Returns whether this is equivalent to {@code FieldScopeLogic.all()}.
subScopeImpl
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
private static PartialScopeLogic newPartialScopeLogic(FieldNumberTree fieldNumberTree) { return fieldNumberTree.isEmpty() ? EMPTY : new PartialScopeLogic(fieldNumberTree); }
Returns whether this is equivalent to {@code FieldScopeLogic.all()}.
newPartialScopeLogic
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override public void validate( Descriptor rootDescriptor, FieldDescriptorValidator fieldDescriptorValidator) { Verify.verify( fieldDescriptorValidator == FieldDescriptorValidator.ALLOW_ALL, "PartialScopeLogic doesn't support custom field validators."); checkArgument( expectedDescriptor.equals(rootDescriptor), "Message given to FieldScopes.fromSetFields() does not have the same descriptor as the " + "message being tested. Expected %s, got %s.", expectedDescriptor.getFullName(), rootDescriptor.getFullName()); }
Returns whether this is equivalent to {@code FieldScopeLogic.all()}.
validate
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override public String toString() { return String.format("FieldScopes.fromSetFields(%s)", repr); }
Returns whether this is equivalent to {@code FieldScopeLogic.all()}.
toString
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
static FieldScopeLogic partialScope( Message message, TypeRegistry typeRegistry, ExtensionRegistry extensionRegistry) { return new RootPartialScopeLogic( FieldNumberTree.fromMessage(message, typeRegistry, extensionRegistry), message.toString(), message.getDescriptorForType()); }
Returns whether this is equivalent to {@code FieldScopeLogic.all()}.
partialScope
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
static FieldScopeLogic partialScope( Iterable<? extends Message> messages, Descriptor descriptor, TypeRegistry typeRegistry, ExtensionRegistry extensionRegistry) { return new RootPartialScopeLogic( FieldNumberTree.fromMessages(messages, typeRegistry, extensionRegistry), Joiner.on(", ").useForNull("null").join(messages), descriptor); }
Returns whether this is equivalent to {@code FieldScopeLogic.all()}.
partialScope
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override final FieldScopeResult policyFor(Descriptor rootDescriptor, SubScopeId subScopeId) { FieldDescriptor fieldDescriptor = null; switch (subScopeId.kind()) { case FIELD_DESCRIPTOR: fieldDescriptor = subScopeId.fieldDescriptor(); break; case UNPACKED_ANY_VALUE_TYPE: fieldDescriptor = AnyUtils.valueFieldDescriptor(); break; case UNKNOWN_FIELD_DESCRIPTOR: return FieldScopeResult.EXCLUDED_RECURSIVELY; } if (matchesFieldDescriptor(rootDescriptor, fieldDescriptor)) { return FieldScopeResult.of(/* included = */ true, isRecursive); } // We return 'EXCLUDED_NONRECURSIVELY' for both field descriptor scopes and field number // scopes. In the former case, the field descriptors are arbitrary, so it's always possible we // find a hit on a sub-message somewhere. In the latter case, the message definition may be // cyclic, so we need to return 'EXCLUDED_NONRECURSIVELY' even if the top level field number // doesn't match. return FieldScopeResult.EXCLUDED_NONRECURSIVELY; }
Determines whether the FieldDescriptor is equal to one of the explicitly defined components of this FieldScopeLogic. @param descriptor Descriptor of the message being tested. @param fieldDescriptor FieldDescriptor being inspected for a direct match to the scope's definition.
policyFor
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override final FieldScopeLogic subScopeImpl(Descriptor rootDescriptor, SubScopeId subScopeId) { return this; }
Determines whether the FieldDescriptor is equal to one of the explicitly defined components of this FieldScopeLogic. @param descriptor Descriptor of the message being tested. @param fieldDescriptor FieldDescriptor being inspected for a direct match to the scope's definition.
subScopeImpl
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override public void validate( Descriptor rootDescriptor, FieldDescriptorValidator fieldDescriptorValidator) { if (isRecursive) { Verify.verify( fieldDescriptorValidator == FieldDescriptorValidator.ALLOW_ALL, "Field descriptor validators are not supported " + "for non-recursive field matcher logics."); } }
Determines whether the FieldDescriptor is equal to one of the explicitly defined components of this FieldScopeLogic. @param descriptor Descriptor of the message being tested. @param fieldDescriptor FieldDescriptor being inspected for a direct match to the scope's definition.
validate
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override public void validate( Descriptor rootDescriptor, FieldDescriptorValidator fieldDescriptorValidator) { super.validate(rootDescriptor, fieldDescriptorValidator); for (int fieldNumber : fieldNumbers) { FieldDescriptor fieldDescriptor = rootDescriptor.findFieldByNumber(fieldNumber); checkArgument( fieldDescriptor != null, "Message type %s has no field with number %s.", rootDescriptor.getFullName(), fieldNumber); fieldDescriptorValidator.validate(fieldDescriptor); } }
Determines whether the FieldDescriptor is equal to one of the explicitly defined components of this FieldScopeLogic. @param descriptor Descriptor of the message being tested. @param fieldDescriptor FieldDescriptor being inspected for a direct match to the scope's definition.
validate
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override boolean matchesFieldDescriptor(Descriptor descriptor, FieldDescriptor fieldDescriptor) { return fieldDescriptor.getContainingType() == descriptor && fieldNumbers.contains(fieldDescriptor.getNumber()); }
Determines whether the FieldDescriptor is equal to one of the explicitly defined components of this FieldScopeLogic. @param descriptor Descriptor of the message being tested. @param fieldDescriptor FieldDescriptor being inspected for a direct match to the scope's definition.
matchesFieldDescriptor
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override public String toString() { return String.format("FieldScopes.allowingFields(%s)", join(fieldNumbers)); }
Determines whether the FieldDescriptor is equal to one of the explicitly defined components of this FieldScopeLogic. @param descriptor Descriptor of the message being tested. @param fieldDescriptor FieldDescriptor being inspected for a direct match to the scope's definition.
toString
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override boolean matchesFieldDescriptor(Descriptor descriptor, FieldDescriptor fieldDescriptor) { return fieldDescriptors.contains(fieldDescriptor); }
Determines whether the FieldDescriptor is equal to one of the explicitly defined components of this FieldScopeLogic. @param descriptor Descriptor of the message being tested. @param fieldDescriptor FieldDescriptor being inspected for a direct match to the scope's definition.
matchesFieldDescriptor
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override public void validate( Descriptor rootDescriptor, FieldDescriptorValidator fieldDescriptorValidator) { super.validate(rootDescriptor, fieldDescriptorValidator); for (FieldDescriptor fieldDescriptor : fieldDescriptors) { fieldDescriptorValidator.validate(fieldDescriptor); } }
Determines whether the FieldDescriptor is equal to one of the explicitly defined components of this FieldScopeLogic. @param descriptor Descriptor of the message being tested. @param fieldDescriptor FieldDescriptor being inspected for a direct match to the scope's definition.
validate
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override public String toString() { return String.format("FieldScopes.allowingFieldDescriptors(%s)", join(fieldDescriptors)); }
Determines whether the FieldDescriptor is equal to one of the explicitly defined components of this FieldScopeLogic. @param descriptor Descriptor of the message being tested. @param fieldDescriptor FieldDescriptor being inspected for a direct match to the scope's definition.
toString
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override public final void validate( Descriptor rootDescriptor, FieldDescriptorValidator fieldDescriptorValidator) { for (FieldScopeLogic elem : elements) { elem.validate(rootDescriptor, fieldDescriptorValidator); } }
Determines whether the FieldDescriptor is equal to one of the explicitly defined components of this FieldScopeLogic. @param descriptor Descriptor of the message being tested. @param fieldDescriptor FieldDescriptor being inspected for a direct match to the scope's definition.
validate
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override final FieldScopeLogic subScopeImpl(Descriptor rootDescriptor, SubScopeId subScopeId) { ImmutableList.Builder<FieldScopeLogic> builder = ImmutableList.builderWithExpectedSize(elements.size()); for (FieldScopeLogic elem : elements) { builder.add(elem.subScope(rootDescriptor, subScopeId)); } return newLogicOfSameType(builder.build()); }
Helper to produce a new {@code CompoundFieldScopeLogic} of the same type as the subclass.
subScopeImpl
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override IntersectionFieldScopeLogic newLogicOfSameType(List<FieldScopeLogic> newElements) { checkArgument(newElements.size() == 2, "Expected 2 elements: %s", newElements); return new IntersectionFieldScopeLogic(newElements.get(0), newElements.get(1)); }
Helper to produce a new {@code CompoundFieldScopeLogic} of the same type as the subclass.
newLogicOfSameType
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override FieldScopeResult policyFor(Descriptor rootDescriptor, SubScopeId subScopeId) { // The intersection of two scopes is ignorable if either scope is itself ignorable. return intersection( elements.get(0).policyFor(rootDescriptor, subScopeId), elements.get(1).policyFor(rootDescriptor, subScopeId)); }
Helper to produce a new {@code CompoundFieldScopeLogic} of the same type as the subclass.
policyFor
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
private static FieldScopeResult intersection( FieldScopeResult result1, FieldScopeResult result2) { if (result1 == FieldScopeResult.EXCLUDED_RECURSIVELY || result2 == FieldScopeResult.EXCLUDED_RECURSIVELY) { // If either argument is excluded recursively, the result is too. return FieldScopeResult.EXCLUDED_RECURSIVELY; } else if (!result1.included() || !result2.included()) { // Otherwise, we exclude non-recursively if either result is an exclusion. return FieldScopeResult.EXCLUDED_NONRECURSIVELY; } else if (result1.recursive() && result2.recursive()) { // We include recursively if both arguments are recursive. return FieldScopeResult.INCLUDED_RECURSIVELY; } else { // Otherwise, we include non-recursively. return FieldScopeResult.INCLUDED_NONRECURSIVELY; } }
Helper to produce a new {@code CompoundFieldScopeLogic} of the same type as the subclass.
intersection
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override public String toString() { return String.format("(%s && %s)", elements.get(0), elements.get(1)); }
Helper to produce a new {@code CompoundFieldScopeLogic} of the same type as the subclass.
toString
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override UnionFieldScopeLogic newLogicOfSameType(List<FieldScopeLogic> newElements) { checkArgument(newElements.size() == 2, "Expected 2 elements: %s", newElements); return new UnionFieldScopeLogic(newElements.get(0), newElements.get(1)); }
Helper to produce a new {@code CompoundFieldScopeLogic} of the same type as the subclass.
newLogicOfSameType
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
@Override FieldScopeResult policyFor(Descriptor rootDescriptor, SubScopeId subScopeId) { // The union of two scopes is ignorable only if both scopes are themselves ignorable. return union( elements.get(0).policyFor(rootDescriptor, subScopeId), elements.get(1).policyFor(rootDescriptor, subScopeId)); }
Helper to produce a new {@code CompoundFieldScopeLogic} of the same type as the subclass.
policyFor
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0
private static FieldScopeResult union(FieldScopeResult result1, FieldScopeResult result2) { if (result1 == FieldScopeResult.INCLUDED_RECURSIVELY || result2 == FieldScopeResult.INCLUDED_RECURSIVELY) { // If either argument is included recursively, the result is too. return FieldScopeResult.INCLUDED_RECURSIVELY; } else if (result1.included() || result2.included()) { // Otherwise, if either is included, we include non-recursively. return FieldScopeResult.INCLUDED_NONRECURSIVELY; } else if (result1.recursive() && result2.recursive()) { // If both arguments are recursive, we exclude recursively. return FieldScopeResult.EXCLUDED_RECURSIVELY; } else { // Otherwise, we exclude exclude non-recursively. return FieldScopeResult.EXCLUDED_NONRECURSIVELY; } }
Helper to produce a new {@code CompoundFieldScopeLogic} of the same type as the subclass.
union
java
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
Apache-2.0