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


Java Properties.getProperty方法代码示例

本文整理汇总了Java中java.util.Properties.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Properties.getProperty方法的具体用法?Java Properties.getProperty怎么用?Java Properties.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Properties的用法示例。


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

示例1: parseConnectionFactory

import java.util.Properties; //导入方法依赖的package包/类
protected void parseConnectionFactory(Context context, Node node) {
    ConnectionFactoryConfiguration connectionFactoryConfiguration = new ConnectionFactoryConfiguration();

    context.setConnectionFactoryConfiguration(connectionFactoryConfiguration);

    Properties attributes = parseAttributes(node);
    String type = attributes.getProperty("type"); //$NON-NLS-1$

    if (stringHasValue(type)) {
        connectionFactoryConfiguration.setConfigurationType(type);
    }

    NodeList nodeList = node.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node childNode = nodeList.item(i);

        if (childNode.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }

        if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
            parseProperty(connectionFactoryConfiguration, childNode);
        }
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:26,代码来源:MyBatisGeneratorConfigurationParser.java

示例2: setup

import java.util.Properties; //导入方法依赖的package包/类
@Before
public void setup() throws IOException {
    final InputStream inputStream = getClass().getClassLoader().getResourceAsStream("test_credentials.properties");

    // Load properties
    Properties properties = new Properties();
    properties.load(inputStream);
    inputStream.close();

    // Load in config
    testConfig = new Configuration(
        properties.getProperty("username"),
        properties.getProperty("password"),
        properties.getProperty("user_key")
    );

    logger.info("Config: {}", testConfig);

    // Create and init rest client
    restClient = new HttpClientRestClient();
    restClient.init(testConfig);
}
 
开发者ID:Crim,项目名称:pardot-java-client,代码行数:23,代码来源:HttpClientRestClientTest.java

示例3: main

import java.util.Properties; //导入方法依赖的package包/类
public static void main(String[] args) {
	
	String port = null;
	try {
		InputStream in = AppMain.class.getResourceAsStream("/application.properties");
		Properties p = new Properties();
		p.load(in);
		
		port = p.getProperty("server.port");
	} catch (Exception e) {
		logger.error("error read port", e);
	}
	
	if (port != null) {
		new SocketServer(Integer.parseInt(port));
		
		logger.info("server start, port is " + port);
	} else {
		logger.error("error read port, port is null");
		System.exit(0);
	}
	
}
 
开发者ID:toulezu,项目名称:io-command,代码行数:24,代码来源:AppMain.java

示例4: testCreatePlatforms

