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


Java Properties.isEmpty方法代码示例

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


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

示例1: makeURLParameters

import java.util.Properties; //导入方法依赖的package包/类
public static String makeURLParameters(final Properties params) {
  final StringBuffer result = new StringBuffer(100);
  if (!params.isEmpty()) {
    boolean first = true;
    final Set set = params.entrySet();
    for (final Iterator i = set.iterator(); i.hasNext(); ) {
      final Map.Entry entry = (Map.Entry) i.next();
      if (first) {
        result.append('?');
        first = false;
      } else {
        result.append('&');
      }
      result.append((String) entry.getKey());
      result.append('=');
      result.append((String) entry.getValue());
    }
  }
  return result.toString();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:WebuiUtils.java

示例2: init

import java.util.Properties; //导入方法依赖的package包/类
public static void init(List<String> locationPatterns) throws Exception {
  if (inited) {
    return;
  }

  synchronized (LOCK) {
    if (inited) {
      return;
    }

    PropertiesLoader loader = new PropertiesLoader(locationPatterns);
    Properties properties = loader.load();
    if (properties.isEmpty()) {
      throw new Exception("can not find resource " + locationPatterns);
    }

    PropertyConfigurator.configure(properties);
    inited = true;

    // 如果最高优先级的文件是在磁盘上,且有写权限,则将merge的结果输出到该目录,方便维护时观察生效的参数
    outputFile(loader.getFoundResList(), properties);
  }
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:24,代码来源:Log4jUtils.java

示例3: write

import java.util.Properties; //导入方法依赖的package包/类
public void write(java.io.Writer w, Object inst) throws IOException {
    w.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"+XMLSettingsSupport.LINE_SEPARATOR); // NOI18N
    w.write("<!DOCTYPE properties PUBLIC \""); // NOI18N
    
    FileObject foEntity = Env.findEntityRegistration(providerFO);
    if (foEntity == null) foEntity = providerFO;
    Object publicId = foEntity.getAttribute(Env.EA_PUBLICID);
    if (publicId == null || !(publicId instanceof String)) {
        throw new IOException("missing or invalid attribute: " + //NOI18N
            Env.EA_PUBLICID + ", provider: " + foEntity); //NOI18N
    }
    
    w.write((String) publicId);
    w.write("\" \"http://www.netbeans.org/dtds/properties-1_0.dtd\">"+XMLSettingsSupport.LINE_SEPARATOR); // NOI18N
    w.write("<properties>"+XMLSettingsSupport.LINE_SEPARATOR); // NOI18N
    Properties p = getProperties(inst);
    if (p != null && !p.isEmpty()) writeProperties(w, p);
    w.write("</properties>"+XMLSettingsSupport.LINE_SEPARATOR); // NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:XMLPropertiesConvertor.java

示例4: loadPropertyFile

import java.util.Properties; //导入方法依赖的package包/类
/**
 * This function will load property file to initialize the parameters values.
 *
 */
public void loadPropertyFile(){
	try(FileInputStream stream = getExternalPropertyFilePath();
			InputStream inputStream = this.getClass().getResourceAsStream(getInternalPropertyFilePath());) {
		Properties properties = new Properties();
		
		if(stream != null){
			properties.load(stream);
		}else {
			
			properties.load(inputStream);
		}
		
		if (!properties.isEmpty()) {
			portNo = properties.getProperty(PORT_NO);
			host = properties.getProperty(LOCAL_URL);
			route = properties.getProperty(TRACKING_ROUTE);
			String frequency = properties.getProperty(STATUS_FREQUENCY);
			statusFrequency = Long.parseLong(frequency);
		}
	} catch (IOException exception) {
		logger.error("Failed to load properties file", exception);
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:28,代码来源:ExecutionTrackingUtils.java

示例5: doParse

import java.util.Properties; //导入方法依赖的package包/类
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
	// parse attributes using conventions
	super.doParse(element, parserContext, builder);

	// parse nested element (if any)
	Properties parsedProps = parserContext.getDelegate().parsePropsElement(element);
	if (!parsedProps.isEmpty()) {
		if (builder.getRawBeanDefinition().getPropertyValues().contains(PROPERTIES_PROP)) {
			parserContext.getReaderContext().error(
				"Property '" + PROPERTIES_PROP
						+ "' is defined more then once. Only one approach may be used per property.", element);

		}
		builder.addPropertyValue(PROPERTIES_PROP, parsedProps);
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:17,代码来源:ConfigPropertiesDefinitionParser.java

示例6: saveModel

import java.util.Properties; //导入方法依赖的package包/类
public static void saveModel(OQLTreeModel model) {
    FileLock lock = null;
    try {
        Properties p = modelToProperties(model);
        if (!p.isEmpty()) ProfilerStorage.saveGlobalProperties(p, SAVED_OQL_QUERIES_FILENAME);
    } catch (Exception e) {
        ProfilerLogger.log(e);
    } finally {
        if (lock != null) lock.releaseLock();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:OQLSupport.java

示例7: loadSessionSettings

import java.util.Properties; //导入方法依赖的package包/类
private void loadSessionSettings() {
    features = session.getFeatures();
    plugins = session.getPlugins();
    
    Properties p = new Properties();
    try {
        ProfilerStorage.loadProjectProperties(p, session.getProject(), "attach"); // NOI18N
    } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
    }
    if (!p.isEmpty()) {
        attachSettings = new AttachSettings();
        attachSettings.load(p);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ProfilerWindow.java

示例8: generate

import java.util.Properties; //导入方法依赖的package包/类
private void generate(final Properties props, String elementName) throws SAXException {
  if (props == null || props.isEmpty()) {
    return;
  }
  if (elementName != null) {
    handler.startElement("", elementName, elementName, EMPTY);
  }
  for (Iterator iter = props.entrySet().iterator(); iter.hasNext();) {
    Map.Entry entry = (Map.Entry) iter.next();
    String name = (String) entry.getKey();
    Object value = entry.getValue();

    AttributesImpl atts = new AttributesImpl();
    atts.addAttribute("", "", NAME, "", name);

    handler.startElement("", PARAMETER, PARAMETER, atts);

    if (value instanceof String) {
      generate((String) value);

    } else if (value instanceof Declarable) {
      generate((Declarable) value);

    } else {
      // Ignore it
    }

    handler.endElement("", PARAMETER, PARAMETER);

  }
  if (elementName != null) {
    handler.endElement("", elementName, elementName);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:35,代码来源:CacheXmlGenerator.java

示例9: loadSessionStorage

import java.util.Properties; //导入方法依赖的package包/类
/**
 * 加载sessionStorage信息
 * @param accountNameValue
 * @return
 */
private boolean loadSessionStorage(String accountNameValue, Map<String, String> customMap)
{
    WebDriver webDriver = util.getEngine().getDriver();
    if(webDriver instanceof WebStorage)
    {
        WebStorage webStorage = (WebStorage) webDriver;
        SessionStorage sessionStorage = webStorage.getSessionStorage();

        Properties pro = new Properties();
        if(PathUtil.proLoad(pro, "sessionStorage." + accountNameValue))
        {
            if(pro.isEmpty())
            {
                return false;
            }
            
            pro.putAll(customMap);

            pro.stringPropertyNames().parallelStream().forEach((key) -> {
                sessionStorage.setItem(key, pro.getProperty(key));
            });

            return true;
        }
    }

    return false;
}
 
开发者ID:LinuxSuRen,项目名称:phoenix.webui.framework,代码行数:34,代码来源:AutoModuleProxy.java

示例10: createCache

import java.util.Properties; //导入方法依赖的package包/类
public void createCache(Properties prop) {
  if (null != prop && !prop.isEmpty()) {
    cache = new CacheFactory(prop).create();
  } else {
    cache = new CacheFactory().set(MCAST_PORT, "0").create();
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:8,代码来源:QueryTestUtils.java

示例11: resolveAndBindTypeDef

import java.util.Properties; //导入方法依赖的package包/类
private static void resolveAndBindTypeDef(SimpleValue simpleValue,
		Mappings mappings, String typeName, Properties parameters) {
	TypeDef typeDef = mappings.getTypeDef( typeName );
	if ( typeDef != null ) {
		typeName = typeDef.getTypeClass();
		// parameters on the property mapping should
		// override parameters in the typedef
		Properties allParameters = new Properties();
		allParameters.putAll( typeDef.getParameters() );
		allParameters.putAll( parameters );
		parameters = allParameters;
	}else if (typeName!=null && !mappings.isInSecondPass()){
		BasicType basicType=mappings.getTypeResolver().basic(typeName);
		if (basicType==null) {
			/*
			 * If the referenced typeName isn't a basic-type, it's probably a typedef defined 
			 * in a mapping file not read yet.
			 * It should be solved by deferring the resolution and binding of this type until 
			 * all mapping files are read - the second passes.
			 * Fixes issue HHH-7300
			 */
			SecondPass resolveUserTypeMappingSecondPass=new ResolveUserTypeMappingSecondPass(simpleValue,typeName,mappings,parameters);
			mappings.addSecondPass(resolveUserTypeMappingSecondPass);
		}
	}

	if ( !parameters.isEmpty() ) simpleValue.setTypeParameters( parameters );

	if ( typeName != null ) simpleValue.setTypeName( typeName );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:HbmBinder.java

示例12: setFromProperties

import java.util.Properties; //导入方法依赖的package包/类
public void setFromProperties(Properties properties) {
    if (!properties.isEmpty()) {
        setOperationId((String) properties
                .get(APPlatformController.KEY_OPERATION_ID));
        properties.remove(APPlatformController.KEY_OPERATION_ID);
        setUserId((String) properties
                .get(APPlatformController.KEY_OPERATION_USER_ID));
        properties.remove(APPlatformController.KEY_OPERATION_USER_ID);
        if (!properties.isEmpty()) {
            setParameters(convertPropertiesToXML(properties));
        }
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:14,代码来源:Operation.java

示例13: setOptions

import java.util.Properties; //导入方法依赖的package包/类
/** Load options from the configuration file*/
public void setOptions(InputStream optionsStream) throws IOException {
	Properties prop = new Properties();
	prop.load(optionsStream);
	
	// load the required options
	conservativeSVA = Boolean.parseBoolean(getProperty(prop, "conservativeSVA"));
	conservativeSVOA = Boolean.parseBoolean(getProperty(prop, "conservativeSVOA"));
	processCcAllVerbs = Boolean.parseBoolean(getProperty(prop, "processCcAllVerbs"));
	processCcNonVerbs = Boolean.parseBoolean(getProperty(prop, "processCcNonVerbs"));
	processAppositions = Boolean.parseBoolean(getProperty(prop, "processAppositions"));
	appositionVerb = getProperty(prop, "appositionVerb");
	processPossessives = Boolean.parseBoolean(getProperty(prop, "processPossessives"));
	possessiveVerb = getProperty(prop, "possessiveVerb");
	processPartmods = Boolean.parseBoolean(getProperty(prop, "processPartmods"));
	lemmatize = Boolean.parseBoolean(getProperty(prop, "lemmatize"));
	nary = Boolean.parseBoolean(getProperty(prop, "nary"));
	minOptionalArgs = Integer.parseInt(getProperty(prop, "minOptionalArgs"));
	maxOptionalArgs = Integer.parseInt(getProperty(prop, "maxOptionalArgs"));
	
	// get dictionaries
	dictCopular = getDictionary(prop, "dictCopular");
	dictExtCopular = getDictionary(prop, "dictExtCopular");
	dictNotExtCopular = getDictionary(prop, "dictNotExtCopular");
	dictComplexTransitive = getDictionary(prop, "dictComplexTransitive");
	dictAdverbsConj = getDictionary(prop, "dictAdverbsConj");
	dictAdverbsIgnore = getDictionary(prop, "dictAdverbsIgnore");
	dictAdverbsInclude = getDictionary(prop, "dictAdverbsInclude");
	
	// check for unused properties
	if (!prop.isEmpty()) {
		System.err.println( "Unknown option(s): " 
				+ Arrays.toString( prop.keySet().toArray() ));
	}
}
 
开发者ID:gkiril,项目名称:minie,代码行数:36,代码来源:Options.java

示例14: toJSONObject

import java.util.Properties; //导入方法依赖的package包/类
/**
 * Converts a property file object into a JSONObject. The property file object is a table of name value pairs.
 * @param properties java.util.Properties
 * @return JSONObject
 * @throws JSONException
 */
public static JSONObject toJSONObject(Properties properties) throws JSONException {
    JSONObject jo = new JSONObject();
    if (properties != null && !properties.isEmpty()) {
        Enumeration enumProperties = properties.propertyNames();
        while(enumProperties.hasMoreElements()) {
            String name = (String)enumProperties.nextElement();
            jo.put(name, properties.getProperty(name));
        }
    }
    return jo;
}
 
开发者ID:shawlaf,项目名称:Banmanager,代码行数:18,代码来源:Property.java

示例15: createConfiguration

import java.util.Properties; //导入方法依赖的package包/类
/**
 * Prepare the FreeMarker Configuration and return it.
 * @return the FreeMarker Configuration object
 * @throws IOException if the config file wasn't found
 * @throws TemplateException on FreeMarker initialization failure
 */
public Configuration createConfiguration() throws IOException, TemplateException {
	Configuration config = newConfiguration();
	Properties props = new Properties();

	// Load config file if specified.
	if (this.configLocation != null) {
		if (logger.isInfoEnabled()) {
			logger.info("Loading FreeMarker configuration from " + this.configLocation);
		}
		PropertiesLoaderUtils.fillProperties(props, this.configLocation);
	}

	// Merge local properties if specified.
	if (this.freemarkerSettings != null) {
		props.putAll(this.freemarkerSettings);
	}

	// FreeMarker will only accept known keys in its setSettings and
	// setAllSharedVariables methods.
	if (!props.isEmpty()) {
		config.setSettings(props);
	}

	if (!CollectionUtils.isEmpty(this.freemarkerVariables)) {
		config.setAllSharedVariables(new SimpleHash(this.freemarkerVariables, config.getObjectWrapper()));
	}

	if (this.defaultEncoding != null) {
		config.setDefaultEncoding(this.defaultEncoding);
	}

	List<TemplateLoader> templateLoaders = new LinkedList<TemplateLoader>(this.templateLoaders);

	// Register template loaders that are supposed to kick in early.
	if (this.preTemplateLoaders != null) {
		templateLoaders.addAll(this.preTemplateLoaders);
	}

	// Register default template loaders.
	if (this.templateLoaderPaths != null) {
		for (String path : this.templateLoaderPaths) {
			templateLoaders.add(getTemplateLoaderForPath(path));
		}
	}
	postProcessTemplateLoaders(templateLoaders);

	// Register template loaders that are supposed to kick in late.
	if (this.postTemplateLoaders != null) {
		templateLoaders.addAll(this.postTemplateLoaders);
	}

	TemplateLoader loader = getAggregateTemplateLoader(templateLoaders);
	if (loader != null) {
		config.setTemplateLoader(loader);
	}

	postProcessConfiguration(config);
	return config;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:66,代码来源:FreeMarkerConfigurationFactory.java


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