Package com.jk.core.jpa
Class JKBaseModel
java.lang.Object
com.jk.core.jpa.JKBaseModel
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionThis method constructs a newJKBaseModel
with default properties.JKBaseModel
(String uid) This method constructs a newJKBaseModel
with the provided unique identifier (UID). -
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates whether some other object is "equal to" this one.Gets the name slug.static void
This main method prints this entity unique identifier (UID) in the console.void
resetUid()
This method resets the unique identifier to thisJKBaseModel
.toString()
Returns a string representation of the object.<T> T
This method sets the entity name to the specified name then return thisJKBaseModel
object.
-
Constructor Details
-
JKBaseModel
public JKBaseModel()This method constructs a newJKBaseModel
with default properties. -
JKBaseModel
This method constructs a newJKBaseModel
with the provided unique identifier (UID).- Parameters:
uid
- Specifies the unique identifier (UID).
-
-
Method Details
-
getNameSlug
Gets the name slug.- Returns:
- the name slug
-
equals
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 returntrue
. - It is symmetric: for any non-null reference values
x
andy
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any non-null reference values
x
,y
, andz
, ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
. - It is consistent: for any non-null reference values
x
andy
, multiple invocations ofx.equals(y)
consistently returntrue
or consistently returnfalse
, provided no information used inequals
comparisons on the objects is modified. - For any non-null reference value
x
,x.equals(null)
should returnfalse
.
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.
- It is reflexive: for any non-null reference value
-
toString
Returns a string representation of the object. -
main
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 thisJKBaseModel
.If this entity represents list holder, then it resets the unique identifiers (UIDs), to all the items within it as well.
-
withName
This method sets the entity name to the specified name then return thisJKBaseModel
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.
-