Java Code Examples for java.util.Map#putAll()

The following examples show how to use java.util.Map#putAll() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TagUtils.java    From cs-actions with Apache License 2.0 6 votes vote down vote up
@NotNull
public Map<String, String> getDescribeTagsQueryParamsMap(@NotNull InputsWrapper wrapper) {
    final Map<String, String> queryParamsMap = new HashMap<>();
    setCommonQueryParamsMap(queryParamsMap, wrapper.getCommonInputs().getAction(), wrapper.getCommonInputs().getVersion());

    setOptionalMapEntry(queryParamsMap, MAX_RESULTS, wrapper.getFilterInputs().getMaxResults(),
            !NOT_RELEVANT.equalsIgnoreCase(wrapper.getFilterInputs().getMaxResults()));
    setOptionalMapEntry(queryParamsMap, NEXT_TOKEN, wrapper.getFilterInputs().getNextToken(),
            isNotBlank(wrapper.getFilterInputs().getNextToken()));

    final TagFilterValidator tagFilterValidator = new TagFilterValidator();

    final Map<String, String> filterQueryMap = getFiltersQueryMap(wrapper.getFilterInputs(), tagFilterValidator);
    queryParamsMap.putAll(filterQueryMap);

    return queryParamsMap;
}
 
Example 2
Source File: ProxyModelFactory.java    From arcusplatform with Apache License 2.0 6 votes vote down vote up
@Override
public Model create(
      Map<String, Object> attributes,
      Collection<Class<? extends Capability>> types
) {
   Set<Class<?>> interfaces = new LinkedHashSet<Class<?>>(types.size() + 2);
   interfaces.add(Model.class);
   interfaces.add(Capability.class);
   
   Map<Method, ModelInvocationFunction> handlers = new HashMap<Method, ModelInvocationFunction>(defaultFunctions);
   for(Class<? extends Capability> type: types) {
      interfaces.add(type);
      handlers.putAll(getFunctionsFor(type));
   }
   
   DelegateProxyModel model = new DelegateProxyModel(attributes, client);
   return (Model) Proxy.newProxyInstance(
         Capability.class.getClassLoader(), 
         interfaces.toArray(new Class<?>[interfaces.size()]), 
         new ModelInvocationHandler(model, handlers)
   );
}
 
Example 3
Source File: HBaseTransactionPruningPlugin.java    From phoenix-tephra with Apache License 2.0 6 votes vote down vote up
private Map<byte[], Long> handleEmptyRegions(long inactiveTransactionBound,
                                             SortedSet<byte[]> transactionalRegions,
                                             Map<byte[], Long> pruneUpperBoundRegions) throws IOException {
  long inactiveTransactionBoundTime = TxUtils.getTimestamp(inactiveTransactionBound);
  SortedSet<byte[]> emptyRegions =
    dataJanitorState.getEmptyRegionsAfterTime(inactiveTransactionBoundTime, transactionalRegions);
  LOG.debug("Got empty transactional regions for inactive transaction bound time {}: {}",
            inactiveTransactionBoundTime, Iterables.transform(emptyRegions, TimeRegions.BYTE_ARR_TO_STRING_FN));

  // The regions that are recorded as empty after inactiveTransactionBoundTime will not have invalid data
  // for transactions started before or on inactiveTransactionBoundTime. Hence we can consider the prune upper bound
  // for these empty regions as inactiveTransactionBound
  Map<byte[], Long> pubWithEmptyRegions = new TreeMap<>(Bytes.BYTES_COMPARATOR);
  pubWithEmptyRegions.putAll(pruneUpperBoundRegions);
  for (byte[] emptyRegion : emptyRegions) {
    if (!pruneUpperBoundRegions.containsKey(emptyRegion)) {
      pubWithEmptyRegions.put(emptyRegion, inactiveTransactionBound);
    }
  }
  return Collections.unmodifiableMap(pubWithEmptyRegions);
}
 
