Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
cw-auction
Project
Project
Details
Activity
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tanita
cw-auction
Commits
fda72c0b
Commit
fda72c0b
authored
Sep 24, 2025
by
Tanita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename ProductState to State
parent
177981b7
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
18 additions
and
18 deletions
+18
-18
Product.java
src/model/Product.java
+4
-4
SaleState.java
src/models/SaleState.java
+1
-1
SoldState.java
src/models/SoldState.java
+1
-1
State.java
src/models/State.java
+2
-2
StockState.java
src/models/StockState.java
+1
-1
ProductRepository.java
src/repositories/ProductRepository.java
+3
-3
ProductStateDeserialize.java
src/repositories/ProductStateDeserialize.java
+3
-3
ProductStateSerialize.java
src/repositories/ProductStateSerialize.java
+3
-3
No files found.
src/model/Product.java
View file @
fda72c0b
package
model
;
import
com.google.gson.annotations.SerializedName
;
import
models.
Product
State
;
import
models.State
;
import
models.StockState
;
public
class
Product
{
...
...
@@ -10,7 +10,7 @@ public class Product {
private
double
price
;
@SerializedName
(
"init_price"
)
private
double
initPrice
;
private
Product
State
state
;
private
State
state
;
@SerializedName
(
"honorary_code"
)
private
String
honoraryCode
;
...
...
@@ -56,11 +56,11 @@ public class Product {
this
.
price
=
price
;
}
public
Product
State
getState
()
{
public
State
getState
()
{
return
state
;
}
public
void
setState
(
Product
State
state
)
{
public
void
setState
(
State
state
)
{
this
.
state
=
state
;
}
...
...
src/models/SaleState.java
View file @
fda72c0b
...
...
@@ -3,7 +3,7 @@ package models;
import
services.CodeGenerator
;
import
model.Product
;
public
class
SaleState
extends
Product
State
{
public
class
SaleState
extends
State
{
public
SaleState
()
{
super
(
"for_sale"
);
}
...
...
src/models/SoldState.java
View file @
fda72c0b
...
...
@@ -2,7 +2,7 @@ package models;
import
model.Product
;
public
class
SoldState
extends
ProductState
{
public
class
SoldState
extends
State
{
public
SoldState
()
{
super
(
"sold"
);
...
...
src/models/
Product
State.java
→
src/models/State.java
View file @
fda72c0b
...
...
@@ -2,10 +2,10 @@ package models;
import
model.Product
;
public
abstract
class
Product
State
{
public
abstract
class
State
{
private
final
String
title
;
protected
Product
State
(
String
title
)
{
protected
State
(
String
title
)
{
this
.
title
=
title
;
}
...
...
src/models/StockState.java
View file @
fda72c0b
...
...
@@ -2,7 +2,7 @@ package models;
import
model.Product
;
public
class
StockState
extends
ProductState
{
public
class
StockState
extends
State
{
public
StockState
()
{
super
(
"in_stock"
);
}
...
...
src/repositories/ProductRepository.java
View file @
fda72c0b
...
...
@@ -6,7 +6,7 @@ import application.utils.FileReader;
import
application.utils.FileWriter
;
import
model.Product
;
import
models.ProductCollection
;
import
models.
Product
State
;
import
models.State
;
import
java.io.IOException
;
import
java.nio.file.Files
;
...
...
@@ -15,8 +15,8 @@ import java.nio.file.Paths;
public
class
ProductRepository
{
private
final
Gson
gson
=
new
GsonBuilder
()
.
registerTypeAdapter
(
Product
State
.
class
,
new
ProductStateDeserialize
())
.
registerTypeAdapter
(
Product
State
.
class
,
new
ProductStateSerialize
())
.
registerTypeAdapter
(
State
.
class
,
new
ProductStateDeserialize
())
.
registerTypeAdapter
(
State
.
class
,
new
ProductStateSerialize
())
.
setPrettyPrinting
()
.
create
();
...
...
src/repositories/ProductStateDeserialize.java
View file @
fda72c0b
...
...
@@ -5,14 +5,14 @@ import com.google.gson.JsonDeserializer;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonParseException
;
import
models.SaleState
;
import
models.
Product
State
;
import
models.State
;
import
models.SoldState
;
import
models.StockState
;
import
java.lang.reflect.Type
;
public
class
ProductStateDeserialize
implements
JsonDeserializer
<
Product
State
>
{
public
Product
State
deserialize
(
JsonElement
json
,
Type
typeOfT
,
JsonDeserializationContext
context
)
public
class
ProductStateDeserialize
implements
JsonDeserializer
<
State
>
{
public
State
deserialize
(
JsonElement
json
,
Type
typeOfT
,
JsonDeserializationContext
context
)
throws
JsonParseException
{
String
type
=
json
.
getAsString
();
switch
(
type
){
...
...
src/repositories/ProductStateSerialize.java
View file @
fda72c0b
...
...
@@ -4,12 +4,12 @@ import com.google.gson.JsonElement;
import
com.google.gson.JsonPrimitive
;
import
com.google.gson.JsonSerializationContext
;
import
com.google.gson.JsonSerializer
;
import
models.
Product
State
;
import
models.State
;
import
java.lang.reflect.Type
;
public
class
ProductStateSerialize
implements
JsonSerializer
<
Product
State
>
{
public
JsonElement
serialize
(
Product
State
src
,
Type
typeOfSrc
,
JsonSerializationContext
context
)
{
public
class
ProductStateSerialize
implements
JsonSerializer
<
State
>
{
public
JsonElement
serialize
(
State
src
,
Type
typeOfSrc
,
JsonSerializationContext
context
)
{
return
new
JsonPrimitive
(
src
.
getTitle
());
}
}
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