All Downloads are FREE. Search and download functionalities are using the official Maven repository.

models.Person Maven / Gradle / Ivy

There is a newer version: 9.1.0-Beta4
Show newest version
package models;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.mangoo.annotations.Collection;
import io.mangoo.annotations.Indexed;
import io.mangoo.enums.Sort;
import io.mangoo.persistence.Entity;

/**
 * 
 * @author svenkubiak
 *
 */
@Collection(name = "people")
public class Person extends Entity {
    @Indexed(sort = Sort.ASCENDING)
    private final String firstname;

    @Indexed(sort = Sort.DESCENDING, unique = true)
    private final String lastname;
    @Indexed(sort = Sort.DESCENDING)
    private final int age;
    @Indexed(sort = Sort.DESCENDING)
    private String address;

    @JsonCreator
    public Person(@JsonProperty("firstname") String firstname, @JsonProperty("lastname") String lastname, @JsonProperty("age") int age) {
        this.firstname = firstname;
        this.lastname = lastname;
        this.age = age;
    }

    public String getFirstname() {
        return firstname;
    }

    public String getLastname() {
        return lastname;
    }

    public int getAge() {
        return age;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy