summaryrefslogtreecommitdiff
path: root/libjava/javax/naming/spi/ResolveResult.java
blob: d00aef581f4789fcb538a5a5d4673eac095684db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* Copyright (C) 2001  Free Software Foundation

   This file is part of libgcj.

This software is copyrighted work licensed under the terms of the
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
details.  */
 
package javax.naming.spi;
import javax.naming.*;
import java.util.EventObject;
import java.io.Serializable;
 
/**
 * @author Warren Levy <warrenl@redhat.com>
 * @date June 5, 2001
 */

public class ResolveResult implements Serializable
{
  // Serialized fields.
  protected Object resolvedObj;
  protected Name remainingName;

  protected ResolveResult()
  {
    resolvedObj = null;
    remainingName = null;
  }

  public ResolveResult(Object robj, String rcomp)
  {
    if (robj == null || rcomp == null)
      throw new IllegalArgumentException ();
    resolvedObj = robj;
    remainingName = new CompositeName ();
    try
      {
	remainingName.add (rcomp);
      }
    catch (InvalidNameException _)
      {
      }
  }

  public ResolveResult(Object robj, Name rname)
  {
    resolvedObj = robj;
    remainingName = rname;
  }

  public Name getRemainingName()
  {
    return remainingName;
  }

  public Object getResolvedObj()
  {
    return resolvedObj;
  }

  public void setRemainingName(Name name)
  {
    remainingName = (Name) name.clone();
  }

  public void appendRemainingName(Name name)
  {
    try
      {
	remainingName.addAll(name);
      }
    catch (InvalidNameException _)
      {
      }
  }

  public void appendRemainingComponent(String name)
  {
    try
      {
	remainingName.add(name);
      }
    catch (InvalidNameException _)
      {
      }
  }

  public void setResolvedObj(Object obj)
  {
    resolvedObj = obj;
  }
}