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


Java Hashtable.clone方法代码示例

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


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

示例1: createUsingURL

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * This method is used by the iiop and iiopname URL Context factories.
 */
@SuppressWarnings("unchecked")
public static ResolveResult createUsingURL(String url, Hashtable<?,?> env)
throws NamingException {
    CNCtx ctx = new CNCtx();
    if (env != null) {
        env = (Hashtable<?,?>) env.clone();
    }
    ctx._env = (Hashtable<String, java.lang.Object>)env;
    String rest = ctx.initUsingUrl(
        env != null ?
            (org.omg.CORBA.ORB) env.get("java.naming.corba.orb")
            : null,
        url, env);

    // rest is the INS name
    // Return the parsed form to prevent subsequent lookup
    // from parsing the string as a composite name
    // The caller should be aware that a toString() of the name,
    // which came from the environment will yield its INS syntax,
    // rather than a composite syntax
    return new ResolveResult(ctx, parser.parse(rest));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:26,代码来源:CNCtx.java

示例2: LazySearchEnumerationImpl

import java.util.Hashtable; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")      // For Hashtable clone: env.clone()
public LazySearchEnumerationImpl(NamingEnumeration<Binding> candidates,
    AttrFilter filter, SearchControls cons,
    Context ctx, Hashtable<String, Object> env, boolean useFactory)
    throws NamingException {

        this.candidates = candidates;
        this.filter = filter;
        this.env = (Hashtable<String, Object>)
                ((env == null) ? null : env.clone());
        this.context = ctx;
        this.useFactory = useFactory;

        if(cons == null) {
            this.cons = new SearchControls();
        } else {
            this.cons = cons;
        }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:LazySearchEnumerationImpl.java

示例3: DnsContext

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Returns a DNS context for a given domain and servers.
 * Each server is of the form "server[:port]".
 * IPv6 literal host names include delimiting brackets.
 * There must be at least one server.
 * The environment must not be null; it is cloned before being stored.
 */
@SuppressWarnings("unchecked")
public DnsContext(String domain, String[] servers, Hashtable<?,?> environment)
        throws NamingException {

    this.domain = new DnsName(domain.endsWith(".")
                              ? domain
                              : domain + ".");
    this.servers = (servers == null) ? null : servers.clone();
    this.environment = (Hashtable<Object,Object>) environment.clone();
    envShared = false;
    parentIsDns = false;
    resolver = null;

    initFromEnvironment();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:DnsContext.java

示例4: getContinuationDirContext

import java.util.Hashtable; //导入方法依赖的package包/类
/**
  * Creates a context in which to continue a <tt>DirContext</tt> operation.
  * Operates just like <tt>NamingManager.getContinuationContext()</tt>,
  * only the continuation context returned is a <tt>DirContext</tt>.
  *
  * @param cpe
  *         The non-null exception that triggered this continuation.
  * @return A non-null <tt>DirContext</tt> object for continuing the operation.
  * @exception NamingException If a naming exception occurred.
  *
  * @see NamingManager#getContinuationContext(CannotProceedException)
  */
@SuppressWarnings("unchecked")
public static DirContext getContinuationDirContext(
        CannotProceedException cpe) throws NamingException {

    Hashtable<Object,Object> env = (Hashtable<Object,Object>)cpe.getEnvironment();
    if (env == null) {
        env = new Hashtable<>(7);
    } else {
        // Make a (shallow) copy of the environment.
        env = (Hashtable<Object,Object>) env.clone();
    }
    env.put(CPE, cpe);

    return (new ContinuationDirContext(cpe, env));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:DirectoryManager.java

示例5: CNCtx

import java.util.Hashtable; //导入方法依赖的package包/类
/**
  * Create a CNCtx object. Gets the initial naming
  * reference for the COS Naming Service from the ORB.
  * The ORB can be passed in via the java.naming.corba.orb property
  * or be created using properties in the environment properties.
  * @param env Environment properties for initializing name service.
  * @exception NamingException Cannot initialize ORB or naming context.
  */
@SuppressWarnings("unchecked")
CNCtx(Hashtable<?,?> env) throws NamingException {
    if (env != null) {
        env = (Hashtable<?,?>)env.clone();
    }
    _env = (Hashtable<String, java.lang.Object>)env;
    federation = "true".equals(env != null ? env.get(FED_PROP) : null);
    initOrbAndRootContext(env);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:CNCtx.java

示例6: clone

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * sets the information needed to reconstruct the baseCtx if
 * we are serialized. This must be called _before_ the object is
 * serialized!!!
 */
@SuppressWarnings("unchecked") // clone()
private void setBaseCtxInfo() {
    Hashtable<String, Object> realEnv = null;
    Hashtable<String, Object> secureEnv = null;

    if (baseCtx != null) {
        realEnv = ((LdapCtx)baseCtx).envprops;
        this.baseCtxURL = ((LdapCtx)baseCtx).getURL();
    }

    if(realEnv != null && realEnv.size() > 0 ) {
        // remove any security credentials - otherwise the serialized form
        // would store them in the clear
        for (String key : realEnv.keySet()){
            if (key.indexOf("security") != -1 ) {

                //if we need to remove props, we must do it to a clone
                //of the environment. cloning is expensive, so we only do
                //it if we have to.
                if(secureEnv == null) {
                    secureEnv = (Hashtable<String, Object>)realEnv.clone();
                }
                secureEnv.remove(key);
            }
        }
    }

    // set baseCtxEnv depending on whether we removed props or not
    this.baseCtxEnv = (secureEnv == null ? realEnv : secureEnv);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:LdapAttribute.java

示例7: LdapCtx

import java.util.Hashtable; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public LdapCtx(String dn, String host, int port_number,
        Hashtable<?,?> props,
        boolean useSsl) throws NamingException {

    this.useSsl = this.hasLdapsScheme = useSsl;

    if (props != null) {
        envprops = (Hashtable<String, java.lang.Object>) props.clone();

        // SSL env prop overrides the useSsl argument
        if ("ssl".equals(envprops.get(Context.SECURITY_PROTOCOL))) {
            this.useSsl = true;
        }

        // %%% These are only examined when the context is created
        // %%% because they are only for debugging or workaround purposes.
        trace = (OutputStream)envprops.get(TRACE_BER);

        if (props.get(NETSCAPE_SCHEMA_BUG) != null ||
            props.get(OLD_NETSCAPE_SCHEMA_BUG) != null) {
            netscapeSchemaBug = true;
        }
    }

    currentDN = (dn != null) ? dn : "";
    currentParsedDN = parser.parse(currentDN);

    hostname = (host != null && host.length() > 0) ? host : DEFAULT_HOST;
    if (hostname.charAt(0) == '[') {
        hostname = hostname.substring(1, hostname.length() - 1);
    }

    if (port_number > 0) {
        this.port_number = port_number;
    } else {
        this.port_number = this.useSsl ? DEFAULT_SSL_PORT : DEFAULT_PORT;
        this.useDefaultPortNumber = true;
    }

    schemaTrees = new Hashtable<>(11, 0.75f);
    initEnv();
    try {
        connect(false);
    } catch (NamingException e) {
        try {
            close();
        } catch (Exception e2) {
            // Nothing
        }
        throw e;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:54,代码来源:LdapCtx.java

示例8: InitialLdapContext

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Constructs an initial context
 * using environment properties and connection request controls.
 * See <tt>javax.naming.InitialContext</tt> for a discussion of
 * environment properties.
 *
 * <p> This constructor will not modify its parameters or
 * save references to them, but may save a clone or copy.
 * Caller should not modify mutable keys and values in
 * <tt>environment</tt> after it has been passed to the constructor.
 *
 * <p> <tt>connCtls</tt> is used as the underlying context instance's
 * connection request controls.  See the class description
 * for details.
 *
 * @param environment
 *          environment used to create the initial DirContext.
 *          Null indicates an empty environment.
 * @param connCtls
 *          connection request controls for the initial context.
 *          If null, no connection request controls are used.
 *
 * @throws  NamingException if a naming exception is encountered
 *
 * @see #reconnect
 * @see LdapContext#reconnect
 */
@SuppressWarnings("unchecked")
public InitialLdapContext(Hashtable<?,?> environment,
                          Control[] connCtls)
        throws NamingException {
    super(true); // don't initialize yet

    // Clone environment since caller owns it.
    Hashtable<Object,Object> env = (environment == null)
        ? new Hashtable<>(11)
        : (Hashtable<Object,Object>)environment.clone();

    // Put connect controls into environment.  Copy them first since
    // caller owns the array.
    if (connCtls != null) {
        Control[] copy = new Control[connCtls.length];
        System.arraycopy(connCtls, 0, copy, 0, connCtls.length);
        env.put(BIND_CONTROLS_PROPERTY, copy);
    }
    // set version to LDAPv3
    env.put("java.naming.ldap.version", "3");

    // Initialize with updated environment
    init(env);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:52,代码来源:InitialLdapContext.java

示例9: GenericURLContext

import java.util.Hashtable; //导入方法依赖的package包/类
@SuppressWarnings("unchecked") // Expect Hashtable<String, Object>
public GenericURLContext(Hashtable<?,?> env) {
    // context that is not tied to any specific URL
    myEnv =
        (Hashtable<String, Object>)(env == null ? null : env.clone());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:GenericURLContext.java

示例10: GenericURLContext

import java.util.Hashtable; //导入方法依赖的package包/类
@SuppressWarnings("unchecked") // Expect Hashtable<String, Object>
public GenericURLContext(Hashtable<?,?> env) {
    // context that is not tied to any specific URL
    myEnv =
            (Hashtable<String, Object>)(env == null ? null : env.clone());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:GenericURLContext.java

示例11: setProperties

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Passes the properties from the source object along after adding a
 * property indicating the stream of filters it has been run through.
 * <p>
 * Note: This method is intended to be called by the ImageProducer
 * of the Image whose pixels are being filtered.  Developers using
 * this class to filter pixels from an image should avoid calling
 * this method directly since that operation could interfere
 * with the filtering operation.
 *
 * @param props the properties from the source object
 * @exception NullPointerException if {@code props} is null
 */
public void setProperties(Hashtable<?,?> props) {
    @SuppressWarnings("unchecked")
    Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
    Object o = p.get("filters");
    if (o == null) {
        p.put("filters", toString());
    } else if (o instanceof String) {
        p.put("filters", ((String) o)+toString());
    }
    consumer.setProperties(p);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:ImageFilter.java

示例12: setProperties

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Passes along the properties from the source object after adding a
 * property indicating the scale applied.
 * This method invokes {@code super.setProperties},
 * which might result in additional properties being added.
 * <p>
 * Note: This method is intended to be called by the
 * {@code ImageProducer} of the {@code Image} whose pixels
 * are being filtered. Developers using
 * this class to filter pixels from an image should avoid calling
 * this method directly since that operation could interfere
 * with the filtering operation.
 */
public void setProperties(Hashtable<?,?> props) {
    @SuppressWarnings("unchecked")
    Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
    String key = "rescale";
    String val = destWidth + "x" + destHeight;
    Object o = p.get(key);
    if (o != null && o instanceof String) {
        val = ((String) o) + ", " + val;
    }
    p.put(key, val);
    super.setProperties(p);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:ReplicateScaleFilter.java

示例13: setProperties

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Passes along the properties from the source object after adding a
 * property indicating the scale applied.
 * This method invokes <code>super.setProperties</code>,
 * which might result in additional properties being added.
 * <p>
 * Note: This method is intended to be called by the
 * <code>ImageProducer</code> of the <code>Image</code> whose pixels
 * are being filtered. Developers using
 * this class to filter pixels from an image should avoid calling
 * this method directly since that operation could interfere
 * with the filtering operation.
 */
public void setProperties(Hashtable<?,?> props) {
    Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
    String key = "rescale";
    String val = destWidth + "x" + destHeight;
    Object o = p.get(key);
    if (o != null && o instanceof String) {
        val = ((String) o) + ", " + val;
    }
    p.put(key, val);
    super.setProperties(p);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:ReplicateScaleFilter.java

示例14: setProperties

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Passes the properties from the source object along after adding a
 * property indicating the stream of filters it has been run through.
 * <p>
 * Note: This method is intended to be called by the ImageProducer
 * of the Image whose pixels are being filtered.  Developers using
 * this class to filter pixels from an image should avoid calling
 * this method directly since that operation could interfere
 * with the filtering operation.
 *
 * @param props the properties from the source object
 * @exception NullPointerException if <code>props</code> is null
 */
public void setProperties(Hashtable<?,?> props) {
    Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
    Object o = p.get("filters");
    if (o == null) {
        p.put("filters", toString());
    } else if (o instanceof String) {
        p.put("filters", ((String) o)+toString());
    }
    consumer.setProperties(p);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:ImageFilter.java

示例15: setProperties

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Passes along  the properties from the source object after adding a
 * property indicating the cropped region.
 * This method invokes <code>super.setProperties</code>,
 * which might result in additional properties being added.
 * <p>
 * Note: This method is intended to be called by the
 * <code>ImageProducer</code> of the <code>Image</code> whose pixels
 * are being filtered. Developers using
 * this class to filter pixels from an image should avoid calling
 * this method directly since that operation could interfere
 * with the filtering operation.
 */
public void setProperties(Hashtable<?,?> props) {
    Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
    p.put("croprect", new Rectangle(cropX, cropY, cropW, cropH));
    super.setProperties(p);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:CropImageFilter.java


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