Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
daaexample
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Martín Vázquez Torres
daaexample
Commits
0c0cad9f
Commit
0c0cad9f
authored
Feb 12, 2017
by
cyanide4all
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added the pet entity
parent
3c7c0d49
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
Pet.java
src/main/java/es/uvigo/esei/daa/entities/Pet.java
+63
-0
No files found.
src/main/java/es/uvigo/esei/daa/entities/Pet.java
View file @
0c0cad9f
package
es
.
uvigo
.
esei
.
daa
.
entities
;
import
static
java
.
util
.
Objects
.
requireNonNull
;
/**
* Entity that represents a pet from a person
*
...
...
@@ -8,9 +10,70 @@ package es.uvigo.esei.daa.entities;
public
class
Pet
{
private
int
id
;
private
String
name
;
private
Person
owner
;
// Constructor needed for the JSON conversion
Pet
()
{}
/**
* Constructs a new instance of {@link Pet}.
*
* @param id identifier of the pet.
* @param name name of the pet.
* @param owner person who owns the pet.
*/
public
Pet
(
int
id
,
String
name
,
Person
owner
)
{
this
.
id
=
id
;
this
.
setName
(
name
);
this
.
setOwner
(
owner
);
}
/**
* Returns the identifier of the pet.
*
* @return the identifier of the pet.
*/
public
int
getId
()
{
return
id
;
}
/**
* Returns the name of the pet.
*
* @return the name of the pet.
*/
public
String
getName
()
{
return
name
;
}
/**
* Set the name of this person.
*
* @param name the new name of the person.
* @throws NullPointerException if the {@code name} is {@code null}.
*/
public
void
setName
(
String
name
)
{
this
.
name
=
requireNonNull
(
name
,
"Name can't be null"
);
}
/**
* Returns the owner of the pet.
*
* @return the owner of the pet.
*/
public
Person
getOwner
()
{
return
owner
;
}
/**
* Set the owner of this pet.
*
* @param owner the owner of the pet.
* @throws NullPointerException if the {@code owner} is {@code null}.
*/
public
void
setOwner
(
Person
owner
)
{
this
.
owner
=
requireNonNull
(
owner
,
"Owner can't be a null reference"
);
}
//TODO -------- ESTABA HACIENDO ESTO MIRAR PRACTICA 2 PARA ENUNCIADO
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment