Java 类com.beust.jcommander.internal.Maps 实例源码

项目:ttc2017smartGrids    文件:FuzzyMap.java   
private static <V> V findAbbreviatedValue(Map<? extends IKey, V> map, IKey name,
    boolean caseSensitive) {
  String string = name.getName();
  Map<String, V> results = Maps.newHashMap();
  for (IKey c : map.keySet()) {
    String n = c.getName();
    boolean match = (caseSensitive && n.startsWith(string))
        || ((! caseSensitive) && n.toLowerCase().startsWith(string.toLowerCase()));
    if (match) {
      results.put(n, map.get(c));
    }
  }

  V result;
  if (results.size() > 1) {
    throw new ParameterException("Ambiguous option: " + name
        + " matches " + results.keySet());
  } else if (results.size() == 1) {
    result = results.values().iterator().next();
  } else {
    result = null;
  }

  return result;
}
项目:ttc2017smartGrids    文件:FuzzyMap.java   
private static <V> V findAbbreviatedValue(Map<? extends IKey, V> map, IKey name,
    boolean caseSensitive) {
  String string = name.getName();
  Map<String, V> results = Maps.newHashMap();
  for (IKey c : map.keySet()) {
    String n = c.getName();
    boolean match = (caseSensitive && n.startsWith(string))
        || ((! caseSensitive) && n.toLowerCase().startsWith(string.toLowerCase()));
    if (match) {
      results.put(n, map.get(c));
    }
  }

  V result;
  if (results.size() > 1) {
    throw new ParameterException("Ambiguous option: " + name
        + " matches " + results.keySet());
  } else if (results.size() == 1) {
    result = results.values().iterator().next();
  } else {
    result = null;
  }

  return result;
}
项目:wish-pay    文件:ZxingUtils.java   
/**
 * 将内容contents生成长为width,宽为width的图片,图片路径由imgPath指定
 */
public static File getQRCodeImge(String contents, int width, int height, String imgPath) {
    try {
        Map<EncodeHintType, Object> hints = Maps.newHashMap();
        hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M);
        hints.put(EncodeHintType.CHARACTER_SET, "UTF8");

        BitMatrix bitMatrix = new MultiFormatWriter().encode(contents, BarcodeFormat.QR_CODE, width, height, hints);

        File imageFile = new File(imgPath);
        writeToFile(bitMatrix, "png", imageFile);

        return imageFile;

    } catch (Exception e) {
        log.error("create QR code error!", e);
        return null;
    }
}
项目:wish-pay    文件:ZxingUtils.java   
/**
 * 将内容contents生成长为width,宽为width的图片,返回刘文静
 */
public static ServletOutputStream getQRCodeImge(String contents, int width, int height) throws IOException {
    ServletOutputStream stream = null;
    try {
        Map<EncodeHintType, Object> hints = Maps.newHashMap();
        hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M);
        hints.put(EncodeHintType.CHARACTER_SET, "UTF8");
        BitMatrix bitMatrix = new MultiFormatWriter().encode(contents, BarcodeFormat.QR_CODE, width, height, hints);
        MatrixToImageWriter.writeToStream(bitMatrix, "png", stream);
        return stream;
    } catch (Exception e) {
        log.error("create QR code error!", e);
        return null;
    } finally {
        if (stream != null) {
            stream.close();
        }
    }
}
项目:wish-pay    文件:AliPayUtil.java   
/**
 * 获取阿里支付链接的所有参数列表
 *
 * @param request
 * @return
 */
