Java Code Examples for com.amazonaws.util.ImmutableMapParameter#Builder

The following examples show how to use com.amazonaws.util.ImmutableMapParameter#Builder . 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: V1ItemFactory.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
@Override
protected Map<String, AttributeValue> asItem(TinyBean b) {
    ImmutableMapParameter.Builder<String, AttributeValue> builder = ImmutableMapParameter.builder();

    builder.put("stringAttr", av(b.getStringAttr()));

    return builder.build();
}
 
Example 2
Source File: V1ItemFactory.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
@Override
protected Map<String, AttributeValue> asItem(HugeBean b) {
    ImmutableMapParameter.Builder<String, AttributeValue> builder = ImmutableMapParameter.builder();

    builder.put("hashKey", av(b.getHashKey()));
    builder.put("stringAttr", av(b.getStringAttr()));
    builder.put("binaryAttr", av(b.getBinaryAttr()));

    List<AttributeValue> listAttr = b.getListAttr().stream().map(this::av).collect(Collectors.toList());

    builder.put("listAttr", av(listAttr));

    Map<String, AttributeValue> mapAttr1 = b.getMapAttr1().entrySet().stream().collect(
            Collectors.toMap(Map.Entry::getKey,
                e -> av(e.getValue())));

    builder.put("mapAttr1", av(mapAttr1));


    Map<String, AttributeValue> mapAttr2 = b.getMapAttr2().entrySet().stream().collect(
            Collectors.toMap(Map.Entry::getKey,
                e -> av(e.getValue().stream().map(this::av).collect(Collectors.toList()))));

    builder.put("mapAttr2", av(mapAttr2));

    Map<String, AttributeValue> mapAttr3 = b.getMapAttr3().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey,
        e -> {
            List<Map<String, List<SdkBytes>>> value = e.getValue();
            AttributeValue valueAv = av(value.stream().map(m -> av(m.entrySet().stream()
                    .collect(Collectors.toMap(Map.Entry::getKey,
                        ee -> av(ee.getValue().stream().map(this::av).collect(Collectors.toList()))))))
                    .collect(Collectors.toList()));
            return valueAv;
        }));

    builder.put("mapAttr3", av(mapAttr3));

    return builder.build();
}
 
Example 3
Source File: V2ItemFactory.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
protected Map<String, AttributeValue> asItem(HugeBean b) {
    ImmutableMapParameter.Builder<String, AttributeValue> builder = ImmutableMapParameter.builder();

    builder.put("hashKey", av(b.getHashKey()));
    builder.put("stringAttr", av(b.getStringAttr()));
    builder.put("binaryAttr", av(b.getBinaryAttr()));

    List<AttributeValue> listAttr = b.getListAttr().stream().map(this::av).collect(Collectors.toList());

    builder.put("listAttr", av(listAttr));

    Map<String, AttributeValue> mapAttr1 = b.getMapAttr1().entrySet().stream().collect(
            Collectors.toMap(Map.Entry::getKey,
                e -> av(e.getValue())));

    builder.put("mapAttr1", av(mapAttr1));


    Map<String, AttributeValue> mapAttr2 = b.getMapAttr2().entrySet().stream().collect(
            Collectors.toMap(Map.Entry::getKey,
                e -> av(e.getValue().stream().map(this::av).collect(Collectors.toList()))));

    builder.put("mapAttr2", av(mapAttr2));

    Map<String, AttributeValue> mapAttr3 = b.getMapAttr3().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey,
        e -> {
            List<Map<String, List<SdkBytes>>> value = e.getValue();
            AttributeValue valueAv = av(value.stream().map(m -> av(m.entrySet().stream()
                    .collect(Collectors.toMap(Map.Entry::getKey,
                        ee -> av(ee.getValue().stream().map(this::av).collect(Collectors.toList()))))))
                    .collect(Collectors.toList()));
            return valueAv;
        }));

    builder.put("mapAttr3", av(mapAttr3));

    return builder.build();
}
 
