CPD Results
The following document contains the results of PMD's CPD 6.55.0.
Duplications
File | Line |
---|---|
gov/nist/secauto/metaschema/databind/io/json/MetaschemaInstanceUtils.java | 71 |
gov/nist/secauto/metaschema/databind/model/info/ClassDataTypeHandler.java | 92 |
public static Map<String, ? extends IBoundNamedInstance> getInstancesToParse( @NonNull IClassBinding targetDefinition, boolean requiresJsonKey) { Collection<? extends IBoundFlagInstance> flags = targetDefinition.getFlagInstances(); int flagCount = flags.size() - (requiresJsonKey ? 1 : 0); @SuppressWarnings("resource") Stream<? extends IBoundNamedInstance> instanceStream; if (targetDefinition instanceof IAssemblyClassBinding) { instanceStream = ((IAssemblyClassBinding) targetDefinition).getModelInstances().stream(); // .flatMap((instance) -> { // return instance instanceof IChoiceInstance ? // ((IChoiceInstance)instance).getNamedModelInstances().stream() // }); } else if (targetDefinition instanceof IFieldClassBinding) { IFieldClassBinding targetFieldDefinition = (IFieldClassBinding) targetDefinition; IBoundFlagInstance jsonValueKeyFlag = targetFieldDefinition.getJsonValueKeyFlagInstance(); if (jsonValueKeyFlag == null && flagCount > 0) { // the field value is handled as named field IBoundFieldValueInstance fieldValue = targetFieldDefinition.getFieldValueInstance(); instanceStream = Stream.of(fieldValue); } else { // only the value, with no flags or a JSON value key flag instanceStream = Stream.empty(); } } else { throw new UnsupportedOperationException( String.format("Unsupported class binding type: %s", targetDefinition.getClass().getName())); } if (requiresJsonKey) { IBoundFlagInstance jsonKey = targetDefinition.getJsonKeyFlagInstance(); assert jsonKey != null; instanceStream = Stream.concat( flags.stream().filter((flag) -> !jsonKey.equals(flag)), instanceStream); } else { instanceStream = Stream.concat( flags.stream(), instanceStream); } return ObjectUtils.notNull(instanceStream.collect( Collectors.toMap( |