| 1 | /* Copyright (C) 2001 Free Software Foundation
|
|---|
| 2 |
|
|---|
| 3 | This file is part of libgcj.
|
|---|
| 4 |
|
|---|
| 5 | This software is copyrighted work licensed under the terms of the
|
|---|
| 6 | Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
|---|
| 7 | details. */
|
|---|
| 8 |
|
|---|
| 9 | package javax.naming;
|
|---|
| 10 |
|
|---|
| 11 | /**
|
|---|
| 12 | * @author Tom Tromey <[email protected]>
|
|---|
| 13 | * @date May 16, 2001
|
|---|
| 14 | */
|
|---|
| 15 | public class Binding extends NameClassPair
|
|---|
| 16 | {
|
|---|
| 17 | public Binding (String name, Object obj)
|
|---|
| 18 | {
|
|---|
| 19 | super (name, null);
|
|---|
| 20 | boundObj = obj;
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | public Binding (String name, Object obj, boolean isRelative)
|
|---|
| 24 | {
|
|---|
| 25 | super (name, null, isRelative);
|
|---|
| 26 | boundObj = obj;
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | public Binding (String name, String className, Object obj)
|
|---|
| 30 | {
|
|---|
| 31 | super (name, className);
|
|---|
| 32 | boundObj = obj;
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| 35 | public Binding (String name, String className, Object obj,
|
|---|
| 36 | boolean isRelative)
|
|---|
| 37 | {
|
|---|
| 38 | super (name, className, isRelative);
|
|---|
| 39 | boundObj = obj;
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | public String getClassName ()
|
|---|
| 43 | {
|
|---|
| 44 | String r = super.getClassName ();
|
|---|
| 45 | if (r != null)
|
|---|
| 46 | return r;
|
|---|
| 47 | return boundObj == null ? null : boundObj.getClass ().getName ();
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | public Object getObject ()
|
|---|
| 51 | {
|
|---|
| 52 | return boundObj;
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | public void setObject (Object obj)
|
|---|
| 56 | {
|
|---|
| 57 | boundObj = obj;
|
|---|
| 58 | }
|
|---|
| 59 |
|
|---|
| 60 | public String toString ()
|
|---|
| 61 | {
|
|---|
| 62 | // Format specified by the documentation.
|
|---|
| 63 | return super.toString () + ":" + boundObj.toString ();
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | // This name is fixed by the serialization spec.
|
|---|
| 67 | private Object boundObj;
|
|---|
| 68 | }
|
|---|