Example 4
Source File: OpenApiObjectGenerator.java    From flow with Apache License 2.0 5 votes vote down vote up
private Map<String, ResolvedReferenceType> collectUsedTypesFromSchema(
        Schema schema) {
    Map<String, ResolvedReferenceType> map = new HashMap<>();
    if (GeneratorUtils.isNotBlank(schema.getName())
            || GeneratorUtils.isNotBlank(schema.get$ref())) {
        String name = GeneratorUtils.firstNonBlank(schema.getName(),
                schemaResolver.getSimpleRef(schema.get$ref()));
        ResolvedReferenceType resolvedReferenceType = schemaResolver
                .getFoundTypeByQualifiedName(name);
        if (resolvedReferenceType != null) {
            map.put(name, resolvedReferenceType);
        } else {
            getLogger().info(
                    "Can't find the type information of class '{}'. "
                            + "This might result in a missing schema in the generated OpenAPI spec.",
                    name);
        }
    }
    if (schema instanceof ArraySchema) {
        map.putAll(collectUsedTypesFromSchema(
                ((ArraySchema) schema).getItems()));
    } else if (schema instanceof MapSchema
            && schema.getAdditionalProperties() != null) {
        map.putAll(collectUsedTypesFromSchema(
                (Schema) schema.getAdditionalProperties()));
    } else if (schema instanceof ComposedSchema
            && ((ComposedSchema) schema).getAllOf() != null) {
            for (Schema child : ((ComposedSchema) schema).getAllOf()) {
                map.putAll(collectUsedTypesFromSchema(child));
            }
    }
    if (schema.getProperties() != null) {
        schema.getProperties().values().forEach(
                o -> map.putAll(collectUsedTypesFromSchema((Schema) o)));
    }
    return map;
}
 
Example 5
Source File: TestNgXmlTest.java    From teammates with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Recursively adds files from testng-component.xml which are to be checked.
 *
 * @param path                            Check files and directories in the current path
 *
 * @param areFilesInCurrentDirExcluded    If true, files in the current path are not
 *                                        added to tests but sub-directories are still checked
 *
 * @param packageName                     Package name of the current file
 * @param testNgXml                       Contents of testng-component.xml
 *
 * @return                                Map containing {@code <class name, package name>} including
 *                                        current file or tests in the current directory
 */
private Map<String, String> addFilesToTestsRecursively(String path, boolean areFilesInCurrentDirExcluded,
        String packageName, String testNgXml) {

    Map<String, String> testFiles = new HashMap<>();
    File folder = new File(path);
    File[] listOfFiles = folder.listFiles();
    if (listOfFiles == null) {
        return testFiles;
    }

    for (File file : listOfFiles) {
        String name = file.getName();

        if (file.isFile() && name.endsWith(".java") && !name.startsWith("package-info")
                && !areFilesInCurrentDirExcluded) {
            testFiles.put(name.replace(".java", ""), packageName);

        } else if (file.isDirectory() && !name.endsWith("browsertests") && !name.endsWith("architecture")) {
            // If the package name is in TestNG in the form of <package name="teammates.test.cases.package.name" />
            // then files in the current directory are excluded because the whole package would be tested by TestNG.

            testFiles.putAll(
                    addFilesToTestsRecursively(path + "/" + name,
                                               isPackageNameInTestNg(packageName + "." + name, testNgXml),
                                               packageName + "." + name, testNgXml));
        }
    }

    return testFiles;
}
 
Example 6
Source File: ProcessBuilderFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ProcessBuilder createProcessBuilder(ProcessSettings processSettings) {
    List<String> commandWithArguments = new ArrayList<String>();
    commandWithArguments.add(processSettings.getCommand());
    commandWithArguments.addAll(processSettings.getArguments());

    ProcessBuilder processBuilder = new ProcessBuilder(commandWithArguments);
    processBuilder.directory(processSettings.getDirectory());
    processBuilder.redirectErrorStream(processSettings.getRedirectErrorStream());

    Map<String, String> environment = processBuilder.environment();
    environment.clear();
    environment.putAll(processSettings.getEnvironment());

    return processBuilder;
}
 
Example 7
Source File: CollectdRecordConverter.java    From datacollector with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
static Map<String, String> getTags(List<String> tagFields, Record record) throws OnRecordErrorException {
  Map<String, String> tags = new HashMap<>(TAG_FIELDS.size());

  for (String tag : TAG_FIELDS) {
    putIfTag(record, tags, tag);
  }

  tags.putAll(RecordConverterUtil.getTags(tagFields, record));
  return tags;
}
 
Example 8
Source File: COSParser.java    From PdfBox-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Check the XRef table by dereferencing all objects and fixing the offset if necessary.
 *
 * @throws IOException if something went wrong.
 */
private void checkXrefOffsets() throws IOException
{
    // repair mode isn't available in non-lenient mode
    if (!isLenient)
    {
        return;
    }
    Map<COSObjectKey, Long> xrefOffset = xrefTrailerResolver.getXrefTable();
    if (xrefOffset != null)
    {
        boolean bruteForceSearch = false;
        for (Entry<COSObjectKey, Long> objectEntry : xrefOffset.entrySet())
        {
            COSObjectKey objectKey = objectEntry.getKey();
            Long objectOffset = objectEntry.getValue();
            // a negative offset number represents a object number itself
            // see type 2 entry in xref stream
            if (objectOffset != null && objectOffset >= 0
                && !checkObjectKeys(objectKey, objectOffset))
            {
                Log.d("PdfBox-Android", "Stop checking xref offsets as at least one couldn't be dereferenced");
                bruteForceSearch = true;
                break;
            }
        }
        if (bruteForceSearch)
        {
            bfSearchForObjects();
            if (bfSearchCOSObjectKeyOffsets != null && !bfSearchCOSObjectKeyOffsets.isEmpty())
            {
                Log.d("PdfBox-Android", "Replaced read xref table with the results of a brute force search");
                xrefOffset.putAll(bfSearchCOSObjectKeyOffsets);
            }
        }
    }
}
 
Example 9
Source File: ConversationStep.java    From EDDI with Apache License 2.0 5 votes vote down vote up
@Override
public void addConversationOutputMap(String key, Map<String, Object> map) {
    Map<String, Object> currentMap = (Map<String, Object>) conversationOutput.
            computeIfAbsent(key, (Function<String, Map>) k -> new LinkedHashMap<String, Object>());

    currentMap.putAll(map);
}
 
Example 10
Source File: AclConfigParser.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private ACLProviderEntry getEntry(XMLEventReader xmlEventReader) throws XMLStreamException
{
   XMLEvent xmlEvent = xmlEventReader.nextEvent(); 
   Map<String, Object> options = new HashMap<String,Object>();
   
   
   String codeName = null;
   ControlFlag controlFlag = ControlFlag.REQUIRED;
   
   //We got the login-module element
   StartElement policyModuleElement = (StartElement) xmlEvent;
   //We got the login-module element
   Iterator<Attribute> attrs = policyModuleElement.getAttributes();
   while(attrs.hasNext())
   {
      Attribute attribute = attrs.next();
      
      QName attQName = attribute.getName();
      String attributeValue = StaxParserUtil.getAttributeValue(attribute);
      if("code".equals(attQName.getLocalPart()))
      {
         codeName = attributeValue; 
      }
      else if("flag".equals(attQName.getLocalPart()))
      {
         controlFlag = ControlFlag.valueOf(attributeValue);
      } 
   } 
   //See if there are options
   ModuleOptionParser moParser = new ModuleOptionParser();
   options.putAll(moParser.parse(xmlEventReader));
   
   ACLProviderEntry entry =  new ACLProviderEntry(codeName, options); 
   entry.setControlFlag(controlFlag);
   return entry;
}
 
Example 11
Source File: BlobStoreModule.java    From emodb with Apache License 2.0 5 votes vote down vote up
@Provides @Singleton @KeyspaceMap
Map<String, CassandraKeyspace> provideKeyspaces(BlobStoreConfiguration configuration, CassandraFactory factory) {
    Map<String, CassandraKeyspace> keyspaceMap = Maps.newHashMap();
    for (CassandraConfiguration cassandraConfig : configuration.getCassandraClusters().values()) {
        Map<String, CassandraKeyspace> keyspacesInCluster = factory.build(cassandraConfig);
        keyspaceMap.putAll(keyspacesInCluster);
    }
    return ImmutableMap.copyOf(keyspaceMap);
}
 
