當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。