public static Map<String, String> getAlipayNotify(HttpServletRequest request) {
    Map<String, String> params = Maps.newHashMap();
    Map requestParams = request.getParameterMap();
    for (Iterator<String> iter = requestParams.keySet().iterator(); iter.hasNext(); ) {
        String name = iter.next();
        String[] values = (String[]) requestParams.get(name);
        String valueStr = "";
        for (int i = 0; i < values.length; i++) {
            valueStr = (i == values.length - 1) ? valueStr + values[i]
                    : valueStr + values[i] + ",";
        }
        //乱码解决,这段代码在出现乱码时使用。如果mysign和sign不相等也可以使用这段代码转化
        //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "gbk");
        params.put(name, valueStr);
    }
    return params;
}
项目:muJava    文件:FuzzyMap.java   
private static <V> V findAbbreviatedValue(Map<? extends IKey, V> map, IKey name,
    boolean caseSensitive) {
  String string = name.getName();
  Map<String, V> results = Maps.newHashMap();
  for (IKey c : map.keySet()) {
    String n = c.getName();
    boolean match = (caseSensitive && n.startsWith(string))
        || ((! caseSensitive) && n.toLowerCase().startsWith(string.toLowerCase()));
    if (match) {
      results.put(n, map.get(c));
    }
  }

  V result;
  if (results.size() > 1) {
    throw new ParameterException("Ambiguous option: " + name
        + " matches " + results.keySet());
  } else if (results.size() == 1) {
    result = results.values().iterator().next();
  } else {
    result = null;
  }

  return result;
}
项目:VarJ    文件:FuzzyMap.java   
private static <V> V findAbbreviatedValue(Map<? extends IKey, V> map, IKey name,
    boolean caseSensitive) {
  String string = name.getName();
  Map<String, V> results = Maps.newHashMap();
  for (IKey c : map.keySet()) {
    String n = c.getName();
    boolean match = (caseSensitive && n.startsWith(string))
        || ((! caseSensitive) && n.toLowerCase().startsWith(string.toLowerCase()));
    if (match) {
      results.put(n, map.get(c));
    }
  }

  V result;
  if (results.size() > 1) {
    throw new ParameterException("Ambiguous option: " + name
        + " matches " + results.keySet());
  } else if (results.size() == 1) {
    result = results.values().iterator().next();
  } else {
    result = null;
  }

  return result;
}
项目:goja    文件:SequenceFieldKeySorter.java   
@Override
public Map sort(Class type, Map keyedByFieldKey) {
    Annotation sequence = type.getAnnotation(XMLSequence.class);
    if (sequence != null) {
        final String[] fieldsOrder = ((XMLSequence) sequence).value();
        Map<Object, Object> result = Maps.newLinkedHashMap();
        Set<Map.Entry<FieldKey, Field>> fields = keyedByFieldKey.entrySet();
        for (String fieldName : fieldsOrder) {
            if (fieldName != null) {
                for (Map.Entry<FieldKey, Field> fieldEntry : fields) {
                    if (fieldName.equals(fieldEntry.getKey().getFieldName())) {
                        result.put(fieldEntry.getKey(), fieldEntry.getValue());
                    }
                }
            }
        }
        return result;
    } else {
        return keyedByFieldKey;
    }

}
项目:monasca-thresh    文件:AlarmSqlImplTest.java   
@Test(groups = "orm")
public void checkComplexMetrics() {
  final Alarm newAlarm = new Alarm(alarmDef, AlarmState.ALARM);

  for (final String hostname : Arrays.asList("vivi", "eleanore")) {
    for (final String metricName : Arrays.asList("cpu", "load")) {
      final Map<String, String> dimensions = Maps.newHashMap();
      dimensions.put("first", "first_value");
      dimensions.put("second", "second_value");
      dimensions.put("hostname", hostname);
      final MetricDefinition md = new MetricDefinition(metricName, dimensions);
      newAlarm.addAlarmedMetric(new MetricDefinitionAndTenantId(md, TENANT_ID));
    }
  }
  dao.createAlarm(newAlarm);

  final Alarm found = dao.findById(newAlarm.getId());
  // Have to check both ways because there was a bug in AlarmDAOImpl and it showed up if both
  // ways were tested
  assertTrue(newAlarm.equals(found));
  assertTrue(found.equals(newAlarm));
}
项目:Corporatique    文件:FuzzyMap.java   
private static <V> V findAbbreviatedValue(Map<? extends IKey, V> map, IKey name,
                                          boolean caseSensitive) {
    String string = name.getName();
    Map<String, V> results = Maps.newHashMap();
    for (IKey c : map.keySet()) {
        String n = c.getName();
        boolean match = (caseSensitive && n.startsWith(string))
                || ((!caseSensitive) && n.toLowerCase().startsWith(string.toLowerCase()));
        if (match) {
            results.put(n, map.get(c));
        }
    }

    V result;
    if (results.size() > 1) {
        throw new ParameterException("Ambiguous option: " + name
                + " matches " + results.keySet());
    } else if (results.size() == 1) {
        result = results.values().iterator().next();
    } else {
        result = null;
    }

    return result;
}
项目:rest4j    文件:TestRest4JCallback.java   
@Test
public void testFilterResponseContextAdapter()
{
  DataMap dataMap = new DataMap();
  dataMap.put("foo", "bar");
  Map<String, String> headers = Maps.newHashMap();
  headers.put("x", "y");
  RecordTemplate entity = new Foo(dataMap);
  PartialRestResponse partialResponse =
      new PartialRestResponse.Builder().status(HttpStatus.S_200_OK).headers(headers).entity(entity).build();
  FilterResponseContext context = new Rest4JCallback.FilterResponseContextAdapter(partialResponse);
  assertEquals(headers, context.getResponseHeaders());
  assertEquals(entity, context.getResponseEntity());
  assertEquals(HttpStatus.S_200_OK, context.getHttpStatus());

  context.setHttpStatus(HttpStatus.S_404_NOT_FOUND);
  context.setResponseEntity(null);
  assertNull(context.getResponseEntity());
  assertEquals(HttpStatus.S_404_NOT_FOUND, context.getHttpStatus());
}
项目:java_seqbuster    文件:FuzzyMap.java   
private static <V> V findAbbreviatedValue(Map<? extends IKey, V> map, IKey name,
    boolean caseSensitive) {
  String string = name.getName();
  Map<String, V> results = Maps.newHashMap();
  for (IKey c : map.keySet()) {
    String n = c.getName();
    boolean match = (caseSensitive && n.startsWith(string))
        || ((! caseSensitive) && n.toLowerCase().startsWith(string.toLowerCase()));
    if (match) {
      results.put(n, map.get(c));
    }
  }

  V result;
  if (results.size() > 1) {
    throw new ParameterException("Ambiguous option: " + name
        + " matches " + results.keySet());
  } else if (results.size() == 1) {
    result = results.values().iterator().next();
  } else {
    result = null;
  }

  return result;
}
项目:java_seqbuster    文件:FuzzyMap.java   
private static <V> V findAbbreviatedValue(Map<? extends IKey, V> map, IKey name,
    boolean caseSensitive) {
  String string = name.getName();
  Map<String, V> results = Maps.newHashMap();
  for (IKey c : map.keySet()) {
    String n = c.getName();
    boolean match = (caseSensitive && n.startsWith(string))
        || ((! caseSensitive) && n.toLowerCase().startsWith(string.toLowerCase()));
    if (match) {
      results.put(n, map.get(c));
    }
  }

  V result;
  if (results.size() > 1) {
    throw new ParameterException("Ambiguous option: " + name
        + " matches " + results.keySet());
  } else if (results.size() == 1) {
    result = results.values().iterator().next();
  } else {
    result = null;
  }

  return result;
}
项目:java_seqbuster    文件:FuzzyMap.java   
private static <V> V findAbbreviatedValue(Map<? extends IKey, V> map, IKey name,
    boolean caseSensitive) {
  String string = name.getName();
  Map<String, V> results = Maps.newHashMap();
  for (IKey c : map.keySet()) {
    String n = c.getName();
    boolean match = (caseSensitive && n.startsWith(string))
        || ((! caseSensitive) && n.toLowerCase().startsWith(string.toLowerCase()));
    if (match) {
      results.put(n, map.get(c));
    }
  }

  V result;
  if (results.size() > 1) {
    throw new ParameterException("Ambiguous option: " + name
        + " matches " + results.keySet());
  } else if (results.size() == 1) {
    result = results.values().iterator().next();
  } else {
    result = null;
  }

  return result;
}
项目:reactive-source    文件:PsqlEventMapperTest.java   
@Test(groups = SMALL)
public void tesParsingCorrectPayloadReturnsCorrectEventObject() {
    Map<String, Object> expectedNewEntity = Maps.newHashMap();
    expectedNewEntity.put("id", 1);
    expectedNewEntity.put("value", "def");

    Map<String, Object> expectedOldEntity = Maps.newHashMap();
    expectedOldEntity.put("id", 1);
    expectedOldEntity.put("value", "abc");

    Event<Map<String, Object>> event = mapper.parseResponse(JSON_CORRECT_RESPONSE);
    assertEquals(event.getEventType(), Event.UPDATE_TYPE);
    assertEquals(event.getEntityName(), "test");
    assertEquals(event.getNewEntity(), expectedNewEntity);
    assertEquals(event.getOldEntity(), expectedOldEntity);

}
项目:shimmer    文件:JawbonePhysicalActivityDataPointMapperUnitTests.java   
@Test
public void asDataPointsShouldReturnCorrectMissingSensedDataPoints() {

    List<DataPoint<PhysicalActivity>> dataPoints = mapper.asDataPoints(singletonList(responseNode));

    PhysicalActivity expectedPhysicalActivity = new PhysicalActivity.Builder("Bike")
            .setDistance(new LengthUnitValue(METER, 6318.2688961))
            .setEffectiveTimeFrame(
                    TimeInterval.ofEndDateTimeAndDuration(OffsetDateTime.parse("2015-04-29T16:07:07-04:00"),
                            new DurationUnitValue(SECOND, 343)))
            .setCaloriesBurned(new KcalUnitValue(KILOCALORIE, 27.16863765916))
            .build();

    assertThat(dataPoints.get(1).getBody(), equalTo(expectedPhysicalActivity));

    DataPointHeader testDataPointHeader = dataPoints.get(1).getHeader();
    Map<String, Object> testProperties = Maps.newHashMap();
    testProperties.put(HEADER_EXTERNAL_ID_KEY, "SbiOBJjJJk8n2xLpNTMFng12pGRjX-qe");
    testProperties.put(HEADER_SOURCE_UPDATE_KEY, "2015-04-29T20:07:56Z");
    testProperties.put(HEADER_SCHEMA_ID_KEY, PhysicalActivity.SCHEMA_ID);
    testDataPointHeader(testDataPointHeader, testProperties);
}
项目:lens    文件:TestHiveDriver.java   
@Test(expectedExceptions = {UnsupportedOperationException.class})
public void testEstimateOlapQuery() throws Exception {
  SessionState.setCurrentSessionState(ss);
  ExplainQueryContext ctx = createExplainContext("cube SELECT ID FROM test_cube", queryConf);
  ctx.setOlapQuery(true);
  ctx.getDriverContext().setDriverRewriterPlan(driver, new DriverQueryPlan() {
    @Override
    public String getPlan() {
      return null;
    }

    @Override
    public QueryCost getCost() {
      return null;
    }

    @Override
    public Map<String, Set<?>> getPartitions() {
      return Maps.newHashMap();
    }
  });
  QueryCost cost = driver.estimate(ctx);
  assertEquals(cost.getEstimatedResourceUsage(), 0.0);
  cost.getEstimatedExecTimeMillis();
}
项目:monasca-common    文件:AlarmExpressionTest.java   
public void shouldParseDeterministicExpression() {
  final Map<String, String> dimensions = Maps.newHashMap();
  final ArrayList<AlarmExpression> expressions = Lists.newArrayList(
      new AlarmExpression("count(log.error{},deterministic,20) > 5")
  );
  final MetricDefinition metricDefinition = new MetricDefinition("log.error", dimensions);

  final AlarmSubExpression logErrorExpr = new AlarmSubExpression(
      AggregateFunction.COUNT,
      metricDefinition,
      AlarmOperator.GT,
      5,
      20,
      1,
      true // each expression is deterministic
  );

  for (final AlarmExpression expr : expressions) {
    final List<AlarmSubExpression> subExpressions = expr.getSubExpressions();

    assertTrue(expr.isDeterministic());  // each expression is deterministic
    assertEquals(1, subExpressions.size());
    assertEquals(subExpressions.get(0), logErrorExpr);
  }
}
项目:lsql    文件:ObjectToJsonStringConverterTest.java   
@Test
public void listOfMapStringString() {
    createTable("CREATE TABLE table1 (id INT PRIMARY KEY, data TEXT)");
    this.addConfigHook(c ->
            c.setConverter("table1", "data", new ObjectToJsonStringConverter(List.class, new TypeReference<List<Map<String, String>>>() {
            })));


    Table t1 = lSql.table("table1");

    List<Map<String, String>> list = Lists.newLinkedList();
    Map<String, String> e = Maps.newHashMap();
    e.put("a", "1");
    e.put("b", "2");
    list.add(e);
    list.add(e);

    t1.insert(Row.fromKeyVals("id", 1, "data", list));
    Row row = t1.load(1).get();
    assertEquals(row.get("data"), list);
}
项目:lsql    文件:ObjectToJsonStringConverterTest.java   
@Test
public void listOfMapStringStringInALinkedRow() {
    createTable("CREATE TABLE table1 (id SERIAL PRIMARY KEY, data TEXT)");
    this.addConfigHook(c ->
            c.setConverter(
                    "table1",
                    "data",
                    new ObjectToJsonStringConverter(List.class, new TypeReference<List<Map<String, String>>>() {
                    })));

    Table t1 = lSql.table("table1");

    List<Map<String, String>> list = Lists.newLinkedList();
    Map<String, String> e = Maps.newHashMap();
    e.put("a", "1");
    e.put("b", "2");
    list.add(e);
    list.add(e);
    t1.newLinkedRow("id", 1, "data", list).save();

    Row row = t1.load(1).get();
    assertEquals(row.get("data"), list);
}
项目:sparc    文件:FuzzyMap.java   
private static <V> V findAbbreviatedValue(Map<? extends IKey, V> map, IKey name,
    boolean caseSensitive) {
  String string = name.getName();
  Map<String, V> results = Maps.newHashMap();
  for (IKey c : map.keySet()) {
    String n = c.getName();
    boolean match = (caseSensitive && n.startsWith(string))
        || ((! caseSensitive) && n.toLowerCase().startsWith(string.toLowerCase()));
    if (match) {
      results.put(n, map.get(c));
    }
  }

  V result;
  if (results.size() > 1) {
    throw new ParameterException("Ambiguous option: " + name
        + " matches " + results.keySet());
  } else if (results.size() == 1) {
    result = results.values().iterator().next();
  } else {
    result = null;
  }

  return result;
}
项目:basking    文件:WriteCacheFileTask.java   
/**
 * Returns a new line processor for the cache file. The processor generates map of song IDs to
 * file names.
 */
static LineProcessor<Map<Integer, String>> newCacheFileLineProcessor() {
    return new LineProcessor<Map<Integer, String>>() {

        @SuppressWarnings("CanBeFinal")
        Map<Integer, String> map = Maps.newHashMap();

        @Override
        public boolean processLine(String line) throws IOException {
            String[] split = line.split("\\|");
            map.put(Integer.valueOf(split[0]), split[1]);
            return true;
        }

        @Override
        public Map<Integer, String> getResult() {
            return map;
        }
    };
}
项目:ttc2017smartGrids    文件:JCommander.java   
/**
 * Create the ParameterDescriptions for all the \@Parameter found.
 */
private void createDescriptions() {
    descriptions = Maps.newHashMap();

    for (Object object : objects) {
        addDescription(object);
    }
}
项目:ttc2017smartGrids    文件:JCommander.java   
public Map<String, JCommander> getCommands() {
    Map<String, JCommander> res = Maps.newLinkedHashMap();
    for (Map.Entry<ProgramName, JCommander> entry : commands.entrySet()) {
        res.put(entry.getKey().name, entry.getValue());
    }
    return res;
}
项目:ttc2017smartGrids    文件:JCommander.java   
/**
 * Create the ParameterDescriptions for all the \@Parameter found.
 */
