1. /*
  2. * @(#)file SnmpValue.java
  3. * @(#)author Sun Microsystems, Inc.
  4. * @(#)version 4.9
  5. * @(#)date 04/09/15
  6. *
  7. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  8. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  9. *
  10. */
  11. package com.sun.jmx.snmp;
  12. import java.io.Serializable;
  13. /**
  14. * Is an abstract representation of an SNMP Value.
  15. * All classes provided for dealing with SNMP types should derive from this
  16. * class.
  17. *
  18. * <p><b>This API is a Sun Microsystems internal API and is subject
  19. * to change without notice.</b></p>
  20. * @version 4.9 12/19/03
  21. * @author Sun Microsystems, Inc
  22. */
  23. public abstract class SnmpValue implements Cloneable, Serializable, SnmpDataTypeEnums {
  24. /**
  25. * Returns a <CODE>String</CODE> form containing ASN.1 tagging information.
  26. * @return The <CODE>String</CODE> form.
  27. */
  28. public String toAsn1String() {
  29. return "[" + getTypeName() + "] " + toString();
  30. }
  31. /**
  32. * Returns the value encoded as an OID.
  33. * The method is particularly useful when dealing with indexed table made of
  34. * several SNMP variables.
  35. * @return The value encoded as an OID.
  36. */
  37. public abstract SnmpOid toOid() ;
  38. /**
  39. * Returns a textual description of the object.
  40. * @return ASN.1 textual description.
  41. */
  42. public abstract String getTypeName() ;
  43. /**
  44. * Same as clone, but you cannot perform cloning using this object because
  45. * clone is protected. This method should call <CODE>clone()</CODE>.
  46. * @return The <CODE>SnmpValue</CODE> clone.
  47. */
  48. public abstract SnmpValue duplicate() ;
  49. /**
  50. * This method returns <CODE>false</CODE> by default and is redefined
  51. * in the {@link com.sun.jmx.snmp.SnmpNull} class.
  52. */
  53. public boolean isNoSuchObjectValue() {
  54. return false;
  55. }
  56. /**
  57. * This method returns <CODE>false</CODE> by default and is redefined
  58. * in the {@link com.sun.jmx.snmp.SnmpNull} class.
  59. */
  60. public boolean isNoSuchInstanceValue() {
  61. return false;
  62. }
  63. /**
  64. * This method returns <CODE>false</CODE> by default and is redefined
  65. * in the {@link com.sun.jmx.snmp.SnmpNull} class.
  66. */
  67. public boolean isEndOfMibViewValue() {
  68. return false;
  69. }
  70. }