Package eu.rekawek.toxiproxy.model
Class Toxic
- java.lang.Object
-
- eu.rekawek.toxiproxy.model.Toxic
-
-
Field Summary
Fields Modifier and Type Field Description private HttpClienthttpClientprivate java.lang.Stringnameprivate java.lang.Stringpathprivate ToxicDirectionstreamprivate floattoxicity
-
Constructor Summary
Constructors Constructor Description Toxic(HttpClient httpClient, java.lang.String path, com.google.gson.JsonObject json)Toxic(HttpClient httpClient, java.lang.String toxicListPath, java.lang.String name, ToxicDirection stream)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcreateToxic(java.lang.String toxicListPath)protected abstract com.google.gson.JsonObjectgetAttributes()java.lang.StringgetName()ToxicDirectiongetStream()floatgetToxicity()protected abstract ToxicTypegetType()protected voidpostAttribute(java.lang.String name, long value)voidremove()protected abstract voidsetAttributes(com.google.gson.JsonObject attributes)private voidsetFromJson(com.google.gson.JsonObject json)voidsetToxicity(float toxicity)java.lang.StringtoString()
-
-
-
Field Detail
-
httpClient
private HttpClient httpClient
-
path
private java.lang.String path
-
name
private java.lang.String name
-
stream
private ToxicDirection stream
-
toxicity
private float toxicity
-
-
Constructor Detail
-
Toxic
public Toxic(HttpClient httpClient, java.lang.String toxicListPath, java.lang.String name, ToxicDirection stream)
-
Toxic
public Toxic(HttpClient httpClient, java.lang.String path, com.google.gson.JsonObject json)
-
-
Method Detail
-
setAttributes
protected abstract void setAttributes(com.google.gson.JsonObject attributes)
-
getAttributes
protected abstract com.google.gson.JsonObject getAttributes()
-
getType
protected abstract ToxicType getType()
-
createToxic
protected void createToxic(java.lang.String toxicListPath) throws java.io.IOException- Throws:
java.io.IOException
-
postAttribute
protected void postAttribute(java.lang.String name, long value) throws java.io.IOException- Throws:
java.io.IOException
-
setFromJson
private void setFromJson(com.google.gson.JsonObject json)
-
setToxicity
public void setToxicity(float toxicity) throws java.io.IOException- Throws:
java.io.IOException
-
getName
public java.lang.String getName()
-
getStream
public ToxicDirection getStream()
-
getToxicity
public float getToxicity()
-
remove
public void remove() throws java.io.IOException- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-