Example 12
Source File: KylinConfigBase.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
public Map<Integer, String> getJobEngines() {
    Map<Integer, String> r = Maps.newLinkedHashMap();
    // ref constants in IEngineAware
    r.put(0, "org.apache.kylin.engine.mr.MRBatchCubingEngine"); //IEngineAware.ID_MR_V1
    r.put(2, "org.apache.kylin.engine.mr.MRBatchCubingEngine2"); //IEngineAware.ID_MR_V2
    r.put(4, "org.apache.kylin.engine.spark.SparkBatchCubingEngine2"); //IEngineAware.ID_SPARK
    r.put(6, "org.apache.kylin.engine.spark.SparkBatchCubingEngineParquet"); //IEngineAware.ID_SPARK_II
    r.put(5, "org.apache.kylin.engine.flink.FlinkBatchCubingEngine2"); //IEngineAware.ID_FLINK
    r.putAll(convertKeyToInteger(getPropertiesByPrefix("kylin.engine.provider.")));
    return r;
}
 
Example 13
Source File: S3GlobalAccessRule.java    From pacbot with Apache License 2.0 5 votes vote down vote up
private boolean isPolicyTrue(AmazonS3Client awsS3Client, String s3BucketName, String accessType,Map<String,Boolean> checkPolicyMap) {
    Map<String, Boolean> checkPolicy = S3PacbotUtils.getPublicAccessPolicy(awsS3Client, s3BucketName, accessType);
    if (!checkPolicy.isEmpty()) {
    	checkPolicyMap.putAll(checkPolicy);
      return (checkPolicy.containsKey("Read") || checkPolicy.containsKey("Write"));
    }
    return false;
}
 
Example 14
Source File: TestInvokeGRPC.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Test
public void testSecureTwoWaySsl() throws Exception {
    final Map<String, String> sslProperties = getKeystoreProperties();
    sslProperties.putAll(getTruststoreProperties());
    final TestGRPCServer<DummyFlowFileService> server = new TestGRPCServer<>(DummyFlowFileService.class, sslProperties);

    try {
        final TestRunner runner = TestRunners.newTestRunner(InvokeGRPC.class);
        runner.setProperty(InvokeGRPC.PROP_SERVICE_HOST, TestGRPCServer.HOST);
        useSSLContextService(runner, sslProperties);
        final int port = server.start(0);
        runner.setProperty(InvokeGRPC.PROP_SERVICE_PORT, String.valueOf(port));
        runner.setProperty(InvokeGRPC.PROP_USE_SECURE, "true");

        final MockFlowFile mockFlowFile = new MockFlowFile(SUCCESS);
        runner.enqueue(mockFlowFile);
        runner.run();
        runner.assertTransferCount(InvokeGRPC.REL_RESPONSE, 1);
        runner.assertTransferCount(InvokeGRPC.REL_SUCCESS_REQ, 1);
        runner.assertTransferCount(InvokeGRPC.REL_RETRY, 0);
        runner.assertTransferCount(InvokeGRPC.REL_NO_RETRY, 0);
        runner.assertTransferCount(InvokeGRPC.REL_FAILURE, 0);

        final List<MockFlowFile> responseFiles = runner.getFlowFilesForRelationship(InvokeGRPC.REL_RESPONSE);
        assertThat(responseFiles.size(), equalTo(1));
        final MockFlowFile response = responseFiles.get(0);
        response.assertAttributeEquals(InvokeGRPC.RESPONSE_CODE, String.valueOf(FlowFileReply.ResponseCode.SUCCESS));
        response.assertAttributeEquals(InvokeGRPC.RESPONSE_BODY, "success");
        response.assertAttributeEquals(InvokeGRPC.SERVICE_HOST, TestGRPCServer.HOST);
        response.assertAttributeEquals(InvokeGRPC.SERVICE_PORT, String.valueOf(port));

        final List<MockFlowFile> successFiles = runner.getFlowFilesForRelationship(InvokeGRPC.REL_SUCCESS_REQ);
        assertThat(successFiles.size(), equalTo(1));
        final MockFlowFile successFile = successFiles.get(0);
        successFile.assertAttributeEquals(InvokeGRPC.RESPONSE_CODE, String.valueOf(FlowFileReply.ResponseCode.SUCCESS));
        successFile.assertAttributeEquals(InvokeGRPC.RESPONSE_BODY, "success");
        successFile.assertAttributeEquals(InvokeGRPC.SERVICE_HOST, TestGRPCServer.HOST);
        successFile.assertAttributeEquals(InvokeGRPC.SERVICE_PORT, String.valueOf(port));
    } finally {
        server.stop();
    }
}
 