private void createDescriptions() {
    descriptions = Maps.newHashMap();

    for (Object object : objects) {
        addDescription(object);
    }
}
项目:ttc2017smartGrids    文件:JCommander.java   
public Map<String, JCommander> getCommands() {
    Map<String, JCommander> res = Maps.newLinkedHashMap();
    for (Map.Entry<ProgramName, JCommander> entry : commands.entrySet()) {
        res.put(entry.getKey().name, entry.getValue());
    }
    return res;
}
项目:aliyun-maxcompute-data-collectors    文件:BadOperateWriter.java   
public static void write(Op op, String oracleFullTableName, String topicName, String fileName,
    int maxFileSize, String msg) {
    checkFileSize(fileName, maxFileSize);

    DirtyRecordInfo dirtyRecordInfo = new DirtyRecordInfo();
    dirtyRecordInfo.setOracleTable(oracleFullTableName);
    dirtyRecordInfo.setTopicName(topicName);
    dirtyRecordInfo.setShardId(null);
    dirtyRecordInfo.setErrorMessage(msg);

    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    dirtyRecordInfo.setErrorTime(simpleDateFormat.format(new Date()));

    Map<String, String> record = Maps.newHashMap();
    dirtyRecordInfo.setRecord(record);

    List<DsColumn> cols = op.getColumns();
    for (int i = 0; i < cols.size(); i++) {
        String colName = op.getTableMeta().getColumnName(i).toLowerCase();
        record.put(colName, cols.get(i).getAfterValue());
    }
    try {
        BufferedWriter bw = new BufferedWriter(new FileWriter(fileName, true));
        bw.write(JsonHelper.beanToJson(dirtyRecordInfo) + "\n");
        bw.close();
    } catch (IOException e) {
        logger.error("logBadOperation() failed. ", e);
        throw new RuntimeException("logBadOperation() failed. ", e);
    }
}
项目:aliyun-maxcompute-data-collectors    文件:BadOperateWriter.java   
public static void write(RecordEntry recordEntry, String oracleFullTableName, String topicName,
    String fileName, int maxFileSize, String msg) {
    checkFileSize(fileName, maxFileSize);

    DirtyRecordInfo dirtyRecordInfo = new DirtyRecordInfo();
    dirtyRecordInfo.setOracleTable(oracleFullTableName);
    dirtyRecordInfo.setTopicName(topicName);
    dirtyRecordInfo.setShardId(recordEntry.getShardId());
    dirtyRecordInfo.setErrorMessage(msg);

    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    dirtyRecordInfo.setErrorTime(simpleDateFormat.format(new Date()));

    Map<String, String> record = Maps.newHashMap();
    dirtyRecordInfo.setRecord(record);

    Field[] fields = recordEntry.getFields();
    JsonNode jsonNode = recordEntry.toJsonNode();
    ArrayNode arrayNode = (ArrayNode) jsonNode.get("Data");

    for (int i = 0; i < recordEntry.getFieldCount(); i++) {
        record.put(fields[i].getName(), arrayNode.get(i).getTextValue());
    }

    try {
        BufferedWriter bw = new BufferedWriter(new FileWriter(fileName, true));
        bw.write(JsonHelper.beanToJson(dirtyRecordInfo) + "\n");
        bw.close();
    } catch (IOException e) {
        logger.error("logBadOperation() failed. ", e);
        throw new RuntimeException("logBadOperation() failed. ", e);
    }
}
项目:yql-plus    文件:CompilingTestBase.java   
public void init(Module... modules) {
    if(modules == null) {
        modules = new Module[0];
    }
    this.metricModule = new JavaTestModule.MetricModule();
    injector = Guice.createInjector(Iterables.concat(ImmutableList.<Module>of(new CompilingTestModule()), Arrays.asList(modules)));
    source = injector.getInstance(ASMClassSource.class);
    scope = new GambitSource(source);
    this.modules = Maps.newLinkedHashMap();
    this.views = Maps.newHashMap();
    this.sources = Maps.newLinkedHashMap();
}
项目:cerberus-lifecycle-cli    文件:CreateBaseOperation.java   
private Map<Integer, String> mapAvailabilityZones() {
    List<String> zones = ec2Service.getAvailabilityZones();

    if (zones.size() < MINIMUM_AZS) {
        throw new IllegalStateException("Not enough availability zones for the selected region.");
    }

    Map<Integer, String> azByIdentifier = Maps.newHashMap();

    for (int i = 1; i <= MINIMUM_AZS; i++) {
        azByIdentifier.put(i, zones.get(i - 1));
    }

    return azByIdentifier;
}
项目:cerberus-lifecycle-cli    文件:CloudFormationService.java   
/**
 * Returns the current status of the named stack.
 *
 * @param stackId Stack name.
 * @return Stack outputs data.
 */
public Map<String, String> getStackParameters(final String stackId) {
    final DescribeStacksRequest request = new DescribeStacksRequest().withStackName(stackId);
    final DescribeStacksResult result = cloudFormationClient.describeStacks(request);
    final Map<String, String> parameters = Maps.newHashMap();

    if (result.getStacks().size() > 0) {
        parameters.putAll(result.getStacks().get(0).getParameters().stream().collect(
                Collectors.toMap(Parameter::getParameterKey, Parameter::getParameterValue)));

    }

    return parameters;
}
项目:cerberus-lifecycle-cli    文件:CloudFormationService.java   
/**
 * Returns the current status of the named stack.
 *
 * @param stackId Stack name.
 * @return Stack outputs data.
 */
public Map<String, String> getStackOutputs(final String stackId) {
    final DescribeStacksRequest request = new DescribeStacksRequest().withStackName(stackId);
    final DescribeStacksResult result = cloudFormationClient.describeStacks(request);
    final Map<String, String> outputs = Maps.newHashMap();

    if (result.getStacks().size() > 0) {
        outputs.putAll(result.getStacks().get(0).getOutputs().stream().collect(
                Collectors.toMap(Output::getOutputKey, Output::getOutputValue)));

    }

    return outputs;
}
项目:muJava    文件:JCommander.java   
/**
 * Create the ParameterDescriptions for all the \@Parameter found.
 */
