Class JKBaseModel

java.lang.Object
com.jk.core.jpa.JKBaseModel
All Implemented Interfaces:
Serializable

public class JKBaseModel extends Object implements Serializable
This class represents a base model class for MongoDB documents.

This class provides a foundation for entities with common properties.

Version:
1.0
Author:
Dr. Jalal H. Kiswani
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    This method constructs a new JKBaseModel with default properties.
    This method constructs a new JKBaseModel with the provided unique identifier (UID).
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Indicates whether some other object is "equal to" this one.
    Gets the name slug.
    static void
    main(String[] args)
    This main method prints this entity unique identifier (UID) in the console.
    void
    This method resets the unique identifier to this JKBaseModel.
    Returns a string representation of the object.
    <T> T
    This method sets the entity name to the specified name then return this JKBaseModel object.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • JKBaseModel

      public JKBaseModel()
      This method constructs a new JKBaseModel with default properties.
    • JKBaseModel

      public JKBaseModel(String uid)
      This method constructs a new JKBaseModel with the provided unique identifier (UID).
      Parameters:
      uid - Specifies the unique identifier (UID).
  • Method Details

    • getNameSlug

      public String getNameSlug()
      Gets the name slug.
      Returns:
      the name slug
    • equals

      public boolean equals(Object obj)
      Indicates whether some other object is "equal to" this one.

      The equals method implements an equivalence relation on non-null object references:

      • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
      • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
      • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
      • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
      • For any non-null reference value x, x.equals(null) should return false.

      An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

      Overrides:
      equals in class Object
      Parameters:
      obj - the reference object with which to compare.
      Returns:
      true if this object is the same as the obj argument; false otherwise.
    • toString

      public String toString()
      Returns a string representation of the object.
      Overrides:
      toString in class Object
      Returns:
      the string representation of the object.
    • main

      public static void main(String[] args)
      This main method prints this entity unique identifier (UID) in the console.
      Parameters:
      args - the command line arguments.
    • resetUid

      public void resetUid()
      This method resets the unique identifier to this JKBaseModel.

      If this entity represents list holder, then it resets the unique identifiers (UIDs), to all the items within it as well.

    • withName

      public <T> T withName(String name)
      This method sets the entity name to the specified name then return this JKBaseModel object.
      Type Parameters:
      T - Specifies the entity object type.
      Parameters:
      name - Specifies the new entity name.
      Returns:
      the entity object with the newly changed name.