Module org.snmp4j

Class TransportMappings

java.lang.Object
org.snmp4j.transport.TransportMappings

public class TransportMappings extends Object
The TransportMappings factory can be used to create a transport mapping for an address class.
Since:
1.1
Version:
2.4.1
Author:
Frank Fock
  • Field Details

  • Constructor Details

    • TransportMappings

      protected TransportMappings()
  • Method Details

    • getInstance

      public static TransportMappings getInstance()
      Returns the TransportMappings singleton.
      Returns:
      the TransportMappings instance.
    • createTransportMapping

      public <A extends Address> TransportMapping<A> createTransportMapping(A transportAddress)
      Returns a TransportMapping instance that is initialized with the supplied transport address. If no such mapping exists, null is returned. To register third party transport mappings, please set the system property TRANSPORT_MAPPINGS to a transport mappings registration file, before calling this method for the first time.
      Type Parameters:
      A - an Address class that is the super class for the addresses supported by this transport mapping.
      Parameters:
      transportAddress - an Address instance that the transport mapping to lookup has to support.
      Returns:
      a TransportMapping that supports the specified transportAddress or null if such a mapping cannot be found.
    • registerTransportMappings

      protected void registerTransportMappings()
    • registerTransportMapping

      public <A extends Address> void registerTransportMapping(Class<? extends TransportMapping<A>> transportMappingClass, Class<A> addressClass)
      Register a transport mapping to be recognised by this TransportMappings singleton. If this method has not been called yet, the registerTransportMappings() will be called to register default transport mappings first.
      Parameters:
      transportMappingClass - a Class extending TransportMapping.
      addressClass - the primary address Class extending Address that can be used with that transport mapping.
      Since:
      3.7.1
    • unregisterTransportMapping

      public <A extends Address> Class<? extends TransportMapping<?>> unregisterTransportMapping(Class<A> addressClass)
      Unregister an address class from the corresponding transport mapping.
      Type Parameters:
      A - the address class
      Parameters:
      addressClass - the primary address Class extending Address that the transport mapping to be removed was registered with.
      Returns:
      the removed transport mapping registration or null.
      Since:
      3.7.1