Example 15
Source File: SpringController.java    From DisCal-Discord-Bot with GNU Lesser General Public License v3.0 4 votes vote down vote up
@RequestMapping("/dashboard/guild")
public String dashboardGuild(Map<String, Object> model, HttpServletRequest req) {
	model.clear();
	model.putAll(DiscordAccountHandler.getHandler().getAccount(req));
	return "dashboard/guild";
}
 
Example 16
Source File: CommonBeans.java    From circus-train with Apache License 2.0 4 votes vote down vote up
private void putConfigurationProperties(Map<String, String> configurationProperties, Map<String, String> properties) {
  if (configurationProperties != null) {
    properties.putAll(configurationProperties);
  }
}
 
Example 17
Source File: ComBirtReportJobWorker.java    From openemm with GNU Affero General Public License v3.0 4 votes vote down vote up
protected void sendReports(final List<ComBirtReport> reportsForSend, final boolean sendAsWorkflowTriggeredReport) {
	if (reportsForSend != null && !reportsForSend.isEmpty()) {
		for (ComBirtReport report : reportsForSend) {
			if (logger.isDebugEnabled()) {
				logger.debug(String.format("Processing report '%s' (ID %d)", report.getShortname(), report.getId()));
			}

			try {
		        final BirtStatisticsService birtStatisticsService = serviceLookupFactory.getBeanBirtStatisticsService();
				final ComCompanyDao companyDao = daoLookupFactory.getBeanCompanyDao();
				
				final int companyID = report.getCompanyID();
				final Integer accountId = companyDao.getCompany(companyID).getId();
				final Map<String, String> urlsMap = new HashMap<>();
				final List<ComBirtReportSettings> reportSettings = report.getSettings();

				if (sendAsWorkflowTriggeredReport || !report.isTriggeredByMailing()) {
					// time-triggered report (daily, weekly etc.)
					urlsMap.putAll(birtStatisticsService.getReportStatisticsUrlMap(reportSettings, new Date(), report, companyID, accountId));
					startReportExecution(birtStatisticsService, report, urlsMap);
				} else {
					// mailing-triggered report (After mailing dispatch option)
					// even if we have several mailing ids - we need to send each report separately as the report is triggered
					// by mailing sending, so the user will be confused if he gets reports for several mailings in one report-email
					ComBirtReportMailingSettings mailingSettings = report.getReportMailingSettings();
					final List<Integer> mailingsIdsToSend = mailingSettings.getMailingsIdsToSend();
					for (Integer mailingId : mailingsIdsToSend) {
						mailingSettings.setMailingsToSend(Collections.singletonList(mailingId));
						urlsMap.putAll(birtStatisticsService.getReportStatisticsUrlMap(Collections.singletonList(mailingSettings), new Date(), report, companyID, accountId));
						startReportExecution(birtStatisticsService, report, urlsMap);
					}

					// Restore previously separated list of mailing IDs
					mailingSettings.setMailingsToSend(mailingsIdsToSend);
				}
			} catch (Exception e) {
				logger.error("Error processing report ID: " + report.getId() + ": " + e.getMessage(), e);
			}
		}
	}
}
 
Example 18
Source File: ConnectionUrl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Fixes the host information by moving data around and filling in missing data.
 * Applies properties transformations to the collected properties if {@link ConnectionPropertiesTransform} was declared in the connection arguments.
 * 
 * @param hi
 *            the host information data to fix
 * @return a new {@link HostInfo} with all required data
 */
