Class EntityIdWithType

    • Constructor Detail

      • EntityIdWithType

        protected EntityIdWithType​(EntityId entityId)
    • Method Detail

      • createEqualityValidator

        @Deprecated
        public static <I extends EntityIdWithTypeConsumer<I> createEqualityValidator​(I expectedEntityId)
        Deprecated.
        as of 1.2.0 please use isCompatibleOrThrow(EntityIdWithType) instead.
        Creates an equality validator as Consumer accepting EntityIdWithType instances comparing them to the passed in expectedEntityId.

        When the entity IDs don't match, the an IllegalArgumentException will be thrown to the one providing the entity id to compare with.

        The equality validator will for NamespacedEntityIdWithType IDs compare equality of the IDs names excluding the namespace part as the namespace part might not yet be available.
        Type Parameters:
        I - the type of EntityIdWithType which may also be NamespacedEntityIdWithType.
        Parameters:
        expectedEntityId - the expected entity ID.
        Returns:
        a consumer accepting an instance of <I> which gets compared with expectedEntityId - if the IDs are not equal, an IllegalArgumentException will be thrown, if they are equal, no other side effect happens.
        Throws:
        NullPointerException - if expectedEntityId is null.
      • isCompatibleOrThrow

        public boolean isCompatibleOrThrow​(@Nullable
                                           EntityIdWithType otherEntityId)
        Checks if the passed entity ID is compatible with this entity ID. In the base implementation a given entity ID is compatible if a call of equals(Object) with that ID would yield true. Subclasses may implement a different behavior. Please have a look at the documentation of the subclass for further information.
        Parameters:
        otherEntityId - the entity ID to be compared for equality with this entity ID.
        Returns:
        true if otherEntityId is compatible with this entity ID.
        Throws:
        IllegalArgumentException - if otherEntityId is not compatible with this entity ID.
        Since:
        1.2.0
      • isDummy

        public boolean isDummy()
        Description copied from interface: EntityId
        Checks whether this ID acts as dummy ID. Dummy IDs should not be used as ID for any entity.
        Specified by:
        isDummy in interface EntityId
        Returns:
        true if this ID is a dummy ID, otherwise false.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object