private void createDescriptions() {
  m_descriptions = Maps.newHashMap();

  for (Object object : m_objects) {
    addDescription(object);
  }
}
项目:muJava    文件:JCommander.java   
public Map<String, JCommander> getCommands() {
  Map<String, JCommander> res = Maps.newLinkedHashMap();
  for (Map.Entry<ProgramName, JCommander> entry : m_commands.entrySet()) {
    res.put(entry.getKey().m_name, entry.getValue());
  }
  return res;
}
项目:jira-dvcs-connector    文件:LimitsClient.java   
private static Map<String, Integer> asHashMap(Map<String, Integer> map)
{
    Map<String, Integer> hash = Maps.newHashMap();
    hash.putAll(map);

    return hash;
}
项目:textokit-core    文件:GeneratePipelineDescriptorForOpenNLPPosTagger.java   
public static AnalysisEngineDescription getDescription() throws UIMAException, IOException {
    Map<String, MetaDataObject> aeDescriptions = Maps.newLinkedHashMap();
    aeDescriptions.put("tokenizer", TokenizerAPI.getAEImport());
    aeDescriptions.put("sentenceSplitter", SentenceSplitterAPI.getAEImport());
    Import posTaggerDescImport = new Import_impl();
    posTaggerDescImport.setName("com.textocat.textokit.postagger.postagger-ae");
    aeDescriptions.put("pos-tagger", posTaggerDescImport);
    //
    return PipelineDescriptorUtils.createAggregateDescription(
            ImmutableList.copyOf(aeDescriptions.values()),
            ImmutableList.copyOf(aeDescriptions.keySet()));
}
项目:VarJ    文件:JCommander.java   
/**
 * Create the ParameterDescriptions for all the \@Parameter found.
 */