Example 4
Source File: ItemFactory.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
public final HugeBean hugeBean() {
    HugeBean b = new HugeBean();
    b.setHashKey(randomS());
    b.setStringAttr(randomS());
    b.setBinaryAttr(randomBytes());
    b.setListAttr(IntStream.range(0, 32).mapToObj(i -> randomS()).collect(Collectors.toList()));

    Map<String, SdkBytes> mapAttr1 = new HashMap<>();
    mapAttr1.put("key1", randomBytes());
    mapAttr1.put("key2", randomBytes());
    mapAttr1.put("key3", randomBytes());

    b.setMapAttr1(mapAttr1);

    Map<String, List<SdkBytes>> mapAttr2 = new HashMap<>();
    mapAttr2.put("key1", Arrays.asList(randomBytes()));
    mapAttr2.put("key2", IntStream.range(0, 2).mapToObj(i -> randomBytes()).collect(Collectors.toList()));
    mapAttr2.put("key3", IntStream.range(0, 4).mapToObj(i -> randomBytes()).collect(Collectors.toList()));
    mapAttr2.put("key4", IntStream.range(0, 8).mapToObj(i -> randomBytes()).collect(Collectors.toList()));
    mapAttr2.put("key5", IntStream.range(0, 16).mapToObj(i -> randomBytes()).collect(Collectors.toList()));

    b.setMapAttr2(mapAttr2);

    ImmutableMapParameter.Builder<String, List<Map<String, List<SdkBytes>>>> mapAttr3Builder =
            ImmutableMapParameter.builder();

    List<Map<String, List<SdkBytes>>> value = Arrays.asList(
            ImmutableMapParameter.<String, List<SdkBytes>>builder()
                    .put("key1", IntStream.range(0, 2).mapToObj(i -> randomBytes()).collect(Collectors.toList()))
                    .build(),
            ImmutableMapParameter.<String, List<SdkBytes>>builder()
                    .put("key2", IntStream.range(0, 4).mapToObj(i -> randomBytes()).collect(Collectors.toList()))
                    .build(),
            ImmutableMapParameter.<String, List<SdkBytes>>builder()
                    .put("key3", IntStream.range(0, 8).mapToObj(i -> randomBytes()).collect(Collectors.toList()))
                    .build()
    );

    mapAttr3Builder.put("key1", value)
                   .put("key2", value)
                   .build();

    b.setMapAttr3(mapAttr3Builder.build());

    return b;
}
 
Example 5
Source File: V1ItemFactory.java    From aws-sdk-java-v2 with Apache License 2.0 3 votes vote down vote up
@Override
protected Map<String, AttributeValue> asItem(SmallBean b) {
    ImmutableMapParameter.Builder<String, AttributeValue> builder = ImmutableMapParameter.builder();

    builder.put("stringAttr", av(b.getStringAttr()));
    builder.put("binaryAttr", av(b.getBinaryAttr()));

    List<AttributeValue> listAttr = b.getListAttr().stream().map(this::av).collect(Collectors.toList());

    builder.put("listAttr", av(listAttr));

    return builder.build();
}
 
Example 6
Source File: V2ItemFactory.java    From aws-sdk-java-v2 with Apache License 2.0 3 votes vote down vote up
protected Map<String, AttributeValue> asItem(TinyBean b) {
    ImmutableMapParameter.Builder<String, AttributeValue> builder = ImmutableMapParameter.builder();

    builder.put("stringAttr", av(b.getStringAttr()));

    return builder.build();
}
 
Example 7
Source File: V2ItemFactory.java    From aws-sdk-java-v2 with Apache License 2.0 3 votes vote down vote up
protected Map<String, AttributeValue> asItem(SmallBean b) {
    ImmutableMapParameter.Builder<String, AttributeValue> builder = ImmutableMapParameter.builder();

    builder.put("stringAttr", av(b.getStringAttr()));
    builder.put("binaryAttr", av(b.getBinaryAttr()));

    List<AttributeValue> listAttr = b.getListAttr().stream().map(this::av).collect(Collectors.toList());

    builder.put("listAttr", av(listAttr));

    return builder.build();
}