[SNMP4J] SMIConstants: interface or class?

Beton, Richard richard.beton at roke.co.uk
Mon May 10 19:10:20 CEST 2004


Bloch recommends that groups of constants should not be defined using 
interfaces but rather using classes.  This avoids confusing code where 
the origin of a constant is not clear because of the constants being 
imported using 'implements'.  Instead, constants are referred to 
directly with their class namespace.

This advice applies to SMIConstants, which is currently an interface.  
Ideally, it should be a class as follows.  No other changes would be 
needed because there appear to be no classes in SNMP4J that implement 
SMIConstants.

Rick :-)



package org.snmp4j.smi;

/**
 * The <code>SMIConstants</code> defines the tag values for SMI syntax 
types.
 *
 * @author Frank Fock
 * @version 1.0
 */
public final class SMIConstants {

  public static final int SYNTAX_INTEGER = 0x02;
  public static final int SYNTAX_OCTET_STRING = 0x04;
  public static final int SYNTAX_NULL = 0x05;
  public static final int SYNTAX_OBJECT_IDENTIFIER = 0x06;

  public static final int SYNTAX_IPADDRESS = 0x40;
  public static final int SYNTAX_COUNTER32 = 0x41;
  public static final int SYNTAX_GAUGE32   = 0x42;
  public static final int SYNTAX_UNSIGNED_INTEGER32 = 0x42;
  public static final int SYNTAX_TIMETICKS = 0x43;
  public static final int SYNTAX_OPAQUE = 0x44;
  public static final int SYNTAX_COUNTER64 = 0x46;

  public static final int EXCEPTION_NO_SUCH_OBJECT = 0x80;
  public static final int EXCEPTION_NO_SUCH_INSTANCE = 0x81;
  public static final int EXCEPTION_END_OF_MIB_VIEW = 0x82;
}


-- 

Visit our website at www.roke.co.uk

Registered Office: Roke Manor Research Ltd, Siemens House, Oldbury, Bracknell,
Berkshire. RG12 8FZ

The information contained in this e-mail and any attachments is confidential to
Roke Manor Research Ltd and must not be passed to any third party without
permission. This communication is for information only and shall not create or
change any contractual relationship.




More information about the SNMP4J mailing list