projects
/
rhynodge.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add display name to chains and reactions.
[rhynodge.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
reactor
/
loader
/
Chain.java
diff --git
a/src/main/java/net/pterodactylus/reactor/loader/Chain.java
b/src/main/java/net/pterodactylus/reactor/loader/Chain.java
index
b018859
..
8c98e50
100644
(file)
--- a/
src/main/java/net/pterodactylus/reactor/loader/Chain.java
+++ b/
src/main/java/net/pterodactylus/reactor/loader/Chain.java
@@
-20,16
+20,13
@@
package net.pterodactylus.reactor.loader;
import java.util.ArrayList;
import java.util.List;
import java.util.ArrayList;
import java.util.List;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
+import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Model for chain definitions.
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
/**
* Model for chain definitions.
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
-@XmlRootElement
public class Chain {
/**
public class Chain {
/**
@@
-40,11
+37,11
@@
public class Chain {
public static class Parameter {
/** The name of the parameter. */
public static class Parameter {
/** The name of the parameter. */
- @
XmlElement(required = true)
+ @
JsonProperty
private String name;
/** The value of the parameter. */
private String name;
/** The value of the parameter. */
- @
XmlElement(required = true)
+ @
JsonProperty
private String value;
/**
private String value;
/**
@@
-104,12
+101,11
@@
public class Chain {
public static class Part {
/** The class name of the part. */
public static class Part {
/** The class name of the part. */
- @
XmlElement(required = true, nam
e = "class")
+ @
JsonProperty(valu
e = "class")
private String name;
/** The parameters of the part. */
private String name;
/** The parameters of the part. */
- @XmlElement(name = "parameter")
- @XmlElementWrapper(name = "parameters")
+ @JsonProperty
private List<Parameter> parameters = new ArrayList<Parameter>();
/**
private List<Parameter> parameters = new ArrayList<Parameter>();
/**
@@
-169,28
+165,31
@@
public class Chain {
}
/** Whether this chain is enabled. */
}
/** Whether this chain is enabled. */
- @
XmlElement(required = true)
+ @
JsonProperty
private boolean enabled;
private boolean enabled;
+ /** The name of the chain. */
+ @JsonProperty
+ private String name;
+
/** The query of the chain. */
/** The query of the chain. */
- @
XmlElement(required = true)
+ @
JsonProperty
private Part query;
/** The filters of the chain. */
private Part query;
/** The filters of the chain. */
- @XmlElement(name = "filter")
- @XmlElementWrapper(name = "filters")
+ @JsonProperty
private List<Part> filters = new ArrayList<Part>();
/** The trigger of the chain. */
private List<Part> filters = new ArrayList<Part>();
/** The trigger of the chain. */
- @
XmlElement(required = true)
+ @
JsonProperty
private Part trigger;
/** The action of the chain. */
private Part trigger;
/** The action of the chain. */
- @
XmlElement(required = true)
+ @
JsonProperty
private Part action;
/** Interval between updates (in seconds). */
private Part action;
/** Interval between updates (in seconds). */
- @
XmlElement(required = true)
+ @
JsonProperty
private int updateInterval;
/**
private int updateInterval;
/**
@@
-203,6
+202,15
@@
public class Chain {
}
/**
}
/**
+ * Returns the name of the chain.
+ *
+ * @return The name of the chain
+ */
+ public String name() {
+ return name;
+ }
+
+ /**
* Returns the query of this chain.
*
* @return The query of this chain
* Returns the query of this chain.
*
* @return The query of this chain
@@
-257,6
+265,7
@@
public class Chain {
@Override
public int hashCode() {
int hashCode = 0;
@Override
public int hashCode() {
int hashCode = 0;
+ hashCode ^= name.hashCode();
hashCode ^= query.hashCode();
for (Part filter : filters) {
hashCode ^= filter.hashCode();
hashCode ^= query.hashCode();
for (Part filter : filters) {
hashCode ^= filter.hashCode();
@@
-276,6
+285,9
@@
public class Chain {
return false;
}
Chain chain = (Chain) object;
return false;
}
Chain chain = (Chain) object;
+ if (!name.equals(chain.name)) {
+ return false;
+ }
if (!query.equals(chain.query)) {
return false;
}
if (!query.equals(chain.query)) {
return false;
}