test_class.declarator: NAMESPACE = "org.eclipse.ditto.test"
test_class.modifier: private static final
test_class.original_string: private static final String NAMESPACE = "org.eclipse.ditto.test";
test_class.type: String
test_class.var_name: NAMESPACE
test_class.declarator: THING_ID = NAMESPACE + ":" + "myThingId"
test_class.modifier: private static final
test_class.original_string: private static final String THING_ID = NAMESPACE + ":" + "myThingId";
test_class.type: String
test_class.var_name: THING_ID
test_class.declarator: OVERHEAD =
              THING_ID.length() + NAMESPACE.length() + IndexLengthRestrictionEnforcer.AUTHORIZATION_SUBJECT_OVERHEAD
test_class.modifier: private static final
test_class.original_string: private static final int OVERHEAD =
              THING_ID.length() + NAMESPACE.length() + IndexLengthRestrictionEnforcer.AUTHORIZATION_SUBJECT_OVERHEAD;
test_class.type: int
test_class.var_name: OVERHEAD
test_class.declarator: indexLengthRestrictionEnforcer
test_class.modifier: private
test_class.original_string: private IndexLengthRestrictionEnforcer indexLengthRestrictionEnforcer;
test_class.type: IndexLengthRestrictionEnforcer
test_class.var_name: indexLengthRestrictionEnforcer
test_class.file: services/thingsearch/persistence/src/test/java/org/eclipse/ditto/services/thingsearch/persistence/write/IndexLengthRestrictionEnforcerTest.java
test_class.identifier: IndexLengthRestrictionEnforcerTest
test_case.body: @Test
      public void doNotTruncateWithoutViolation() {
          final String key = "/attributes/doesNotTruncateWithoutViolation";
          final int maxAllowedValueForKey = MAX_INDEX_CONTENT_LENGTH - OVERHEAD - key.length();
          final String value = TestStringGenerator.createStringOfBytes(maxAllowedValueForKey);
          assertThat(indexLengthRestrictionEnforcer.enforce(JsonPointer.of(key), JsonValue.of(value)))
                  .contains(JsonValue.of(value));
      }
