java类com.google.common.collect.ImmutableMap的实例源码

QueryClassifierBuilder.java 文件源码 项目:url-classifier 阅读 25 收藏 0 点赞 0 评论 0
public QueryClassifierImpl(
    ImmutableSet<String> mayKeySet, Predicate<? super String> mayKeyClassifier,
    ImmutableSet<String> onceKeySet, Predicate<? super String> onceKeyClassifier,
    ImmutableSet<String> mustKeySet,
    ImmutableMap<String, Predicate<? super Optional<String>>> valueClassifierMap) {
  this.mayKeySet = mayKeySet;
  this.mayKeyClassifier = mayKeyClassifier;
  this.onceKeySet = onceKeySet;
  this.onceKeyClassifier = onceKeyClassifier;
  this.mustKeySet = mustKeySet;
  this.valueClassifierMap = valueClassifierMap;
}
GetGeonamesApplication.java 文件源码 项目:java-web-services-training 阅读 26 收藏 0 点赞 0 评论 0
public static void main(String[] args)
        throws IOException, URISyntaxException {
    RestTemplate restTemplate = new RestTemplate();
    GeonamesSearchResult searchResult = restTemplate.getForObject(
            "http://api.geonames.org/searchJSON?q={q}&username={username}",
        GeonamesSearchResult.class,
            ImmutableMap.of("q", "kabupaten garut", "username", "ceefour"));
    LOG.info("Body (GeonamesSearchResult): {}", searchResult);
    for (Geoname child : searchResult.getGeonames()) {
        LOG.info("Place: {} ({}, {})",
                child.getToponymName(), child.getLat(), child.getLng());
    }
}
EntityStore.java 文件源码 项目:iron 阅读 51 收藏 0 点赞 0 评论 0
public EntityStore(EntityDefinition<E> entityDefinition, Map<RelationDefinition, RelationStore> relationStores) {
    m_entityDefinition = entityDefinition;
    m_entityClass = entityDefinition.getEntityClass();
    m_entityName = entityDefinition.getEntityName();

    IdDefinition idDefinition = entityDefinition.getIdDefinition();
    m_idPropertyName = idDefinition != null ? idDefinition.getIdName() : null;

    m_attributes = ImmutableSet
            .copyOf(entityDefinition.getAttributes().values().stream().map(AttributeDefinition::getAttributeName).collect(Collectors.toList()));

    ImmutableMap.Builder<String, Map<Object, Long>> uniquesIndex = ImmutableMap.builder();
    entityDefinition.getUniqueConstraints().forEach(uniqueAttribute -> uniquesIndex.put(uniqueAttribute, new HashMap<>()));
    m_uniquesIndex = uniquesIndex.build();

    ImmutableSet.Builder<String> nonNullAttributes = ImmutableSet.builder();
    entityDefinition.getAttributes().values().stream() //
            .filter(attributeDefinition -> !attributeDefinition.isNullable()) //
            .forEach(attributeDefinition -> nonNullAttributes.add(attributeDefinition.getAttributeName()));
    m_nonNullAttributes = nonNullAttributes.build();

    ImmutableMap.Builder<String, RelationStore> relationStoresBuilder = ImmutableMap.builder();
    entityDefinition.getRelations().values().forEach(relationDefinition -> {
        RelationStore relationStore = relationStores.get(relationDefinition);
        relationStoresBuilder.put(relationDefinition.getRelationName(), relationStore);
    });
    m_relationStores = relationStoresBuilder.build();
}
AbstractMarketDataRequestBuilder.java 文件源码 项目:iextrading4j 阅读 16 收藏 0 点赞 0 评论 0
protected Map<String, String> getSymbols() {
    if (symbols != null) {
        return ImmutableMap.<String, String>builder()
                .put("symbols", symbols.stream().collect(joining(",")))
                .build();
    }
    return ImmutableMap.of();
}
PartialUpdateSecretRequestV2.java 文件源码 项目:secrets-proxy 阅读 16 收藏 0 点赞 0 评论 0
/**
 * Static factory method used by Jackson for deserialization
 */
@SuppressWarnings("unused")
@JsonCreator
public static PartialUpdateSecretRequestV2 fromParts(
        @JsonProperty("contentPresent") boolean contentPresent,
        @JsonProperty("content") @Nullable String content,
        @JsonProperty("descriptionPresent") boolean descriptionPresent,
        @JsonProperty("description") @Nullable String description,
        @JsonProperty("metadataPresent") boolean metadataPresent,
        @JsonProperty("metadata") @Nullable Map<String, String> metadata,
        @JsonProperty("expiryPresent") boolean expiryPresent,
        @JsonProperty("expiry") @Nullable Long expiry,
        @JsonProperty("typePresent") boolean typePresent,
        @JsonProperty("type") @Nullable String type) {
    return builder()
            .contentPresent(contentPresent)
            .content(Strings.nullToEmpty(content))
            .descriptionPresent(descriptionPresent)
            .description(Strings.nullToEmpty(description))
            .metadataPresent(metadataPresent)
            .metadata(metadata == null ? ImmutableMap.of() : ImmutableMap.copyOf(metadata))
            .expiryPresent(expiryPresent)
            .expiry(expiry == null ? Long.valueOf(0) : expiry)
            .typePresent(typePresent)
            .type(Strings.nullToEmpty(type))
            .build();
}
UserRecordTest.java 文件源码 项目:firebase-admin-java 阅读 33 收藏 0 点赞 0 评论 0
@Test
public void testEmptyCustomClaims() throws IOException {
  ImmutableMap<String, Object> resp = ImmutableMap.<String, Object>of(
      "localId", "user",
      "customAttributes", "{}"
  );
  String json = JSON_FACTORY.toString(resp);
  UserRecord userRecord = parseUser(json);
  assertEquals("user", userRecord.getUid());
  assertEquals(0, userRecord.getCustomClaims().size());
}
CoincheckContextTest.java 文件源码 项目:cryptotrader 阅读 41 收藏 0 点赞 0 评论 0
@Test(timeOut = 60 * 1000L)
public void testExecutePrivate() throws Exception {

    conf.addProperty(
            "com.after_sunrise.cryptocurrency.cryptotrader.service.coincheck.CoincheckContext.api.id",
            "my_id"
    );
    conf.addProperty(
            "com.after_sunrise.cryptocurrency.cryptotrader.service.coincheck.CoincheckContext.api.secret",
            "my_secret"
    );
    doReturn(Instant.ofEpochMilli(1234567890)).when(target).getNow();

    String path = "http://localhost:80/test";
    Map<String, String> params = ImmutableMap.of("foo", "bar");
    String data = "hoge";

    Map<String, String> headers = new LinkedHashMap<>();
    headers.put("Content-Type", "application/json");
    headers.put("ACCESS-KEY", "my_id");
    headers.put("ACCESS-NONCE", "1234567890");
    headers.put("ACCESS-SIGNATURE", "c1882128a3b8bcf13cec68d2dabf0ab867064f97afc90162624d32273a05b65a");
    doReturn("test").when(target).request(GET, path + "?foo=bar", headers, data);

    assertEquals(target.executePrivate(GET, path, params, data), "test");

}
AuthnRequestAcceptanceTest.java 文件源码 项目:verify-service-provider 阅读 40 收藏 0 点赞 0 评论 0
@Test
public void shouldGenerateValidAuthnRequestUsingDefaultEntityId() throws Exception {
    singleTenantApplication.before();
    Client client = new JerseyClientBuilder(singleTenantApplication.getEnvironment()).build("Test Client");

    setupComplianceToolWithDefaultEntityId(client);

    Response authnResponse = client
        .target(URI.create(String.format("http://localhost:%d/generate-request", singleTenantApplication.getLocalPort())))
        .request()
        .buildPost(Entity.json(new RequestGenerationBody(LevelOfAssurance.LEVEL_2, null)))
        .invoke();

    RequestResponseBody authnSaml = authnResponse.readEntity(RequestResponseBody.class);

    Response complianceToolResponse = client
        .target(authnSaml.getSsoLocation())
        .request()
        .buildPost(Entity.form(new MultivaluedHashMap<>(ImmutableMap.of("SAMLRequest", authnSaml.getSamlRequest()))))
        .invoke();

    JSONObject complianceToolResponseBody = new JSONObject(complianceToolResponse.readEntity(String.class));
    assertThat(complianceToolResponseBody.getJSONObject("status").get("message")).isEqualTo(null);
    assertThat(complianceToolResponseBody.getJSONObject("status").getString("status")).isEqualTo("PASSED");

    singleTenantApplication.after();
}
B3DLoader.java 文件源码 项目:CustomWorldGen 阅读 28 收藏 0 点赞 0 评论 0
public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet<String> meshes, boolean smooth, boolean gui3d, int defaultKey, ImmutableMap<String, ResourceLocation> textures)
{
    this.modelLocation = modelLocation;
    this.model = model;
    this.meshes = meshes;
    this.textures = textures;
    this.smooth = smooth;
    this.gui3d = gui3d;
    this.defaultKey = defaultKey;
}
BakedModelInstrument.java 文件源码 项目:Clef 阅读 33 收藏 0 点赞 0 评论 0
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType type)
{
    if(instrument != null)
    {
        HashMap<ItemCameraTransforms.TransformType, TRSRTransformation> map = new HashMap<>();
        map.put(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, new TRSRTransformation(new Vector3f(1F, 0F, 1F), TRSRTransformation.quatFromXYZDegrees(new Vector3f(0F, 180F, 0F)), new Vector3f(1F, 1F, 1F), new Quat4f()));
        map.put(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, new TRSRTransformation(new Vector3f(0.1F, 0F + (instrument.handImg.getHeight() <= 16F ? 0F : MathHelper.clamp((float)instrument.info.activeHandPosition[1], -0.3F, 0.3F)), 0.025F - (instrument.handImg.getWidth() <= 16F ? 0F : MathHelper.clamp((float)instrument.info.activeHandPosition[0], -0.5F, 0.5F))), TRSRTransformation.quatFromXYZDegrees(new Vector3f(0F, 80F, 0F)), new Vector3f(-1F, 1F, 1F),  TRSRTransformation.quatFromXYZDegrees(new Vector3f(0F, 0F, 0F))));
        map.put(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, new TRSRTransformation(new Vector3f(-0.1F, 0F + (instrument.handImg.getHeight() <= 16F ? 0F : MathHelper.clamp((float)instrument.info.activeHandPosition[1], -0.3F, 0.3F)), 1F - (instrument.handImg.getWidth() <= 16F ? 0F : MathHelper.clamp((float)instrument.info.activeHandPosition[0], -0.5F, 0.5F))), TRSRTransformation.quatFromXYZDegrees(new Vector3f(0F, 80F, 0F)), new Vector3f(1F, 1F, 1F), TRSRTransformation.quatFromXYZDegrees(new Vector3f(0F, 0F, 0F))));
        ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms = ImmutableMap.copyOf(map);
        return PerspectiveMapWrapper.handlePerspective(ModelBaseWrapper.isEntityRender(type) ? instrument.handModel : instrument.iconModel, transforms, type);
    }
    return PerspectiveMapWrapper.handlePerspective(this, transforms, type);
}


问题


面经


文章

微信
公众号

扫码关注公众号