Commit 3461a844 authored by Daniel Bluhm's avatar Daniel Bluhm

Remove generics from JavascriptValidator

Simplifies type importing.
Signed-off-by: Daniel Bluhm's avatarDaniel Bluhm <bluhmdj@ornl.gov>
parent e9f8c49b
......@@ -46,7 +46,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
* @author Jay Jay Billings
*
*/
public class JavascriptValidator<T> implements Serializable {
public class JavascriptValidator implements Serializable {
/**
* Logging tool
......@@ -88,7 +88,7 @@ public class JavascriptValidator<T> implements Serializable {
* Copy constructor
* @param otherValidator to copy
*/
public JavascriptValidator(JavascriptValidator<T> otherValidator) {
public JavascriptValidator(JavascriptValidator otherValidator) {
if (otherValidator != null) {
function = otherValidator.function;
}
......@@ -136,9 +136,9 @@ public class JavascriptValidator<T> implements Serializable {
// Check shallow identify and type first
if (this == otherObject) {
retValue = true;
} else if (otherObject instanceof JavascriptValidator<?>) {
} else if (otherObject instanceof JavascriptValidator) {
@SuppressWarnings("unchecked")
JavascriptValidator<T> otherValidator = (JavascriptValidator<T>) otherObject;
JavascriptValidator otherValidator = (JavascriptValidator) otherObject;
retValue = this.function.equals(otherValidator.function);
}
......@@ -153,7 +153,7 @@ public class JavascriptValidator<T> implements Serializable {
* @throws NoSuchMethodException This exception is thrown if the Javascript
* validation function cannot be found.
*/
public boolean validate(final T data) throws NoSuchMethodException {
public boolean validate(final IDataElement data) throws NoSuchMethodException {
boolean retValue = false;
Object result = null;
......@@ -196,7 +196,7 @@ public class JavascriptValidator<T> implements Serializable {
public Object clone() {
try {
// Call the copy constructor to create the clone.
return new JavascriptValidator<T>(this);
return new JavascriptValidator(this);
} catch (Exception e) {
logger.error("Unable to clone DataElement!", e);
return null;
......
......@@ -99,7 +99,7 @@ class GeneratedDataElementTest {
assertEquals(element.isSecret(), secret);
// Make sure that adding validators works superficially
JavascriptValidator<GeneratedDataElement> validator = new JavascriptValidator<GeneratedDataElement>();
JavascriptValidator validator = new JavascriptValidator();
element.setValidator(validator);
assertEquals(element.getValidator(), validator);
......@@ -167,7 +167,7 @@ class GeneratedDataElementTest {
GeneratedDataElement element = getStringElement("Major Lazer & La Roux");
element.setSecret(true);
element.setRequired(true);
element.setValidator(new JavascriptValidator<GeneratedDataElement>());
element.setValidator(new JavascriptValidator());
// Because of the private id changing and being unique, this cannot be checked
// against a reference but can only be checked by inversion.
......@@ -178,7 +178,7 @@ class GeneratedDataElementTest {
element.setTestField("Eastern Sun");
System.out.println(output);
GeneratedDataElement element2 = getStringElement("Emancipator");
element2.setValidator(new JavascriptValidator<GeneratedDataElement>());
element2.setValidator(new JavascriptValidator());
element2.fromJson(output);
element.fromJson(output);
assertEquals(element,element2);
......@@ -198,7 +198,7 @@ class GeneratedDataElementTest {
element.setTestPOJO(new TestPOJO());
element.setSecret(true);
element.setRequired(true);
element.setValidator(new JavascriptValidator<GeneratedDataElementPOJO>());
element.setValidator(new JavascriptValidator());
// Because of the private id changing and being unique, this cannot be checked
// against a reference but can only be checked by inversion.
......@@ -209,7 +209,7 @@ class GeneratedDataElementTest {
GeneratedDataElementPOJO element2 = new GeneratedDataElementPOJOImplementation();
TestPOJO pojo2 = new TestPOJO();
pojo2.setDoubleValue(1.072);
element2.setValidator(new JavascriptValidator<GeneratedDataElementPOJO>());
element2.setValidator(new JavascriptValidator());
element2.setTestPOJO(pojo2);
element2.fromJson(output);
......@@ -236,12 +236,12 @@ class GeneratedDataElementTest {
GeneratedDataElement element4 = getStringElement("Halsey");
// Need a validator for the tests that is shared on the equal elements.
JavascriptValidator<GeneratedDataElement> validator = new JavascriptValidator<GeneratedDataElement>();
JavascriptValidator validator = new JavascriptValidator();
element.setValidator(validator);
element2.setValidator(validator);
element4.setValidator(validator);
// Billie needs her own validator
element3.setValidator(new JavascriptValidator<GeneratedDataElement>());
element3.setValidator(new JavascriptValidator());
// Data elements must be checked both for matching - a deep inequality except
// the UUID - and for a fully complete match that contains the UUID. Start with
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment