src/main/java/de/uapcore/lightpit/entities/Component.java

Thu, 15 Oct 2020 12:27:05 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 15 Oct 2020 12:27:05 +0200
changeset 127
6105ee2cceaf
child 134
f47e82cd6077
permissions
-rw-r--r--

adds component entity

universe@127 1 /*
universe@127 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
universe@127 3 *
universe@127 4 * Copyright 2020 Mike Becker. All rights reserved.
universe@127 5 *
universe@127 6 * Redistribution and use in source and binary forms, with or without
universe@127 7 * modification, are permitted provided that the following conditions are met:
universe@127 8 *
universe@127 9 * 1. Redistributions of source code must retain the above copyright
universe@127 10 * notice, this list of conditions and the following disclaimer.
universe@127 11 *
universe@127 12 * 2. Redistributions in binary form must reproduce the above copyright
universe@127 13 * notice, this list of conditions and the following disclaimer in the
universe@127 14 * documentation and/or other materials provided with the distribution.
universe@127 15 *
universe@127 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
universe@127 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
universe@127 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
universe@127 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
universe@127 20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
universe@127 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
universe@127 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
universe@127 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
universe@127 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
universe@127 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
universe@127 26 * POSSIBILITY OF SUCH DAMAGE.
universe@127 27 *
universe@127 28 */
universe@127 29 package de.uapcore.lightpit.entities;
universe@127 30
universe@127 31 import de.uapcore.lightpit.types.WebColor;
universe@127 32
universe@127 33 import java.util.Objects;
universe@127 34
universe@127 35 public final class Component {
universe@127 36
universe@127 37 private final int id;
universe@127 38
universe@127 39 private String name;
universe@127 40
universe@127 41 private WebColor color;
universe@127 42
universe@127 43 private int ordinal = 0;
universe@127 44
universe@127 45 private String description = null;
universe@127 46
universe@127 47 private User lead = null;
universe@127 48
universe@127 49 /**
universe@127 50 * Sole constructor.
universe@127 51 * @param id the ID of the component
universe@127 52 */
universe@127 53 public Component(int id) {
universe@127 54 this.id = id;
universe@127 55 }
universe@127 56
universe@127 57 public int getId() {
universe@127 58 return id;
universe@127 59 }
universe@127 60
universe@127 61 public String getName() {
universe@127 62 return name;
universe@127 63 }
universe@127 64
universe@127 65 public void setName(String name) {
universe@127 66 this.name = name;
universe@127 67 }
universe@127 68
universe@127 69 public WebColor getColor() {
universe@127 70 return color;
universe@127 71 }
universe@127 72
universe@127 73 public void setColor(WebColor color) {
universe@127 74 this.color = color;
universe@127 75 }
universe@127 76
universe@127 77 public int getOrdinal() {
universe@127 78 return ordinal;
universe@127 79 }
universe@127 80
universe@127 81 public void setOrdinal(int ordinal) {
universe@127 82 this.ordinal = ordinal;
universe@127 83 }
universe@127 84
universe@127 85 public String getDescription() {
universe@127 86 return description;
universe@127 87 }
universe@127 88
universe@127 89 public void setDescription(String description) {
universe@127 90 this.description = description;
universe@127 91 }
universe@127 92
universe@127 93 public User getLead() {
universe@127 94 return lead;
universe@127 95 }
universe@127 96
universe@127 97 public void setLead(User lead) {
universe@127 98 this.lead = lead;
universe@127 99 }
universe@127 100
universe@127 101 @Override
universe@127 102 public boolean equals(Object o) {
universe@127 103 if (this == o) return true;
universe@127 104 if (o == null || getClass() != o.getClass()) return false;
universe@127 105 Component component = (Component) o;
universe@127 106 return id == component.id;
universe@127 107 }
universe@127 108
universe@127 109 @Override
universe@127 110 public int hashCode() {
universe@127 111 return Objects.hash(id);
universe@127 112 }
universe@127 113 }

mercurial