Package eu.tneitzel.rmg.endpoints
Class KnownEndpointHolder
- java.lang.Object
-
- eu.tneitzel.rmg.endpoints.KnownEndpointHolder
-
public class KnownEndpointHolder extends Object
The KnownEndpointHolder is a helper class to work with KnownEndpoints. It is responsible to create the list of KnownEndpoints from the known-endpoints.yml file that is contained within the remote-method-guesser .jar file. Furthermore, it can be used to perform certain operations on the list, like checking whether a KnownEndpoint exists in the list or returning a KnownEndpoint by name.- Author:
- Tobias Neitzel (@qtc_de)
-
-
Constructor Summary
Constructors Constructor Description KnownEndpointHolder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static KnownEndpointHoldergetHolder()The getHolder function returns an instance of KnownEndpointHolder.List<KnownEndpoint>getKnownEndpoints()Returns a List of KnownEndpoint that was created from the known-endpoints.yml file.booleanisKnown(String className)Check whether the specified class name exists within the List of KnownEndpoint.KnownEndpointlookup(String className)Can be used to lookup a class name within the List of KnownEndpoints.voidsetKnownEndpoints(List<KnownEndpoint> knownEndpoints)Sets the List of KnownEndpoint for a KnownEndpointHolder instance.
-
-
-
Method Detail
-
getKnownEndpoints
public List<KnownEndpoint> getKnownEndpoints()
Returns a List of KnownEndpoint that was created from the known-endpoints.yml file. Can be null if KnownEndpointHolder was not created via getHolder().- Returns:
- List of KnownEndpoint
-
setKnownEndpoints
public void setKnownEndpoints(List<KnownEndpoint> knownEndpoints)
Sets the List of KnownEndpoint for a KnownEndpointHolder instance.- Parameters:
knownEndpoints- List of KnownEndpoints to set within the holder
-
lookup
public KnownEndpoint lookup(String className)
Can be used to lookup a class name within the List of KnownEndpoints. The first endpoint that contains the corresponding class name within its className list is returned. If no endpoint is matching, return null.- Parameters:
className- KnownEndpoint className to look for- Returns:
- KnownEndpoint that contains the requested class name or null
-
isKnown
public boolean isKnown(String className)
Check whether the specified class name exists within the List of KnownEndpoint. If this is the case, returns true. False otherwise.- Parameters:
className- KnownEndpoint className to look for- Returns:
- true if the className is contained, false otherwise
-
getHolder
public static KnownEndpointHolder getHolder()
The getHolder function returns an instance of KnownEndpointHolder. This function should always be used when such an Object is required, as it makes sure that the List of KnownEndpoint is initialized. The creation of a new KnownEndpointHolder should only occur once when using this function. If a KnownEndpointHolder was created previously, the already existing instance is returned instead of a new one.- Returns:
- KnownEndpointHolder with initialized List of KnownEndpoint
-
-