当前位置: 首页>>代码示例>>Java>>正文


Java Map类代码示例

本文整理汇总了Java中scala.collection.immutable.Map的典型用法代码示例。如果您正苦于以下问题:Java Map类的具体用法?Java Map怎么用?Java Map使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Map类属于scala.collection.immutable包,在下文中一共展示了Map类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testLoadInfoSparkNoConfig

import scala.collection.immutable.Map; //导入依赖的package包/类
@Test
public void testLoadInfoSparkNoConfig() {
  Map<String,String> properties = new HashMap<String,String>();

  AppResult result = new AppResult();

  HadoopApplicationData data = new SparkApplicationData("application_5678",
      properties,
      new ApplicationInfoImpl("", "", new Vector<ApplicationAttemptInfoImpl>(0,1,0)),
      new Vector<JobData>(0,1,0),
      new Vector<StageData>(0,1,0),
      new Vector<ExecutorSummary>(0,1,0));

  // test to make sure loadInfo does not throw exception if properties are not defined
  InfoExtractor.loadInfo(result, data);

  assertTrue(result.jobDefId.isEmpty());
  assertTrue(result.jobExecId.isEmpty());
  assertTrue(result.flowDefId.isEmpty());
  assertTrue(result.flowExecId.isEmpty());
}
 
开发者ID:linkedin,项目名称:dr-elephant,代码行数:22,代码来源:InfoExtractorTest.java

示例2: createRelation

import scala.collection.immutable.Map; //导入依赖的package包/类
@Override
public BaseRelation createRelation(SQLContext arg0, Map<String, String> arg1) {
    log.debug("-> createRelation()");

    java.util.Map<String, String> javaMap = scala.collection.JavaConverters
            .mapAsJavaMapConverter(arg1).asJava();

    SubStringCounterRelation br = new SubStringCounterRelation();
    br.setSqlContext(arg0);

    for (java.util.Map.Entry<String, String> entry : javaMap.entrySet()) {
        String key = entry.getKey();
        String value = entry.getValue();
        log.debug("[{}] --> [{}]", key, value);
        if (key.compareTo(K.PATH) == 0) {
            br.setFilename(value);
        } else if (key.startsWith(K.COUNT)) {
            br.addCriteria(value);
        }
    }

    return br;
}
 
开发者ID:jgperrin,项目名称:net.jgp.labs.spark,代码行数:24,代码来源:SubStringCounterDataSource.java

示例3: read

import scala.collection.immutable.Map; //导入依赖的package包/类
@Override
public Option<Model> read(Class<?> modelClass, Map<String, String> typeMap) {
    final Option<Model> modelOption = super.read(modelClass, typeMap);

    // Look for public properties
    java.util.Map<String, ApiControllerUtilsServiceImpl.SerializationEntry> entries = ApiControllerUtilsServiceImpl.getSerializationEntries(modelClass,
            null);

    // Remove all properties which are not public
    if (!modelOption.isEmpty()) {
        Iterator<String> keysIterator = modelOption.get().properties().keysIterator();
        while (keysIterator.hasNext()) {
            String propertyName = keysIterator.next();
            if (!entries.containsKey(propertyName)) {
                modelOption.get().properties().remove(propertyName);
                if (log.isDebugEnabled()) {
                    log.debug("Successfully hidden API model property '" + propertyName + "'");
                }
            }
        }
    }

    return modelOption;
}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:25,代码来源:ClassSchemaDocumentationConverter.java

示例4: testAddAclsForNonExistentRole

