Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pyknic
committed
Mar 10, 2015
1 parent
12c32a0
commit e3d450a
Showing
14 changed files
with
218 additions
and
133 deletions.
There are no files selected for viewing
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
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
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
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,10 @@ | |||
package com.speedment.orm.core.entity; | |||
|
|||
/** | |||
* | |||
* @author Emil Forslund | |||
*/ | |||
public interface Entity<PK> { | |||
|
|||
PK getPrimaryKey(); | |||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/speedment/orm/core/manager/AbstractManager.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,20 @@ | |||
package com.speedment.orm.core.manager; | |||
|
|||
import com.speedment.orm.config.model.Column; | |||
import com.speedment.orm.core.Buildable; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.concurrent.ConcurrentHashMap; | |||
|
|||
/** | |||
* | |||
* @author Emil Forslund | |||
*/ | |||
public abstract class AbstractManager<PK, ENTITY, BUILDER extends Buildable<ENTITY>> implements Manager<PK, ENTITY, BUILDER> { | |||
|
|||
private final Map<List<Column>, IndexHolder> indexes; | |||
|
|||
public AbstractManager() { | |||
indexes = new ConcurrentHashMap<>(); | |||
} | |||
} |
86 changes: 0 additions & 86 deletions
86
src/main/java/com/speedment/orm/core/manager/DefaultManager.java
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
src/main/java/com/speedment/orm/core/manager/EntityMapper.java
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
src/main/java/com/speedment/orm/core/manager/IndexHolder.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,18 @@ | |||
package com.speedment.orm.core.manager; | |||
|
|||
import java.util.stream.Stream; | |||
|
|||
/** | |||
* | |||
* @author Emil Forslund | |||
*/ | |||
public interface IndexHolder<KEY, ENTITY> { | |||
|
|||
Stream<ENTITY> stream(); | |||
|
|||
Stream<ENTITY> stream(KEY key); | |||
|
|||
void put(KEY key, ENTITY entity); | |||
|
|||
void remove(KEY key); | |||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/com/speedment/orm/core/manager/KeyIndexHolder.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,40 @@ | |||
package com.speedment.orm.core.manager; | |||
|
|||
import static com.speedment.util.stream.StreamUtil.streamOfNullable; | |||
import java.util.Map; | |||
import java.util.concurrent.ConcurrentHashMap; | |||
import java.util.stream.Stream; | |||
|
|||
/** | |||
* | |||
* @author Emil Forslund | |||
*/ | |||
public class KeyIndexHolder<KEY, ENTITY> implements IndexHolder<KEY, ENTITY> { | |||
|
|||
private final Map<KEY, ENTITY> entities; | |||
|
|||
public KeyIndexHolder() { | |||
entities = new ConcurrentHashMap<>(); | |||
} | |||
|
|||
@Override | |||
public Stream<ENTITY> stream() { | |||
return entities.values().stream(); | |||
} | |||
|
|||
@Override | |||
public Stream<ENTITY> stream(KEY key) { | |||
return streamOfNullable(entities.get(key)); | |||
} | |||
|
|||
@Override | |||
public void put(KEY key, ENTITY entity) { | |||
entities.put(key, entity); | |||
} | |||
|
|||
@Override | |||
public void remove(KEY key) { | |||
entities.remove(key); | |||
} | |||
|
|||
} |
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
Oops, something went wrong.