Class SampleParentModelObject

java.lang.Object
com.powerupsoftwareengineering.java.immutable.model.ModelObjectAbs
com.powerupsoftwareengineering.java.immutable.model.sample.SampleParentModelObject
All Implemented Interfaces:
com.powerupsoftwareengineering.java.immutable.model.ModelObject, Serializable
Direct Known Subclasses:
SampleChildModelObject

public abstract class SampleParentModelObject extends com.powerupsoftwareengineering.java.immutable.model.ModelObjectAbs
A SampleParentModelObject is a sample of a parent object that implements the immutable object pattern.

This object is immutable. To modify use the object's builder class. You can use the @{link Builder#copyValues} method to initialize the builder to the original values.

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The builder class provides the ability to populate all the values of a model object, validate if the model object content, and provide an immutable version of the model object.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The max length of the object's name.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Base constructor that will populate the SampleParentModelObject with the values from the provided builder.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    Accessor for the name member variable.
    int
     
     

    Methods inherited from class com.powerupsoftwareengineering.java.immutable.model.ModelObjectAbs

    getId

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • NAME_MAX_LENGTH

      public static final int NAME_MAX_LENGTH
      The max length of the object's name.
      See Also:
  • Constructor Details

    • SampleParentModelObject

      protected SampleParentModelObject(SampleParentModelObject.Builder<?> builder)
      Base constructor that will populate the SampleParentModelObject with the values from the provided builder. This method is protected to ensure that child classes can extend this class, but should not be called to instantiate the class.
      Parameters:
      builder - Fully populated builder that has been validated.
  • Method Details

    • getName

      public String getName()
      Accessor for the name member variable.
      Returns:
      Current value of the name member variable.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class com.powerupsoftwareengineering.java.immutable.model.ModelObjectAbs
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class com.powerupsoftwareengineering.java.immutable.model.ModelObjectAbs
    • toString

      public String toString()
      Overrides:
      toString in class com.powerupsoftwareengineering.java.immutable.model.ModelObjectAbs