javax.naming
public class NameClassPair extends Object implements Serializable
NameClassPair
represents the name-classname mapping pair
of a binding in a context.
Bindings are mappings of a name to an object and this class is used to specify the mapping of the name to the class type of the bound object. As classname the fully qualified classname is used.
Constructor and Description |
---|
NameClassPair(String name,
String className)
Constructs an instance with the given name and classname.
|
NameClassPair(String name,
String className,
boolean isRelative)
Constructs an instance with the given name and classname and a
flag indicating if the name is relative to the target context.
|
Modifier and Type | Method and Description |
---|---|
String |
getClassName()
Returns the classname of the binding.
|
String |
getName()
Returns the name of the binding.
|
String |
getNameInNamespace()
Returns the full name for this binding.
|
boolean |
isRelative()
Checks whether the name is relative to the target context or not.
|
void |
setClassName(String name)
Sets the classname of the bound object.
|
void |
setName(String name)
Sets the name of the binding.
|
void |
setNameInNamespace(String fullName)
Sets the full name for this binding.
|
void |
setRelative(boolean r)
Sets if the name is relative to the target context.
|
String |
toString()
Returns the string representation.
|
public NameClassPair(String name, String className)
name
- the name of the binding relative to the target context
(may not be null
)className
- the name of the class. If null
the bound
object is also null
public NameClassPair(String name, String className, boolean isRelative)
name
- the name of the binding (may not be null
)className
- the name of the class. If null
the bound
object is also null
isRelative
- flag indicating if the name is relative or notpublic String getClassName()
null
if the
bound object is null.public boolean isRelative()
true
if the name is relative,
false
otherwise.public void setClassName(String name)
name
- the classname to set (maybe null
)public void setName(String name)
name
- the name to setpublic void setRelative(boolean r)
r
- true
to mark as relativepublic void setNameInNamespace(String fullName)
fullName
- the full name of this binding. If not set or set to
null
the getNameInNamespace()
method will
throw an exceptiongetNameInNamespace()
public String getNameInNamespace()
UnsupportedOperationException
- if no full name is applicable in
the specific naming system.Context.getNameInNamespace()
public String toString()
toString
in class Object
getName() + ":" + getClassName()
.Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)