-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor/#368 : 팩토리 메서드 패턴을 사용하여 각 분석 도메인을 생성하는 팩토리 클래스 생성
- Loading branch information
1 parent
5a84797
commit 8f1e9e8
Showing
5 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
...in/java/com/gaebaljip/exceed/application/domain/nutritionist/AbstractAnalyzerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public abstract class AbstractAnalyzerFactory { | ||
public abstract Analyzer createAnalyzer(DailyMeal dailyMeal, Member member); | ||
} |
22 changes: 22 additions & 0 deletions
22
...ain/java/com/gaebaljip/exceed/application/domain/nutritionist/CalorieAnalyzerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public class CalorieAnalyzerFactory extends AbstractAnalyzerFactory { | ||
|
||
private CalorieAnalyzerFactory() { | ||
} | ||
|
||
private static class SingletonHolder{ | ||
private static final CalorieAnalyzerFactory INSTANCE = new CalorieAnalyzerFactory(); | ||
} | ||
|
||
public static CalorieAnalyzerFactory getInstance() { | ||
return SingletonHolder.INSTANCE; | ||
} | ||
@Override | ||
public CalorieAnalyzer createAnalyzer(DailyMeal dailyMeal, Member member) { | ||
return new CalorieAnalyzer(dailyMeal, member); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ava/com/gaebaljip/exceed/application/domain/nutritionist/CarbohydrateAnalyzerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public class CarbohydrateAnalyzerFactory extends AbstractAnalyzerFactory { | ||
|
||
private CarbohydrateAnalyzerFactory() { | ||
} | ||
|
||
private static class SingletonHolder{ | ||
private static final CarbohydrateAnalyzerFactory INSTANCE = new CarbohydrateAnalyzerFactory(); | ||
} | ||
|
||
public static CarbohydrateAnalyzerFactory getInstance() { | ||
return SingletonHolder.INSTANCE; | ||
} | ||
@Override | ||
public CarbohydrateAnalyzer createAnalyzer(DailyMeal dailyMeal, Member member) { | ||
return new CarbohydrateAnalyzer(dailyMeal, member); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...rc/main/java/com/gaebaljip/exceed/application/domain/nutritionist/FatAnalyzerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public class FatAnalyzerFactory extends AbstractAnalyzerFactory { | ||
|
||
private FatAnalyzerFactory() { | ||
} | ||
|
||
private static class SingletonHolder{ | ||
private static final FatAnalyzerFactory INSTANCE = new FatAnalyzerFactory(); | ||
} | ||
|
||
public static FatAnalyzerFactory getInstance() { | ||
return SingletonHolder.INSTANCE; | ||
} | ||
|
||
@Override | ||
public FatAnalyzer createAnalyzer(DailyMeal dailyMeal, Member member) { | ||
return new FatAnalyzer(dailyMeal, member); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ain/java/com/gaebaljip/exceed/application/domain/nutritionist/ProteinAnalyzerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.gaebaljip.exceed.application.domain.nutritionist; | ||
|
||
import com.gaebaljip.exceed.application.domain.meal.DailyMeal; | ||
import com.gaebaljip.exceed.application.domain.member.Member; | ||
|
||
public class ProteinAnalyzerFactory extends AbstractAnalyzerFactory { | ||
|
||
private ProteinAnalyzerFactory() { | ||
} | ||
|
||
private static class SingletonHolder{ | ||
private static final ProteinAnalyzerFactory INSTANCE = new ProteinAnalyzerFactory(); | ||
} | ||
|
||
public static ProteinAnalyzerFactory getInstance() { | ||
return SingletonHolder.INSTANCE; | ||
} | ||
@Override | ||
public ProteinAnalyzer createAnalyzer(DailyMeal dailyMeal, Member member) { | ||
return new ProteinAnalyzer(dailyMeal, member); | ||
} | ||
} |