java.util.Properties.clone()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(227)

本文整理了Java中java.util.Properties.clone()方法的一些代码示例,展示了Properties.clone()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Properties.clone()方法的具体详情如下:
包路径:java.util.Properties
类名称:Properties
方法名:clone

Properties.clone介绍

暂无

代码示例

代码示例来源:origin: apache/geode

/**
 * Gets the GemFire Distributed System (cluster) Properties.
 *
 * @return a Properties object containing the configuration settings for the GemFire Distributed
 *         System (cluster).
 * @see java.util.Properties
 */
public Properties getProperties() {
 return (Properties) this.distributedSystemProperties.clone();
}

代码示例来源:origin: apache/geode

/**
 * Gets the GemFire Distributed System (cluster) Properties.
 *
 * @return a Properties object containing the configuration settings for the GemFire Distributed
 *         System (cluster).
 * @see java.util.Properties
 */
public Properties getProperties() {
 return (Properties) this.distributedSystemProperties.clone();
}

代码示例来源:origin: ehcache/ehcache3

/**
 * The {@code Properties} for the connection.
 *
 * @return the connection {@code Properties}
 */
public Properties getProperties() {
 return (Properties) properties.clone();
}

代码示例来源:origin: alibaba/TProfiler

public Object clone() {
 return delegate.clone();
}

代码示例来源:origin: hibernate/hibernate-orm

/**
 * replace a property by a starred version
 *
 * @param props properties to check
 * @param key proeprty to mask
 *
 * @return cloned and masked properties
 */
public static Properties maskOut(Properties props, String key) {
  Properties clone = ( Properties ) props.clone();
  if ( clone.get( key ) != null ) {
    clone.setProperty( key, "****" );
  }
  return clone;
}

代码示例来源:origin: apache/hive

/**
 * Copy constructor
 */