import java.util.Properties; //导入方法依赖的package包/类
public void testCreatePlatforms() {
    
    // learn hostname
    String hostName = null;
    try {
        hostName = InetAddress.getLocalHost().getHostName();
    } catch (UnknownHostException uhe) {
        fail("Cannot get hostname: " + uhe.getMessage()); // NOI18N
    }
    hostName = hostName.replace('-', '_');
    
    // load platforms.properties file
    InputStream is = this.getClass().getResourceAsStream("platforms.properties");
    Properties props = new Properties();
    try {
        props.load(is);
    } catch (java.io.IOException ioe) {
        fail("Cannot load platforms properties: " + ioe.getMessage()); // NOI18N
    }
    
    // get folder from prop file
    
    // XXX add correct paths to platform.properties
    String folderJDK13Path = props.getProperty(hostName + "_jdk13_folder");
    TestProjectUtils.addPlatform(JDK13_NAME, folderJDK13Path);
    String folderJDK14Path = props.getProperty(hostName + "_jdk14_folder");
    TestProjectUtils.addPlatform(JDK14_NAME, folderJDK14Path);
    String folderJDK15Path = props.getProperty(hostName + "_jdk15_folder");
    TestProjectUtils.addPlatform(JDK15_NAME, folderJDK15Path);
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:PlatformsTest.java

示例5: getTools

import java.util.Properties; //导入方法依赖的package包/类
private String[] getTools(PrintWriter writer, Properties p, String key) {
    String value = p.getProperty(key);
    if (value == null || value.isEmpty()) {
        writer.printf("ERROR: '%s' property is empty%n", key);
        return new String[]{};
    }
    return value.split(" ");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:ActionSet.java

示例6: ZookeeperServiceProvider

import java.util.Properties; //导入方法依赖的package包/类
private ZookeeperServiceProvider() {
    try {
        Properties properties = ConfUtils.appConf;
        zkService = new ZkService(properties.getProperty(Constants.ApplicationProp.ZK_SERVERS));
    } catch (Exception e) {
        throw new InitializationException(e);
    }
}
 
开发者ID:BriData,项目名称:DBus,代码行数:9,代码来源:ZookeeperServiceProvider.java

示例7: TestApplication

import java.util.Properties; //导入方法依赖的package包/类
public TestApplication(Stage parent, Properties props) {
    initOwner(parent);
    MPFUtils.replaceEnviron(props);
    String model = props.getProperty(Constants.PROP_PROJECT_LAUNCHER_MODEL);
    if (model == null || model.equals("")) {
        commandField.setText("Select a launcher and set the parameters required.");
        show();
    } else {
        IRuntimeLauncherModel launcherModel = LauncherModelHelper.getLauncherModel(model);
        launchCommand = launcherModel.createLauncher(props);
    }
    initModality(Modality.APPLICATION_MODAL);
    BorderPane content = new BorderPane();
    VBox builder = new VBox();
    builder.setSpacing(5);
    outputArea.setEditable(false);
    errorArea.setEditable(false);
    VBox.setVgrow(errorArea, Priority.ALWAYS);
    builder.getChildren().addAll(new Label("Command"), commandField, new Label("Standard Output & Error"), outputArea,
            new Label("Message"), errorArea);
    closeButton.setOnAction((event) -> {
        if (launchCommand != null) {
            launchCommand.destroy();
        }
        close();
    });
    content.setCenter(builder);
    content.setBottom(new HBox(5, FXUIUtils.createFiller(), closeButton));
    setScene(new Scene(content));
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:31,代码来源:TestApplication.java

示例8: test

import java.util.Properties; //导入方法依赖的package包/类
@Test
@Ignore
public void test() throws IOException {
    Properties prop = PropertiesUtils.loadProperties("META-INF/generator.properties");
    File sourcePath = new File(prop.getProperty(PropertiesUtils.TARGET_FOLDER));
    Class<?> clazz = Integer.class;
    MongoDBDao mongo = new MongoDBDaoImpl(prop);
    PojoCreator creator = new PojoCreatorImpl(prop, mongo);
    LOG.info("Creating tests for public methods of " + clazz.getSimpleName());
    TypeSpec classTest = creator.getTypeSpec(clazz);
    creator.writeJavaFile(sourcePath, clazz, classTest);
}
 
开发者ID:sap-nocops,项目名称:Jerkoff,代码行数:13,代码来源:MainTest.java

示例9: getStormUIAddr

import java.util.Properties; //导入方法依赖的package包/类
private static String getStormUIAddr(ZkService zkService,String topologyName){
    if(zkService==null){
        return null;
    }
    String stormUIAddr=null;
    String zkPath = Constants.TOPOLOGY_ROOT+"/"+topologyName+"/"+Constants.ZkTopoConfForFullPull.COMMON_CONFIG+".properties";
    try {
        Properties props = zkService.getProperties(zkPath);
        stormUIAddr = props.getProperty(DataPullConstants.STORM_UI);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return stormUIAddr;
}
 
开发者ID:BriData,项目名称:DBus,代码行数:16,代码来源:CommandCtrl.java

示例10: setUpTest_ImapStorage

import java.util.Properties; //导入方法依赖的package包/类
@BeforeClass
public static void setUpTest_ImapStorage() throws IOException {

    Properties imapProps = new Properties();
    imapProps.load(Test_ImapStorage.class.getResourceAsStream("imapConfig.txt"));

    imapServer = imapProps.getProperty("imapServer");
    imapPass = imapProps.getProperty("imapPass");
    imapInboxFolder = imapProps.getProperty("imapInboxFolder");
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:11,代码来源:Test_ImapStorage.java

示例11: loadDefaultConnectionFile

import java.util.Properties; //导入方法依赖的package包/类
private void loadDefaultConnectionFile() throws IOException {
    if (defaultConnectionFile.exists()) {
        Properties props = new Properties();

        FileReader reader = new FileReader(defaultConnectionFile);
        try {
            props.load(reader);
        } finally {
            reader.close();
        }
        defaultEncryptionManager = props
                .getProperty(DATA_ENCRYPTION_MANAGER) == null ? "org.apache.zookeeper.inspector.encryption.BasicDataEncryptionManager"
                : props.getProperty(DATA_ENCRYPTION_MANAGER);
        defaultTimeout = props.getProperty(SESSION_TIMEOUT) == null ? "5000"
                : props.getProperty(SESSION_TIMEOUT);
        defaultHosts = props.getProperty(CONNECT_STRING) == null ? "localhost:2181"
                : props.getProperty(CONNECT_STRING);
        defaultAuthScheme = props.getProperty(AUTH_SCHEME_KEY) == null ? ""
                : props.getProperty(AUTH_SCHEME_KEY);
        defaultAuthValue = props.getProperty(AUTH_DATA_KEY) == null ? ""
                : props.getProperty(AUTH_DATA_KEY);
    } else {
        defaultEncryptionManager = "org.apache.zookeeper.inspector.encryption.BasicDataEncryptionManager";
        defaultTimeout = "5000";
        defaultHosts = "localhost:2181";
        defaultAuthScheme = "";
        defaultAuthValue = "";
    }
}
 
开发者ID:l294265421,项目名称:ZooKeeper,代码行数:30,代码来源:ZooInspectorManagerImpl.java

示例12: needBuild

import java.util.Properties; //导入方法依赖的package包/类
/**
 * @param policies
 * @return
 */
public boolean needBuild(List<BuildPolicy> policies) {
	try {
		IFile fileCache = getCache();
		if (fileCache == null) {
			return true;
		}
		Properties p = ResourceManager.loadIFileAsProperties(fileCache,
				getFileCacheName(resource.getProject().getName()));
		String svalue = p.getProperty(resource.getName(), null);
		if (svalue == null) {
			return true;
		}
		StringTokenizer st = new StringTokenizer(svalue, ":");
		long graphfiletime = resource.getLocalTimeStamp();
		long lastUpdate = Long.parseLong(st.nextToken());
		boolean need = graphfiletime > lastUpdate;
		if (need)
			return true;
		List<BuildPolicy> list = BuildPolicy.deserialize(st.nextToken());
		List<BuildPolicy> targetPolicies = new ArrayList<BuildPolicy>(policies);
		targetPolicies.removeAll(list);
		need = (targetPolicies.size() > 0);
		return need;
	} catch (Exception e) {
		return true;
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:32,代码来源:BuildPoliciesCache.java

示例13: checkVaild

import java.util.Properties; //导入方法依赖的package包/类
private boolean checkVaild(Properties props)
{
	String nameserver = props.getProperty(MQConstant.CONFIG_CONSUMER_NAMESERVER);
	if (!nameserver.matches("[0-9.:;]+"))
	{
		return false;
	}
	String timeout = props.getProperty(MQConstant.CONFIG_CONSUMER_TIMEOUT);
	if (!StringUtils.isEmpty(timeout) && !timeout.matches("[0-9]+"))
	{
		return false;
	}
	return true;
}
 
开发者ID:netease-lede,项目名称:rocketmq-easyclient,代码行数:15,代码来源:EasyMQPushConsumer.java

示例14: buildAdESPolicy

import java.util.Properties; //导入方法依赖的package包/类
/** Crea una pol&iacute;tica AdES a partir de un fichero de propiedades.
   * Las propiedades aceptadas son:
   * <ul>
   *  <li><b>policyIdentifier</b>: Identificador de la pol&iacute;tica de firma (URL u OID
   *  directo o como URN que identifica un&iacute;vocamente el fichero de pol&iacute;tica
   *  computacionalmente procesable)
   *  <li><b>policyIdentifierHash</b>: Huella digital de la pol&iacute;tica de firma en formato
   *  ASN.1 procesable identificado por <code>policyIdentifier</code>. Puede ser nulo
   *  <li><b>policyIdentifierHashAlgorithm</b>: Algoritmo de huella digital usado para el
   *  c&aacute;lculo del valor indicado en <code>policyIdentifierHashAlgorithm</code>. Es
   *  obligatorio si el valor indicado en <code>policyIdentifierHashAlgorithm</code> no es nulo
   *  <li><b>policyQualifier</b>: URL que apunta a una descripci&oacute;n legible de la
   *  pol&iacute;tica (normalmente un PDF)
   * </ul>
   * @param extraParams Propiedades de la pol&iacute;tica
   * @return Configuraci&oacute;n de pol&iacute;tica de firma o {@code null} si no se encontro el
   * identificador de la politica en el fichero de propiedades.
   * @throws IllegalArgumentException Cuando se indique un identificador de pol&iacute;tica pero
   * el resto de datos sean incongruentes.
   */
  public static AdESPolicy buildAdESPolicy(final Properties extraParams) {
  	if (extraParams == null) {
  		throw new IllegalArgumentException("Es necesario proporciona las propiedades de la politica"); //$NON-NLS-1$
  	}
  	final String policyID = extraParams.getProperty("policyIdentifier"); //$NON-NLS-1$
  	if (policyID == null) {
  		return null;
  	}

  	return new AdESPolicy(
	policyID,
	extraParams.getProperty("policyIdentifierHash"), //$NON-NLS-1$
	extraParams.getProperty("policyIdentifierHashAlgorithm"), //$NON-NLS-1$
	extraParams.getProperty("policyQualifier") //$NON-NLS-1$
);
  }
 
开发者ID:MiFirma,项目名称:mi-firma-android,代码行数:37,代码来源:AdESPolicy.java

示例15: parseColumnOverride

import java.util.Properties; //导入方法依赖的package包/类
private void parseColumnOverride(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);
    String column = attributes.getProperty("column"); //$NON-NLS-1$
    String property = attributes.getProperty("property"); //$NON-NLS-1$
    String javaType = attributes.getProperty("javaType"); //$NON-NLS-1$
    String jdbcType = attributes.getProperty("jdbcType"); //$NON-NLS-1$
    String typeHandler = attributes.getProperty("typeHandler"); //$NON-NLS-1$
    String delimitedColumnName = attributes
            .getProperty("delimitedColumnName"); //$NON-NLS-1$
    String isGeneratedAlways = attributes.getProperty("isGeneratedAlways"); //$NON-NLS-1$

    ColumnOverride co = new ColumnOverride(column);

    if (stringHasValue(property)) {
        co.setJavaProperty(property);
    }

    if (stringHasValue(javaType)) {
        co.setJavaType(javaType);
    }

    if (stringHasValue(jdbcType)) {
        co.setJdbcType(jdbcType);
    }

    if (stringHasValue(typeHandler)) {
        co.setTypeHandler(typeHandler);
    }

    if (stringHasValue(delimitedColumnName)) {
        co.setColumnNameDelimited(isTrue(delimitedColumnName));
    }
    
    if (stringHasValue(isGeneratedAlways)) {
        co.setGeneratedAlways(Boolean.parseBoolean(isGeneratedAlways));
    }

    NodeList nodeList = node.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node childNode = nodeList.item(i);

        if (childNode.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }

        if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
            parseProperty(co, childNode);
        }
    }

    tc.addColumnOverride(co);
}
 
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:53,代码来源:MyBatisGeneratorConfigurationParser.java


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