Changes
Page history
Update Custom-Base-Entity.md
authored
Sep 29, 2023
by
Ticxo
Hide whitespace changes
Inline
Side-by-side
API/Advanced/Custom-Base-Entity.md
View page @
ea14ede6
WIP
Sometimes you are trying to apply a model to something that is not an entity, or you want something that is a bit more
\ No newline at end of file
complex than the default
`Dummy`
. You can wrap your custom target with
`BaseEntity`
class.
```
java
public
class
CustomBaseEntity
implements
BaseEntity
<
CustomTarget
>
{
@Getter
private
final
CustomTarget
original
;
public
CustomBaseEntity
(
CustomTarget
original
)
{
this
.
original
=
original
;
}
// Implement the rest of the methods
}
```
When it is time to add models to this custom target, we can do something similar to the
`Dummy`
method.
```
java
CustomBaseEntity
baseEntity
=
new
CustomBaseEntity
(
customTarget
);
ModeledEntity
modeledEntity
=
ModelEngineAPI
.
createModeledEntity
(
baseEntity
);
// The rest is exactly the same
```
\ No newline at end of file