本文整理匯總了Java中javax.naming.Name.add方法的典型用法代碼示例。如果您正苦於以下問題:Java Name.add方法的具體用法?Java Name.add怎麽用?Java Name.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.naming.Name
的用法示例。
在下文中一共展示了Name.add方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseName
import javax.naming.Name; //導入方法依賴的package包/類
/**
* Strips the URL header.
*
* @return the parsed name
* @exception NamingException if there is no "java:" header or if no
* naming context has been bound to this thread
*/
protected Name parseName(Name name)
throws NamingException {
if (!initialContext && !name.isEmpty() &&
name.get(0).startsWith(prefix)) {
if (name.get(0).equals(prefix)) {
return name.getSuffix(1);
} else {
Name result = name.getSuffix(1);
result.add(0, name.get(0).substring(prefixLength));
return result;
}
} else {
if (initialContext) {
return name;
} else {
throw new NamingException(
sm.getString("selectorContext.noJavaUrl"));
}
}
}
示例2: getNameInNamespace
import javax.naming.Name; //導入方法依賴的package包/類
@Override
public String getNameInNamespace() throws NamingException {
LocalContext ancestor = iParent;
if (ancestor == null) return "";
Name name = parse("");
name.add(iName);
while (ancestor != null && ancestor.iName != null) {
name.add(0, ancestor.iName);
ancestor = ancestor.iParent;
}
return name.toString();
}
示例3: parseName
import javax.naming.Name; //導入方法依賴的package包/類
/**
* Strips the URL header.
*
* @return the parsed name
* @exception NamingException
* if there is no "java:" header or if no naming context has
* been bound to this thread
*/
protected Name parseName(Name name) throws NamingException {
if (!initialContext && !name.isEmpty() && name.get(0).startsWith(prefix)) {
if (name.get(0).equals(prefix)) {
return name.getSuffix(1);
} else {
Name result = name.getSuffix(1);
result.add(0, name.get(0).substring(prefixLength));
return result;
}
} else {
if (initialContext) {
return name;
} else {
throw new NamingException(sm.getString("selectorContext.noJavaUrl"));
}
}
}
示例4: jndiName
import javax.naming.Name; //導入方法依賴的package包/類
/**
* Converts a given DN into one suitable for use through JNDI. In particular, escapes special characters such as '/'
* which have special meaning to JNDI.
*
* @param dn
* the dn
* @return the name
* @throws InvalidNameException
* the invalid name exception
*/
public static Name jndiName(String dn) throws InvalidNameException
{
Name n = new CompositeName();
n.add(dn);
return n;
}