import scala.collection.immutable.Map; //导入依赖的package包/类
@Test
public void testAddAclsForNonExistentRole() {
  sentryKafkaAuthorizer = new SentryKafkaAuthorizer();
  java.util.Map<String, String> configs = new HashMap<>();
  configs.put(KafkaAuthConf.SENTRY_KAFKA_SITE_URL, "file://" + sentrySitePath.getAbsolutePath());
  sentryKafkaAuthorizer.configure(configs);

  final String role1 = "role1";
  Set<Acl> acls = new HashSet<>();
  final Acl acl = new Acl(new KafkaPrincipal("role", role1),
      Allow$.MODULE$,
      "127.0.0.1",
      Operation$.MODULE$.fromString("READ"));
  acls.add(acl);
  scala.collection.immutable.Set<Acl> aclsScala = scala.collection.JavaConversions.asScalaSet(acls).toSet();
  Resource resource = new Resource(ResourceType$.MODULE$.fromString("TOPIC"), "test-topic");
  try {
    sentryKafkaAuthorizer.addAcls(aclsScala, resource);
  } catch (Exception ex) {
    assertCausedMessage(ex, "Can not add Acl for non-existent Role: role1");
  }
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:23,代码来源:TestAclsCrud.java

示例5: configure

import scala.collection.immutable.Map; //导入依赖的package包/类
@Override
public void configure(java.util.Map<String, ?> configs) {
  final Object sentryKafkaSiteUrlConfig = configs.get(KafkaAuthConf.SENTRY_KAFKA_SITE_URL);
  if (sentryKafkaSiteUrlConfig != null) {
    this.sentry_site = sentryKafkaSiteUrlConfig.toString();
  }
  final Object kafkaSuperUsersConfig = configs.get(KafkaAuthConf.KAFKA_SUPER_USERS);
  if (kafkaSuperUsersConfig != null) {
    getSuperUsers(kafkaSuperUsersConfig.toString());
  }
  final Object kafkaServiceInstanceName = configs.get(KafkaAuthConf.KAFKA_SERVICE_INSTANCE_NAME);
  if (kafkaServiceInstanceName != null) {
    this.kafkaServiceInstanceName = kafkaServiceInstanceName.toString();
  }
  final Object kafkaServiceUserName = configs.get(KafkaAuthConf.KAFKA_SERVICE_USER_NAME);
  if (kafkaServiceUserName != null) {
    this.requestorName = kafkaServiceUserName.toString();
  }
  LOG.info("Configuring Sentry KafkaAuthorizer: " + sentry_site);
  final KafkaAuthBindingSingleton instance = KafkaAuthBindingSingleton.getInstance();
  instance.configure(this.kafkaServiceInstanceName, this.requestorName, sentry_site);
  this.binding = instance.getAuthBinding();
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:24,代码来源:SentryKafkaAuthorizer.java

示例6: getRoleToPrivileges

import scala.collection.immutable.Map; //导入依赖的package包/类
private java.util.Map<String, scala.collection.immutable.Set<TSentryPrivilege>> getRoleToPrivileges(final List<String> roles) {
    final java.util.Map<String, scala.collection.immutable.Set<TSentryPrivilege>> rolePrivilegesMap = new HashMap<>();
    execute(new Command<Void>() {
        @Override
        public Void run(SentryGenericServiceClient client) throws Exception {
            for (String role : roles) {
                final Set<TSentryPrivilege> rolePrivileges = client.listPrivilegesByRoleName(
                    requestorName, role, COMPONENT_NAME, instanceName);
                final scala.collection.immutable.Set<TSentryPrivilege> rolePrivilegesScala =
                    scala.collection.JavaConverters.asScalaSetConverter(rolePrivileges).asScala().toSet();
                rolePrivilegesMap.put(role, rolePrivilegesScala);
            }
            return null;
        }
    });

    return rolePrivilegesMap;
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:19,代码来源:KafkaAuthBinding.java

示例7: read

import scala.collection.immutable.Map; //导入依赖的package包/类
@Override
public Option<Model> read(Class<?> cls, Map<String, String> typeMap) {
  Schema schema = getSchema(cls);
  if (schema == null) {
    return Option.empty();
  }

  LinkedHashMap<String, ModelProperty> properties = new LinkedHashMap<>();
  for (Schema.Field field : schema.getFields()) {
    ModelProperty property = parseField(field);
    if (property == null) {
      LOGGER.debug(
          "Omitted field {} of schema {} from swagger docs", field.name(), schema.getName());
    } else {
      properties.update(getFieldName(field), property);
    }
  }

  return Option.apply(
      new Model(
          toName(cls),
          toName(cls),
          cls.getName(),
          properties,
          toDescriptionOpt(cls),
          Option.<String>empty(),
          Option.<String>empty(),
          JavaConversions.asScalaBuffer(Collections.<String>emptyList()).toList()));
}
 
开发者ID:cerner,项目名称:beadledom,代码行数:30,代码来源:SwaggerAvroModelConverter.java

示例8: testLoadInfoSpark

import scala.collection.immutable.Map; //导入依赖的package包/类
@Test
public void testLoadInfoSpark() {
  final String JOB_DEF_URL = "https://grid.example.com:9000/manager?project=project-name&flow=flow-name&job=job-name";
  final String JOB_EXEC_URL =  "https://grid.example.com:9000/executor?execid=123456&job=job-name&attempt=0";
  final String FLOW_DEF_URL = "https://grid.example.com:9000/manager?project=project-name&flow=flow-name";
  final String FLOW_EXEC_URL = "https://grid.example.com:9000/executor?execid=123456";
  final String JAVA_EXTRA_OPTIONS = "spark.driver.extraJavaOptions";
  Map<String,String> properties = new HashMap<String,String>();
  properties = properties.$plus(new Tuple2<String, String>(JAVA_EXTRA_OPTIONS, "-Dazkaban.link.workflow.url=" + FLOW_DEF_URL +
      " -Dazkaban.link.job.url=" + JOB_DEF_URL +
      " -Dazkaban.link.execution.url=" + FLOW_EXEC_URL +
      " -Dazkaban.link.attempt.url=" + JOB_EXEC_URL));

  AppResult result = new AppResult();

  HadoopApplicationData data = new SparkApplicationData("application_5678",
          properties,
      new ApplicationInfoImpl("", "", new Vector<ApplicationAttemptInfoImpl>(0,1,0)),
          new Vector<JobData>(0,1,0),
          new Vector<StageData>(0,1,0),
          new Vector<ExecutorSummary>(0,1,0));

  InfoExtractor.loadInfo(result, data);

  assertTrue(result.jobDefId.equals(JOB_DEF_URL));
  assertTrue(result.jobExecId.equals(JOB_EXEC_URL));
  assertTrue(result.flowDefId.equals(FLOW_DEF_URL));
  assertTrue(result.flowExecId.equals(FLOW_EXEC_URL));
}
 
开发者ID:linkedin,项目名称:dr-elephant,代码行数:30,代码来源:InfoExtractorTest.java

示例9: main

import scala.collection.immutable.Map; //导入依赖的package包/类
public static void main(String[] args) {
    new MyJavaMultiValueSessionSerializer(
        (JFunction1<SomeJavaComplexObject, Map<String, String>>) sjco -> {
            final java.util.Map<String, String> m = new HashMap<>();
            m.put("value", sjco.getValue());
            return MapConverters.toImmutableMap(m);
        },
        (JFunction1<Map<String, String>, Try<SomeJavaComplexObject>>) value ->
            Try.apply((JFunction0<SomeJavaComplexObject>) () -> new SomeJavaComplexObject(value.get("value").get()))
    );
}
 
开发者ID:softwaremill,项目名称:akka-http-session,代码行数:12,代码来源:MyJavaMultiValueSessionSerializer.java

示例10: createMatch

import scala.collection.immutable.Map; //导入依赖的package包/类
public static IngraphMatch createMatch(final RailwayQuery query, final Map<Object, Object> qs) {
	switch (query) {
	case CONNECTEDSEGMENTS:
		return new IngraphConnectedSegmentsMatch(qs);
	case CONNECTEDSEGMENTS_INJECT:
		return new IngraphConnectedSegmentsInjectMatch(qs);
	case POSLENGTH:
		return new IngraphPosLengthMatch(qs);
	case POSLENGTH_INJECT:
		return new IngraphPosLengthInjectMatch(qs);
	case ROUTESENSOR:
		return new IngraphRouteSensorMatch(qs);
	case ROUTESENSOR_INJECT:
		return new IngraphRouteSensorInjectMatch(qs);
	case SEMAPHORENEIGHBOR:
		return new IngraphSemaphoreNeighborMatch(qs);
	case SEMAPHORENEIGHBOR_INJECT:
		return new IngraphSemaphoreNeighborInjectMatch(qs);
	case SWITCHMONITORED:
		return new IngraphSwitchMonitoredMatch(qs);
	case SWITCHMONITORED_INJECT:
		return new IngraphSwitchMonitoredInjectMatch(qs);
	case SWITCHSET:
		return new IngraphSwitchSetMatch(qs);
	case SWITCHSET_INJECT:
		return new IngraphSwitchSetInjectMatch(qs);
	default:
		throw new UnsupportedOperationException("Pattern not supported: " + query);
	}
}
 
开发者ID:FTSRG,项目名称:trainbenchmark,代码行数:31,代码来源:IngraphMatch.java

示例11: activate

import scala.collection.immutable.Map; //导入依赖的package包/类
@Override
public void activate(final Collection<IngraphRouteSensorMatch> matches) throws IOException {
	final Transaction transaction = driver.newTransaction();
	for (final IngraphRouteSensorMatch match : matches) {
		final Long route = match.getRoute();
		final Long sensor = match.getSensor();

		transaction.add("_e4", new Map.Map2("route", route, "sensor", sensor));
	}
}
 
开发者ID:FTSRG,项目名称:trainbenchmark,代码行数:11,代码来源:IngraphTransformationRepairRouteSensor.java

示例12: activate

import scala.collection.immutable.Map; //导入依赖的package包/类
@Override
public void activate(final Collection<IngraphSemaphoreNeighborMatch> matches) throws IOException {
	final Transaction transaction = driver.newTransaction();
	for (final IngraphSemaphoreNeighborMatch match : matches) {
		final Long route2 = match.getRoute2();
		final Long semaphore = match.getSemaphore();
		transaction.add(ENTRY, new Map.Map2<>("route2", route2, "semaphore", semaphore));
	}
}
 
开发者ID:FTSRG,项目名称:trainbenchmark,代码行数:10,代码来源:IngraphTransformationRepairSemaphoreNeighbor.java

示例13: getConfiguration

import scala.collection.immutable.Map; //导入依赖的package包/类
protected Configuration getConfiguration(
  String defaultHost,
  int defaultPort,
  String defaultDatabase,
  String defaultUser,
  String defaultPassword,
  String defaultCharset,
  long defaultConnectTimeout,
  long defaultTestTimeout,
  JsonObject config) {

  String host = config.getString("host", defaultHost);
  int port = config.getInteger("port", defaultPort);
  String username = config.getString("username", defaultUser);
  String password = config.getString("password", defaultPassword);
  String database = config.getString("database", defaultDatabase);
  Charset charset = Charset.forName(config.getString("charset", defaultCharset));
  long connectTimeout = config.getLong("connectTimeout", defaultConnectTimeout);
  long testTimeout = config.getLong("testTimeout", defaultTestTimeout);
  Long queryTimeout = config.getLong("queryTimeout");
  Option<Duration> queryTimeoutOption = (queryTimeout == null) ?
    Option.empty() : Option.apply(Duration.apply(queryTimeout, TimeUnit.MILLISECONDS));

  Map<String, String> sslConfig = buildSslConfig(config);

  log.info("Creating configuration for " + host + ":" + port);
  return new Configuration(
    username,
    host,
    port,
    Option.apply(password),
    Option.apply(database),
    SSLConfiguration.apply(sslConfig),
    charset,
    16777216,
    PooledByteBufAllocator.DEFAULT,
    Duration.apply(connectTimeout, TimeUnit.MILLISECONDS),
    Duration.apply(testTimeout, TimeUnit.MILLISECONDS),
    queryTimeoutOption);
}
 
开发者ID:vert-x3,项目名称:vertx-mysql-postgresql-client,代码行数:41,代码来源:BaseSQLClient.java

示例14: buildSslConfig

import scala.collection.immutable.Map; //导入依赖的package包/类
private Map<String, String> buildSslConfig(JsonObject config) {
  Map<String, String> sslConfig = Map$.MODULE$.empty();
  if (config.getString("sslMode")!= null) {
    sslConfig = sslConfig.$plus(Tuple2.apply("sslmode", config.getString("sslMode")));
  }
  if (config.getString("sslRootCert") != null) {
    sslConfig = sslConfig.$plus(Tuple2.apply("sslrootcert", config.getString("sslRootCert")));
  }
  return sslConfig;
}
 
开发者ID:vert-x3,项目名称:vertx-mysql-postgresql-client,代码行数:11,代码来源:BaseSQLClient.java

示例15: read

import scala.collection.immutable.Map; //导入依赖的package包/类
@Override
public Option<Model> read(Class<?> cls, Map<String, String> typeMap) {
	Option<Model> model = super.read(cls, typeMap);
	for (Field field : cls.getDeclaredFields()) {
		handleExcludedAnnotations(cls, field, model);
	}
	return model;
}
 
开发者ID:minnal,项目名称:minnal,代码行数:9,代码来源:ExcludeAnnotationsConvertor.java


注:本文中的scala.collection.immutable.Map类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。