test_case.class_method_signature: IndexLengthRestrictionEnforcerTest.doNotTruncateWithoutViolation()
test_case.full_signature: @Test public void doNotTruncateWithoutViolation()
test_case.identifier: doNotTruncateWithoutViolation
test_case.invocations: length createStringOfBytes contains assertThat enforce of of of
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void doNotTruncateWithoutViolation()
focal_class.declarator: DEFAULT_VALUE_LENGTH = 4
focal_class.modifier: private static final
focal_class.original_string: private static final int DEFAULT_VALUE_LENGTH = 4;
focal_class.type: int
focal_class.var_name: DEFAULT_VALUE_LENGTH
focal_class.declarator: MAX_INDEX_CONTENT_LENGTH = 950
focal_class.modifier: static final
focal_class.original_string: static final int MAX_INDEX_CONTENT_LENGTH = 950;
focal_class.type: int
focal_class.var_name: MAX_INDEX_CONTENT_LENGTH
focal_class.declarator: AUTHORIZATION_SUBJECT_OVERHEAD = 128
focal_class.modifier: static final
focal_class.original_string: static final int AUTHORIZATION_SUBJECT_OVERHEAD = 128;
focal_class.type: int
focal_class.var_name: AUTHORIZATION_SUBJECT_OVERHEAD
focal_class.declarator: thingIdNamespaceOverhead
focal_class.modifier: private final
focal_class.original_string: private final int thingIdNamespaceOverhead;
focal_class.type: int
focal_class.var_name: thingIdNamespaceOverhead
focal_class.file: services/thingsearch/persistence/src/main/java/org/eclipse/ditto/services/thingsearch/persistence/write/IndexLengthRestrictionEnforcer.java
focal_class.identifier: IndexLengthRestrictionEnforcer
focal_class.class_method_signature: IndexLengthRestrictionEnforcer.IndexLengthRestrictionEnforcer(final String thingId)
focal_class.full_signature: private  IndexLengthRestrictionEnforcer(final String thingId)
focal_class.identifier: IndexLengthRestrictionEnforcer
focal_class.modifiers: private
focal_class.parameters: (final String thingId)
focal_class.signature:  IndexLengthRestrictionEnforcer(final String thingId)
focal_class.class_method_signature: IndexLengthRestrictionEnforcer.newInstance(final String thingId)
focal_class.full_signature: public static IndexLengthRestrictionEnforcer newInstance(final String thingId)
focal_class.identifier: newInstance
focal_class.modifiers: public static
focal_class.parameters: (final String thingId)
focal_class.return: IndexLengthRestrictionEnforcer
focal_class.signature: IndexLengthRestrictionEnforcer newInstance(final String thingId)
focal_class.class_method_signature: IndexLengthRestrictionEnforcer.enforce(final JsonPointer pointer, final JsonValue value)
focal_class.full_signature: public Optional<JsonValue> enforce(final JsonPointer pointer, final JsonValue value)
focal_class.identifier: enforce
focal_class.modifiers: public
focal_class.parameters: (final JsonPointer pointer, final JsonValue value)
focal_class.return: Optional<JsonValue>
focal_class.signature: Optional<JsonValue> enforce(final JsonPointer pointer, final JsonValue value)
focal_class.class_method_signature: IndexLengthRestrictionEnforcer.isNonEmptyComposite(final JsonValue value)
focal_class.full_signature: private static boolean isNonEmptyComposite(final JsonValue value)
focal_class.identifier: isNonEmptyComposite
focal_class.modifiers: private static
focal_class.parameters: (final JsonValue value)
focal_class.return: boolean
focal_class.signature: boolean isNonEmptyComposite(final JsonValue value)
focal_class.class_method_signature: IndexLengthRestrictionEnforcer.fixViolation(final JsonValue value, final int keyOverhead)
focal_class.full_signature: private static JsonValue fixViolation(final JsonValue value, final int keyOverhead)
focal_class.identifier: fixViolation
focal_class.modifiers: private static
focal_class.parameters: (final JsonValue value, final int keyOverhead)
focal_class.return: JsonValue
focal_class.signature: JsonValue fixViolation(final JsonValue value, final int keyOverhead)
focal_class.class_method_signature: IndexLengthRestrictionEnforcer.calculateThingIdNamespaceAuthSubjectOverhead(final String thingId)
focal_class.full_signature: private static int calculateThingIdNamespaceAuthSubjectOverhead(final String thingId)
focal_class.identifier: calculateThingIdNamespaceAuthSubjectOverhead
focal_class.modifiers: private static
focal_class.parameters: (final String thingId)
focal_class.return: int
focal_class.signature: int calculateThingIdNamespaceAuthSubjectOverhead(final String thingId)
focal_class.class_method_signature: IndexLengthRestrictionEnforcer.jsonPointerBytes(final JsonPointer jsonPointer)
focal_class.full_signature: private static int jsonPointerBytes(final JsonPointer jsonPointer)
focal_class.identifier: jsonPointerBytes
focal_class.modifiers: private static
focal_class.parameters: (final JsonPointer jsonPointer)
focal_class.return: int
focal_class.signature: int jsonPointerBytes(final JsonPointer jsonPointer)
focal_class.class_method_signature: IndexLengthRestrictionEnforcer.checkThingId(final String thingId)
focal_class.full_signature: private static void checkThingId(final String thingId)
focal_class.identifier: checkThingId
focal_class.modifiers: private static
focal_class.parameters: (final String thingId)
focal_class.return: void
focal_class.signature: void checkThingId(final String thingId)
focal_method.body: public Optional<JsonValue> enforce(final JsonPointer pointer, final JsonValue value) {
          final int keyOverhead = jsonPointerBytes(pointer) + thingIdNamespaceOverhead;
          if (keyOverhead > MAX_INDEX_CONTENT_LENGTH - DEFAULT_VALUE_LENGTH) {
              // not possible to trim key-value pair; do not index this entry.
              return Optional.empty();
          } else if (value.isString()) {
              return Optional.of(fixViolation(value, keyOverhead));
          } else if (isNonEmptyComposite(value)) {
              // unexpected composite value - complain
              throw new IllegalArgumentException("value should not be an array or object but it is");
          } else {
              return Optional.of(value);
          }
      }
focal_method.class_method_signature: IndexLengthRestrictionEnforcer.enforce(final JsonPointer pointer, final JsonValue value)
focal_method.full_signature: public Optional<JsonValue> enforce(final JsonPointer pointer, final JsonValue value)
focal_method.identifier: enforce
focal_method.invocations: jsonPointerBytes empty isString of fixViolation isNonEmptyComposite of
focal_method.modifiers: public
focal_method.parameters: (final JsonPointer pointer, final JsonValue value)
focal_method.return: Optional<JsonValue>
focal_method.signature: Optional<JsonValue> enforce(final JsonPointer pointer, final JsonValue value)