1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * ident        "%Z%%M% %I%     %E% SMI"
  24  *
  25  * Copyright 1999-2002 Sun Microsystems, Inc.  All rights reserved.
  26  * Use is subject to license terms.
  27  */
  28 package com.sun.dhcpmgr.data;
  29 
  30 import java.util.Vector;
  31 
  32 public class IncludeOptionValue extends OptionValue {
  33     private String value;
  34     private boolean valid;
  35 
  36     // Serialization id for this class
  37     static final long serialVersionUID = -1764994428959712447L;
  38     
  39     protected IncludeOptionValue() {
  40         value = "";
  41         valid = false;
  42     }
  43     
  44     public void setValue(Object value) throws ValidationException {
  45         if (value instanceof String) {
  46             if (((String)value).length() == 0) {
  47                 // Empty values are not acceptable
  48                 throwException("invalid_include_option", null);
  49             }
  50             this.value = (String)value;
  51             valid = true;
  52         } else {
  53             setValue(value.toString());
  54         }
  55     }
  56     
  57     public String getName() {
  58         return "Include";
  59     }
  60     
  61     public String getValue() {
  62         return value;
  63     }
  64     
  65     public String toString() {
  66         return (getName() + "=" + getValue());
  67     }
  68 
  69     public boolean isValid() {
  70         return valid;
  71     }
  72     
  73     public Object clone() {
  74         IncludeOptionValue v = new IncludeOptionValue();
  75         v.value = value;
  76         v.valid = valid;
  77         return v;
  78     }
  79 }