本文整理汇总了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));
}
示例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;
}
}
示例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();
}
示例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));
}
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}
示例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());
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}