List of usage examples for java.util Collections emptyMap
@SuppressWarnings("unchecked") public static final <K, V> Map<K, V> emptyMap()
From source file:com.feilong.core.lang.ClassUtilTest.java
/** * class info map for LOGGER./*from w ww .j a va 2 s. c o m*/ * * @param klass * the klass * @return <code>klass</code> nullempty, {@link Collections#emptyMap()}<br> */ public static Map<String, Object> getClassInfoMapForLog(Class<?> klass) { if (isNullOrEmpty(klass)) { return Collections.emptyMap(); } Map<String, Object> map = new LinkedHashMap<String, Object>(); map.put("clz.getCanonicalName()", klass.getCanonicalName());//"com.feilong.core.date.DatePattern" map.put("clz.getName()", klass.getName());//"com.feilong.core.date.DatePattern" map.put("clz.getSimpleName()", klass.getSimpleName());//"DatePattern" map.put("clz.getComponentType()", klass.getComponentType()); // ?"". ,voidboolean?byte?char?short?int?long?float double?. map.put("clz.isPrimitive()", klass.isPrimitive()); // ?"".,. map.put("clz.isLocalClass()", klass.isLocalClass()); // ?"?".?,?,?"""??". map.put("clz.isMemberClass()", klass.isMemberClass()); //isSynthetic()?Class?"??".java??false,?true.,JVM???,java??"??"? map.put("clz.isSynthetic()", klass.isSynthetic()); map.put("clz.isArray()", klass.isArray()); map.put("clz.isAnnotation()", klass.isAnnotation()); //??true. map.put("clz.isAnonymousClass()", klass.isAnonymousClass()); map.put("clz.isEnum()", klass.isEnum()); return map; }
From source file:de.iew.web.view.js.RequireJSMessageBundleView.java
public Map<String, String> getBundle(Map<String, Object> stringObjectMap) { if (stringObjectMap.containsKey(MB_BUNDLE)) { MessageBundleStore store = (MessageBundleStore) stringObjectMap.get(MB_BUNDLE); return store.getMessages(); } else {/*from w w w .j a v a2 s. c o m*/ return Collections.emptyMap(); } }
From source file:org.apache.calcite.adapter.elasticsearch.EmbeddedElasticsearchPolicy.java
/** * Creates index in elastic search given mapping. * * @param index index of the index/*from ww w.j a va 2 s.c o m*/ * @param mapping field and field type mapping * @throws IOException if there is an error */ void createIndex(String index, Map<String, String> mapping) throws IOException { Objects.requireNonNull(index, "index"); Objects.requireNonNull(mapping, "mapping"); ObjectNode json = mapper().createObjectNode(); for (Map.Entry<String, String> entry : mapping.entrySet()) { json.set(entry.getKey(), json.objectNode().put("type", entry.getValue())); } json = (ObjectNode) json.objectNode().set("properties", json); json = (ObjectNode) json.objectNode().set(index, json); json = (ObjectNode) json.objectNode().set("mappings", json); // create index and mapping final HttpEntity entity = new StringEntity(mapper().writeValueAsString(json), ContentType.APPLICATION_JSON); restClient().performRequest("PUT", "/" + index, Collections.emptyMap(), entity); }
From source file:com.erudika.para.cache.HazelcastCache.java
@Override public <T> Map<String, T> getAll(String appid, List<String> ids) { if (ids == null || StringUtils.isBlank(appid)) { return Collections.emptyMap(); }/* w w w . j a v a 2 s .c o m*/ Map<String, T> result = new LinkedHashMap<String, T>(ids.size(), 0.75f, true); ids.remove(null); IMap<String, T> imap = client().getMap(appid); Map<String, T> res = imap.getAll(new TreeSet<String>(ids)); for (String id : ids) { if (res.containsKey(id)) { result.put(id, res.get(id)); } } logger.debug("Cache.getAll() {} {}", appid, ids.size()); return result; }
From source file:com.thinkbiganalytics.metadata.modeshape.common.JcrPropertiesEntity.java
@Override /**//from w w w . ja va 2 s . com * This will return just the extra properties. * All primary properties should be defined as getter/setter on the base object * You can call the getAllProperties to return the complete set of properties as a map */ public Map<String, Object> getProperties() { return getPropertiesObject().map(propsObj -> propsObj.getProperties()).orElse(Collections.emptyMap()); }
From source file:fitnesse.testsystems.CommandRunner.java
private Map<String, String> determineEnvironment() { if (environmentVariables == null) { return Collections.emptyMap(); }// ww w. ja va 2 s . c om Map<String, String> systemVariables = new HashMap<>(System.getenv()); systemVariables.putAll(environmentVariables); return systemVariables; }
From source file:fr.ortolang.diffusion.client.cmd.IndexAllCommand.java
@Override public void execute(String[] args) { CommandLineParser parser = new DefaultParser(); CommandLine cmd;//from w w w . jav a2 s .com try { cmd = parser.parse(options, args); if (cmd.hasOption("h")) { help(); } String[] credentials = getCredentials(cmd); String username = credentials[0]; String password = credentials[1]; Map<String, String> params = new HashMap<>(); if (!cmd.hasOption("t")) { System.out.println("Types must be defined"); help(); } String types = cmd.getOptionValue("t"); String phase = cmd.getOptionValue("p"); if (types.contains("all")) { if (phase == null) { System.out.println("When indexing all a phase must be given"); help(); } else if (!phase.equals("1") && !phase.equals("2")) { System.out.println("Phase number indexing all a phase must be given"); help(); } } params.put("indexingPhase", phase); params.put("indexingTypes", types); OrtolangClient client = OrtolangClient.getInstance(); if (username.length() > 0) { client.getAccountManager().setCredentials(username, password); client.login(username); } System.out.println("Connected as user: " + client.connectedProfile()); String pkey = client.createProcess("index-all", "Index all " + (types != null ? "(" + types + ")" : "(all)"), params, Collections.emptyMap()); System.out.println("Index-All process created with key : " + pkey); client.logout(); client.close(); } catch (ParseException e) { System.out.println("Failed to parse command line properties " + e.getMessage()); help(); } catch (OrtolangClientException | OrtolangClientAccountException e) { System.out.println("Unexpected error !!"); e.printStackTrace(); } }
From source file:com.spotify.styx.api.MiddlewaresTest.java
@Test public void testJsonAsync() throws Exception { AsyncHandler<Response<ByteString>> outerHandler = Middlewares.jsonAsync() .apply(rc -> CompletableFuture.completedFuture(Response.forPayload(TEST_STRUCT))); CompletionStage<Response<ByteString>> completionStage = outerHandler .invoke(RequestContexts.create(mock(Request.class), mock(Client.class), Collections.emptyMap())); assertThat(completionStage.toCompletableFuture().get().payload().get().utf8(), is("{\"foo\":\"blah\"," + "\"inner_object\":{" + "\"field_name_convention\":\"bloh\"," + "\"enum_field\":\"enum_value\"}}")); }
From source file:cop.maven.plugins.AbstractRamlConfigMojo.java
private void applyRamlPart(@NotNull Map<String, Object> map) { raml = CollectionUtils.size(raml) > 0 ? raml : new LinkedHashMap<>(); Map<String, Object> raml = getOrCreateMap(map, Config.KEY_RAML); put(raml, this.raml, Config.KEY_RAML_VERSION); put(raml, this.raml, Config.KEY_RAML_SHOW_EXAMPLE); put(raml, this.raml, Config.KEY_RAML_STOP_ON_ERROR); put(raml, this.raml, Config.KEY_RAML_DEV); if (this.raml.containsKey(Config.KEY_RAML_SKIP)) { Map<String, Object> skip = getOrCreateMap(raml, Config.KEY_RAML_SKIP); Map<String, Object> src = (Map<String, Object>) this.raml.getOrDefault(Config.KEY_RAML_SKIP, Collections.emptyMap()); put(skip, src, Config.KEY_RAML_SKIP_DEFAULT); put(skip, src, Config.KEY_RAML_SKIP_PATTERNS); }//from w w w. ja v a2 s . c o m }
From source file:biz.neustar.pc.ui.manager.impl.PaymentManagerImpl.java
private Map<String, Object> getErrorResponse(ClientResponse clientResponse) { try {//from ww w.ja v a2s . c o m clientResponse.bufferEntity(); // copy buffer to a string and put back a copy final ClientResponse finalClientResponse = clientResponse; String buffer = IOUtils.toString(finalClientResponse.getEntityInputStream(), "UTF-8"); LOGGER.info(buffer); LOGGER.info(buffer.toString()); return new ObjectMapper().readValue(buffer, Map.class); } catch (Exception e) { // just eat the exception -- something else went wrong, it'll be // found when the content is re-read // by higher-level code LOGGER.warn("Had a bad request that wasn't related to an auth issue. ", e); return Collections.emptyMap(); } }