private void createDescriptions() {
  m_descriptions = Maps.newHashMap();

  for (Object object : m_objects) {
    addDescription(object);
  }
}
项目:VarJ    文件:JCommander.java   
public Map<String, JCommander> getCommands() {
  Map<String, JCommander> res = Maps.newLinkedHashMap();
  for (Map.Entry<ProgramName, JCommander> entry : m_commands.entrySet()) {
    res.put(entry.getKey().m_name, entry.getValue());
  }
  return res;
}
项目:VarJ    文件:JCommanderTest.java   
public void dynamicParameters() {
  class Command {
    @DynamicParameter(names = {"-P"}, description = "Additional command parameters")
    private Map<String, String> params = Maps.newHashMap();
  }
  JCommander commander = new JCommander();
  Command c = new Command();
  commander.addCommand("command", c);
  commander.parse(new String[] { "command", "-Pparam='name=value'" });
  Assert.assertEquals(c.params.get("param"), "'name=value'");
}
项目:Pushjet-Android    文件:SonarRunner.java   
/**
 * The String key/value pairs to be passed to the Sonar Runner.
 *
 * {@code null} values are not permitted.
 */
@Input
public Map<String, Object> getSonarProperties() {
    if (sonarProperties == null) {
        sonarProperties = Maps.newLinkedHashMap();
    }

    return sonarProperties;
}