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

com.github.jobs.bean.Service Maven / Gradle / Ivy

package com.github.jobs.bean;

import android.content.Context;

/**
 * @author cristian
 * @version 1.0
 */
public class Service {
    private long id;
    private String name;
    private int drawable;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getDrawable() {
        return drawable;
    }

    public void setDrawable(int drawable) {
        this.drawable = drawable;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Service service = (Service) o;

        if (drawable != service.drawable) return false;
        if (id != service.id) return false;
        if (name != null ? !name.equals(service.name) : service.name != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (id ^ (id >>> 32));
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + drawable;
        return result;
    }

    @Override
    public String toString() {
        return "Service{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", drawable=" + drawable +
                '}';
    }

    public static Service from(Context context, int id, int label, int logo) {
        Service service = new Service();
        service.setId(id);
        service.setName(context.getString(label));
        service.setDrawable(logo);
        return service;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy