java.lang.Object
org.snmp4j.transport.TransportMappings
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<A extends Address>
TransportMapping<A> createTransportMapping
(A transportAddress) Returns aTransportMapping
instance that is initialized with the supplied transport address.static TransportMappings
Returns theTransportMappings
singleton.<A extends Address>
voidregisterTransportMapping
(Class<? extends TransportMapping<A>> transportMappingClass, Class<A> addressClass) Register a transport mapping to be recognised by thisTransportMappings
singleton.protected void
<A extends Address>
Class<? extends TransportMapping<?>> unregisterTransportMapping
(Class<A> addressClass) Unregister an address class from the corresponding transport mapping.
-
Field Details
-
TRANSPORT_MAPPINGS
- See Also:
-
-
Constructor Details
-
TransportMappings
protected TransportMappings()
-
-
Method Details
-
getInstance
Returns theTransportMappings
singleton.- Returns:
- the
TransportMappings
instance.
-
createTransportMapping
Returns aTransportMapping
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 propertyTRANSPORT_MAPPINGS
to a transport mappings registration file, before calling this method for the first time.- Type Parameters:
A
- anAddress
class that is the super class for the addresses supported by this transport mapping.- Parameters:
transportAddress
- anAddress
instance that the transport mapping to lookup has to support.- Returns:
- a
TransportMapping
that supports the specifiedtransportAddress
ornull
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 thisTransportMappings
singleton. If this method has not been called yet, theregisterTransportMappings()
will be called to register default transport mappings first.- Parameters:
transportMappingClass
- a Class extendingTransportMapping
.addressClass
- the primary address Class extendingAddress
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 extendingAddress
that the transport mapping to be removed was registered with.- Returns:
- the removed transport mapping registration or
null
. - Since:
- 3.7.1
-