protected HostInfo fixHostInfo(HostInfo hi) {
    Map<String, String> hostProps = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);

    hostProps.putAll(this.properties); // Add global connection arguments.
    hostProps.putAll(hi.getHostProperties()); // Add/override host specific connection arguments.
    hostProps.put(PropertyDefinitions.DBNAME_PROPERTY_KEY, getDatabase()); // Add the database name

    hostProps = preprocessPerTypeHostProperties(hostProps);

    String host = hostProps.remove(PropertyDefinitions.HOST_PROPERTY_KEY);
    if (!isNullOrEmpty(hi.getHost())) {
        host = hi.getHost();
    } else if (isNullOrEmpty(host)) {
        host = getDefaultHost();
    }

    String portAsString = hostProps.remove(PropertyDefinitions.PORT_PROPERTY_KEY);
    int port = hi.getPort();
    if (port == -1 && !isNullOrEmpty(portAsString)) {
        try {
            port = Integer.valueOf(portAsString);
        } catch (NumberFormatException e) {
            throw ExceptionFactory.createException(WrongArgumentException.class,
                    Messages.getString("ConnectionString.7", new Object[] { hostProps.get(PropertyDefinitions.PORT_PROPERTY_KEY) }), e);
        }
    }
    if (port == -1) {
        port = getDefaultPort();
    }

    String user = hostProps.remove(PropertyDefinitions.PNAME_user);
    if (!isNullOrEmpty(hi.getUser())) {
        user = hi.getUser();
    } else if (isNullOrEmpty(user)) {
        user = getDefaultUser();
    }

    boolean isPasswordless = hi.isPasswordless();
    String password = hostProps.remove(PropertyDefinitions.PNAME_password);
    if (!isPasswordless) {
        password = hi.getPassword();
    } else if (password == null) {
        password = getDefaultPassword();
        isPasswordless = true;
    } else {
        isPasswordless = false;
    }

    expandPropertiesFromConfigFiles(hostProps);
    fixKeysCase(hostProps);
    fixProtocolDependencies(hostProps);

    return buildHostInfo(host, port, user, password, isPasswordless, hostProps);
}
 
Example 19
Source File: SelfRegisterApi.java    From carbon-identity-framework with Apache License 2.0 4 votes vote down vote up
/**
 * This API is used to user self registration.
 *
 * @param user It can be sent optional property parameters over email based on email template. (required)
 * @return String
 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
 */
public String mePostCall(SelfUserRegistrationRequest user, Map<String, String> headers) throws ApiException {
    Object localVarPostBody = user;

    // verify the required parameter 'user' is set
    if (user == null) {
        throw new ApiException(400, "Missing the required parameter 'user' when calling mePost");
    }

    String tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
    if (StringUtils.isNotBlank(user.getUser().getTenantDomain())) {
        tenantDomain = user.getUser().getTenantDomain();
    }

    basePath = IdentityManagementEndpointUtil
            .getBasePath(tenantDomain, IdentityManagementEndpointConstants.UserInfoRecovery.USER_API_RELATIVE_PATH);
    apiClient.setBasePath(basePath);

    // create path and map variables
    String localVarPath = "/me".replaceAll("\\{format\\}", "json");

    List<Pair> localVarQueryParams = new ArrayList<Pair>();

    Map<String, String> localVarHeaderParams = new HashMap<>();

    if (headers != null) {
        localVarHeaderParams.putAll(headers);
    }

    Map<String, Object> localVarFormParams = new HashMap<String, Object>();

    final String[] localVarAccepts = {
            "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
    if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

    final String[] localVarContentTypes = {
            "application/json"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
    localVarHeaderParams.put("Content-Type", localVarContentType);

    String[] localVarAuthNames = new String[]{};

    GenericType<String> localVarReturnType = new GenericType<String>() {
    };

    return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);

}
 
Example 20
Source File: ReferenceData.java    From Strata with Apache License 2.0 3 votes vote down vote up
/**
 * Obtains an instance from a map of reference data.
 * <p>
 * Each entry in the map is a single piece of reference data, keyed by the matching identifier.
 * For example, a {@link HolidayCalendar} can be looked up using a {@link HolidayCalendarId}.
 * The caller must ensure that the each entry in the map corresponds with the parameterized
 * type on the identifier.
 * <p>
 * The resulting {@code ReferenceData} instance will include the {@linkplain #minimal() minimal}
 * set of reference data that includes non-controversial identifiers that are essential for pricing.
 * To exclude the minimal set of identifiers, use {@link ImmutableReferenceData#of(Map)}.
 *
 * @param values  the reference data values
 * @return the reference data instance containing the values in the map
 * @throws ClassCastException if a value does not match the parameterized type associated with the identifier
 */
public static ReferenceData of(Map<? extends ReferenceDataId<?>, ?> values) {
  // hash map so that keys can overlap, with this instance taking priority
  Map<ReferenceDataId<?>, Object> combined = new HashMap<>();
  combined.putAll(StandardReferenceData.MINIMAL.getValues());
  combined.putAll(values);
  return ImmutableReferenceData.of(combined);
}