Skip to content

Identifier restricted to String or UUID #358

@dschulten

Description

@dschulten

I have experimented with an Integer as Identifier:


public class Thing
    implements AggregateRoot<Thing, ThingIdentifier> {

  @Id private Thingdentifier id;

  public record ThingIdentifier(Integer id) implements Identifier, Serializable {
    public static ThingIdentifier of(Integer id) {
      return new ThingIdentifier(id);
    }
  }
}

PrimitivesToIdentifierConverter and IdentifierToPrimitivesConverter only appear to accept String and UUID:

private static final Set<Class<?>> DEFAULT_PRIMITIVES = new HashSet<>(Arrays.asList(String.class, UUID.class));

What is the reason that an Integer is not an accepted identifier? Is it possible to use an Integer wrapped into an Identifier?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions