Source:
<code>public Map<String, Object> getMetacardTypeMap() { Map<String, Object> resultTypes = new HashMap<>(); for (MetacardType metacardType : metacardTypes) { Map<String, Object> attributes = new HashMap<>(); for (AttributeDescriptor descriptor : metacardType.getAttributeDescriptors()) { Map<String, Object> attributeProperties = new HashMap<>(); attributeProperties.put("type", descriptor.getType().getAttributeFormat().name()); attributeProperties.put("multivalued", descriptor.isMultiValued()); attributeProperties.put("id", descriptor.getName()); attributeProperties.put("isInjected", false); attributes.put(descriptor.getName(), attributeProperties); } resultTypes.put(metacardType.getName(), attributes); } for (InjectableAttribute attribute : injectableAttributes) { Optional<AttributeDescriptor> lookup = attributeRegistry.lookup(attribute.attribute()); if (!lookup.isPresent()) { continue; } AttributeDescriptor descriptor = lookup.get(); Map<String, Object> attributeProperties = new HashMap<>(); attributeProperties.put("type", descriptor.getType().getAttributeFormat().name()); attributeProperties.put("multivalued", descriptor.isMultiValued()); attributeProperties.put("id", descriptor.getName()); <START> attributeProperties.put("isInjected", true); <END> Set<String> types = attribute.metacardTypes().isEmpty() ? resultTypes.keySet() : attribute.metacardTypes(); types .stream() .filter(type -> isAttributeMissing(resultTypes, attribute, type)) .forEach( type -> { Map<String, Object> attributes = (Map) resultTypes.getOrDefault(type, new HashMap<String, Object>()); attributes.put(attribute.attribute(), attributeProperties); resultTypes.put(type, attributes); }); } return resultTypes; }</code><technical_language>Do strings pulled constants</technical_language>

Target:
public Map<String, Object> getMetacardTypeMap() { Map<String, Object> resultTypes = new HashMap<>(); for (MetacardType metacardType : metacardTypes) { Map<String, Object> attributes = new HashMap<>(); for (AttributeDescriptor descriptor : metacardType.getAttributeDescriptors()) { Map<String, Object> attributeProperties = new HashMap<>(); attributeProperties.put(TYPE_KEY, descriptor.getType().getAttributeFormat().name()); attributeProperties.put(MULTIVALUED_KEY, descriptor.isMultiValued()); attributeProperties.put(ID_KEY, descriptor.getName()); attributeProperties.put(ISINJECTED_KEY, false); attributes.put(descriptor.getName(), attributeProperties); } resultTypes.put(metacardType.getName(), attributes); } for (InjectableAttribute attribute : injectableAttributes) { Optional<AttributeDescriptor> lookup = attributeRegistry.lookup(attribute.attribute()); if (!lookup.isPresent()) { continue; } AttributeDescriptor descriptor = lookup.get(); Map<String, Object> attributeProperties = new HashMap<>(); attributeProperties.put(TYPE_KEY, descriptor.getType().getAttributeFormat().name()); attributeProperties.put(MULTIVALUED_KEY, descriptor.isMultiValued()); attributeProperties.put(ID_KEY, descriptor.getName()); attributeProperties.put(ISINJECTED_KEY, true); Set<String> types = attribute.metacardTypes().isEmpty() ? resultTypes.keySet() : attribute.metacardTypes(); types .stream() .filter(type -> isAttributeMissing(resultTypes, attribute, type)) .forEach( type -> mergeMetacardTypeIntoResults(resultTypes, attribute, attributeProperties, type)); } return resultTypes; }