/*
* Copyright 2017 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kie.integration.testcoverage.model.instrumentation;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* A sample model class to be instrumented by kie-maven-plugin.
*/
public class Person implements Serializable {
private String name;
private Integer age;
private List<Pet> pets;
public Person(final String name, final Integer age) {
this.name = name;
this.age = age;
this.pets = new ArrayList<Pet>();
}
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
public Integer getAge() {
return this.age;
}
public void setAge(final Integer age) {
this.age = age;
}
public List<Pet> getPets() {
return pets;
}
public void addPet(final Pet pet) {
this.pets.add(pet);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Person person = (Person) o;
if (name != null ? !name.equals(person.name) : person.name != null) return false;
if (age != null ? !age.equals(person.age) : person.age != null) return false;
return pets != null ? pets.equals(person.pets) : person.pets == null;
}
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (age != null ? age.hashCode() : 0);
result = 31 * result + (pets != null ? pets.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "Person{" +
"name='" + name + '\'' +
", age=" + age +
", pets=" + pets +
'}';
}
}