public HiveConf(HiveConf other) {
 super(other);
 hiveJar = other.hiveJar;
 auxJars = other.auxJars;
 isSparkConfigUpdated = other.isSparkConfigUpdated;
 origProp = (Properties)other.origProp.clone();
 restrictList.addAll(other.restrictList);
 hiddenSet.addAll(other.hiddenSet);
 modWhiteListPattern = other.modWhiteListPattern;
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Clone the basic settings for this connection!
 */
@Override
public Object clone() {
 BaseDatabaseMeta retval = null;
 try {
  retval = (BaseDatabaseMeta) super.clone();
  // CLone the attributes as well...
  retval.attributes = (Properties) attributes.clone();
 } catch ( CloneNotSupportedException e ) {
  throw new RuntimeException( e );
 }
 return retval;
}

代码示例来源:origin: apache/zookeeper

/**
 * Convenience method that returns MiniKdc default configuration.
 * <p>
 * The returned configuration is a copy, it can be customized before using
 * it to create a MiniKdc.
 * @return a MiniKdc default configuration.
 */
public static Properties createConf() {
  return (Properties) DEFAULT_CONFIG.clone();
}

代码示例来源:origin: knightliao/disconf

public Object clone() {
  return getDelegate().clone();
}

代码示例来源:origin: apache/hive

@Override
public synchronized Object clone() {
 if (interned != null) return new CopyOnFirstWriteProperties(interned);
 else return super.clone();
}

代码示例来源:origin: xalan/xalan

protected TransformerImpl(Translet translet, Properties outputProperties,
int indentNumber, TransformerFactoryImpl tfactory) 
{
_translet = (AbstractTranslet) translet;
_properties = createOutputProperties(outputProperties);
_propertiesClone = (Properties) _properties.clone();
_indentNumber = indentNumber;
_tfactory = tfactory;
//_isIncremental = tfactory._incremental;
}

代码示例来源:origin: elastic/elasticsearch-hadoop

@Override
public Settings copy() {
  return new PropertiesSettings((Properties) props.clone());
}

代码示例来源:origin: apache/flink

/**
 * A new configuration with the same settings cloned from another.
 *
 * @param other the configuration from which to clone settings.
 */
@SuppressWarnings("unchecked")
public Configuration(Configuration other) {
 this.resources = (ArrayList<Resource>) other.resources.clone();
 synchronized(other) {
  if (other.properties != null) {
   this.properties = (Properties)other.properties.clone();
  }
  if (other.overlay!=null) {
   this.overlay = (Properties)other.overlay.clone();
  }
  this.updatingResource = new ConcurrentHashMap<String, String[]>(
    other.updatingResource);
  this.finalParameters = Collections.newSetFromMap(
    new ConcurrentHashMap<String, Boolean>());
  this.finalParameters.addAll(other.finalParameters);
 }
 synchronized(Configuration.class) {
  REGISTRY.put(this, null);
 }
 this.classLoader = other.classLoader;
 this.loadDefaults = other.loadDefaults;
 setQuietMode(other.getQuietMode());
}

代码示例来源:origin: lettuce-io/lettuce-core

private InitialDirContext createContext(Properties properties) {
  LettuceAssert.notNull(properties, "Properties must not be null");
  Properties hashtable = (Properties) properties.clone();
  hashtable.put(InitialContext.INITIAL_CONTEXT_FACTORY, CTX_FACTORY_NAME);
  if (!hashtable.containsKey(INITIAL_TIMEOUT)) {
    hashtable.put(INITIAL_TIMEOUT, DEFAULT_INITIAL_TIMEOUT);
  }
  if (!hashtable.containsKey(LOOKUP_RETRIES)) {
    hashtable.put(LOOKUP_RETRIES, DEFAULT_RETRIES);
  }
  try {
    return new InitialDirContext(hashtable);
  } catch (NamingException e) {
    throw new IllegalStateException(e);
  }
}

代码示例来源:origin: robovm/robovm

/**
 * Get the static properties for xsl:output.  The object returned will
 * be a clone of the internal values, and thus it can be mutated
 * without mutating the Templates object, and then handed in to
 * the process method.
 *
 * <p>For XSLT, Attribute Value Templates attribute values will
 * be returned unexpanded (since there is no context at this point).</p>
 *
 * @return A Properties object, not null.
 */
public Properties getOutputProperties()
{    
 return (Properties)getDefaultOutputProps().clone();
}

代码示例来源:origin: docker-java/docker-java

public static Builder createDefaultConfigBuilder() {
  return createDefaultConfigBuilder(System.getenv(), (Properties) System.getProperties().clone());
}

代码示例来源:origin: com.h2database/h2

@Override
public ConnectionInfo clone() throws CloneNotSupportedException {
  ConnectionInfo clone = (ConnectionInfo) super.clone();
  clone.prop = (Properties) prop.clone();
  clone.filePasswordHash = Utils.cloneByteArray(filePasswordHash);
  clone.fileEncryptionKey = Utils.cloneByteArray(fileEncryptionKey);
  clone.userPasswordHash = Utils.cloneByteArray(userPasswordHash);
  return clone;
}

代码示例来源:origin: stagemonitor/stagemonitor

private Session getSession() {
  Properties props = (Properties) System.getProperties().clone();
  if (isNotEmpty(alertingPlugin.getSmtpUser()) && isNotEmpty(alertingPlugin.getSmtpPassword())) {
    props.setProperty("mail.smtps.auth", "true");
  }
  int smtpPort = alertingPlugin.getSmtpPort();
  props.setProperty("mail.smtp.port", Integer.toString(smtpPort));
  if (smtpPort == 587) {
    props.put("mail.smtp.starttls.enable", "true");
  }
  return Session.getInstance(props);
}

代码示例来源:origin: spring-projects/spring-framework

private static void performSet() {
  TestBean bean = new TestBean();
  Properties p = (Properties) System.getProperties().clone();
  assertTrue("The System properties must not be empty", p.size() != 0);
  for (Iterator<?> i = p.entrySet().iterator(); i.hasNext();) {
    i.next();
    if (Math.random() > 0.9) {
      i.remove();
    }
  }
  ByteArrayOutputStream buffer = new ByteArrayOutputStream();
  try {
    p.store(buffer, null);
  }
  catch (IOException e) {
    // ByteArrayOutputStream does not throw
    // any IOException
  }
  String value = new String(buffer.toByteArray());
  BeanWrapperImpl wrapper = new BeanWrapperImpl(bean);
  wrapper.setPropertyValue("properties", value);
  assertEquals(p, bean.getProperties());
}

代码示例来源:origin: apache/ignite

/**
 * @param url URL connection.
 * @param props Environment properties.
 * @throws SQLException On error.
 */
public void init(String url, Properties props) throws SQLException {
  Properties props0 = (Properties)props.clone();
  if (!F.isEmpty(url))
    parseUrl(url, props0);
  for (ConnectionProperty aPropsArray : propsArray)
    aPropsArray.init(props0);
  if (!F.isEmpty(props.getProperty("user"))) {
    setUsername(props.getProperty("user"));
    setPassword(props.getProperty("password"));
  }
}

相关文章