Skip to content

Commit

Permalink
Use a record for SimsparkAgentProxyServerParameter
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesbraun committed Aug 21, 2023
1 parent a189a15 commit 71ef318
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 50 deletions.
2 changes: 1 addition & 1 deletion src/main/java/magma/tools/proxy/MagmaProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static void main(String[] args)
{
SimsparkAgentProxyServerParameter parameterObject = parseParameters(args);
SimsparkAgentProxyServer proxy = new SimsparkAgentProxyServer(parameterObject);
new MagmaProxy(proxy).run(parameterObject.isDaemon());
new MagmaProxy(proxy).run(parameterObject.daemon());
}

/**
Expand Down
55 changes: 6 additions & 49 deletions src/main/java/magma/tools/proxy/impl/SimsparkAgentProxyServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ public class SimsparkAgentProxyServer extends Thread

public SimsparkAgentProxyServer(SimsparkAgentProxyServerParameter parameterObject)
{
this.proxyPort = parameterObject.getProxyPort();
this.ssHost = parameterObject.getSsHost();
this.ssPort = parameterObject.getSsPort();
this.showMessages = parameterObject.isShowMessages();
this.proxyPort = parameterObject.proxyPort();
this.ssHost = parameterObject.ssHost();
this.ssPort = parameterObject.ssPort();
this.showMessages = parameterObject.showMessages();

agentProxies = new ArrayList<>();
}
Expand Down Expand Up @@ -138,51 +138,8 @@ public ArrayList<AgentProxy> getAgentProxies()
return agentProxies;
}

public static class SimsparkAgentProxyServerParameter
public record SimsparkAgentProxyServerParameter(
int proxyPort, String ssHost, int ssPort, boolean showMessages, boolean daemon)
{
private final int proxyPort;

private final String ssHost;

private final int ssPort;

private final boolean showMessages;

private final boolean daemon;

public SimsparkAgentProxyServerParameter(
int proxyPort, String ssHost, int ssPort, boolean showMessages, boolean daemon)
{
this.proxyPort = proxyPort;
this.ssHost = ssHost;
this.ssPort = ssPort;
this.showMessages = showMessages;
this.daemon = daemon;
}

public int getProxyPort()
{
return proxyPort;
}

public String getSsHost()
{
return ssHost;
}

public int getSsPort()
{
return ssPort;
}

public boolean isShowMessages()
{
return showMessages;
}

public boolean isDaemon()
{
return daemon;
}
}
}

0 comments on commit 71ef318

Please sign in to comment.