home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / naming / directory / ModificationItem.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.2 KB  |  48 lines

  1. package javax.naming.directory;
  2.  
  3. import java.io.Serializable;
  4.  
  5. public class ModificationItem implements Serializable {
  6.    private int mod_op;
  7.    private Attribute attr;
  8.    private static final long serialVersionUID = 7573258562534746850L;
  9.  
  10.    public ModificationItem(int var1, Attribute var2) {
  11.       switch (var1) {
  12.          case 1:
  13.          case 2:
  14.          case 3:
  15.             if (var2 == null) {
  16.                throw new IllegalArgumentException("Must specify non-null attribute for modification");
  17.             }
  18.  
  19.             this.mod_op = var1;
  20.             this.attr = var2;
  21.             return;
  22.          default:
  23.             throw new IllegalArgumentException("Invalid modification code " + var1);
  24.       }
  25.    }
  26.  
  27.    public int getModificationOp() {
  28.       return this.mod_op;
  29.    }
  30.  
  31.    public Attribute getAttribute() {
  32.       return this.attr;
  33.    }
  34.  
  35.    public String toString() {
  36.       switch (this.mod_op) {
  37.          case 1:
  38.             return "Add attribute: " + this.attr.toString();
  39.          case 2:
  40.             return "Replace attribute: " + this.attr.toString();
  41.          case 3:
  42.             return "Remove attribute: " + this.attr.getID().toString();
  43.          default:
  44.             return "";
  45.       }
  46.    }
  47. }
  48.