public final class Entities extends Object
Modifier and Type | Method and Description |
---|---|
static <T> Function<Entity,T> |
attributeValueFunction(TypedName<T> name) |
static EntityBuilder |
copyBuilder(Entity e)
Create a new entity builder that is initialized with a copy of an entity.
|
static Entity |
create(EntityType type,
long id)
Create a new bare entity.
|
static Function<EntityType,String> |
entityTypeNameFunction()
Function that returns entity types’ names.
|
static Function<Entity,EntityType> |
extractType()
Function that extracts an entity’s type.
|
static KeyExtractor<Entity> |
idKeyExtractor()
Key extractor that keys entities by ID.
|
static Ordering<Entity> |
idOrdering()
Return an ordering over entities that sorts them by ID.
|
static Predicate<Entity> |
idPredicate(long id)
Create a predicate that filters events for an ID.
|
static EntityBuilder |
newBuilder(EntityType type)
Create a new basic entity builder.
|
static EntityBuilder |
newBuilder(EntityType type,
long id)
Create a new basic entity builder.
|
static <E extends Entity> |
project(Entity e,
Class<E> viewClass)
Project an entity to a target view type.
|
static <E extends Entity> |
projection(Class<E> viewClass)
Create a projection function that maps entities to a new view.
|
static Predicate<Entity> |
typePredicate(EntityType type)
Create a predicate that filters events for an entity type.
|
public static Entity create(EntityType type, long id)
Create a new bare entity.
type
- The bare entity.id
- The entity ID.public static EntityBuilder newBuilder(EntityType type)
Create a new basic entity builder.
type
- The entity type.public static EntityBuilder newBuilder(EntityType type, long id)
Create a new basic entity builder.
id
- The entity ID.public static EntityBuilder copyBuilder(Entity e)
Create a new entity builder that is initialized with a copy of an entity.
e
- The entity.e
.public static Predicate<Entity> typePredicate(EntityType type)
Create a predicate that filters events for an entity type.
type
- The entity type.type
.public static Predicate<Entity> idPredicate(long id)
Create a predicate that filters events for an ID.
id
- The ID sought.id
.public static Ordering<Entity> idOrdering()
Return an ordering over entities that sorts them by ID.
public static KeyExtractor<Entity> idKeyExtractor()
Key extractor that keys entities by ID.
public static Function<Entity,EntityType> extractType()
Function that extracts an entity’s type.
public static <T> Function<Entity,T> attributeValueFunction(TypedName<T> name)
public static Function<EntityType,String> entityTypeNameFunction()
Function that returns entity types’ names.
public static <E extends Entity> E project(@Nonnull Entity e, @Nonnull Class<E> viewClass)
Project an entity to a target view type.
e
- The entity to project.viewClass
- The view type.E
- The view type.