Class MPackageDeclaration

java.lang.Object
com.io7m.montarre.api.MPackageDeclaration
All Implemented Interfaces:
MPackageDeclarationType

public final class MPackageDeclaration extends Object implements MPackageDeclarationType
A package.
  • Method Details

    • metadata

      public MMetadataType metadata()
      Specified by:
      metadata in interface MPackageDeclarationType
      Returns:
      The package metadata
    • manifest

      public MManifestType manifest()
      Specified by:
      manifest in interface MPackageDeclarationType
      Returns:
      The package manifest
    • withMetadata

      public final MPackageDeclaration withMetadata(MMetadataType value)
      Copy the current immutable object by setting a value for the metadata attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for metadata
      Returns:
      A modified copy of the this object
    • withManifest

      public final MPackageDeclaration withManifest(MManifestType value)
      Copy the current immutable object by setting a value for the manifest attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for manifest
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of MPackageDeclaration that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: metadata, manifest.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value MPackageDeclaration with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static MPackageDeclaration copyOf(MPackageDeclarationType instance)
      Creates an immutable copy of a MPackageDeclarationType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable MPackageDeclaration instance
    • builder

      public static MPackageDeclaration.Builder builder()
      Creates a builder for MPackageDeclaration.
       MPackageDeclaration.builder()
          .setMetadata(com.io7m.montarre.api.MMetadataType) // required metadata
          .setManifest(com.io7m.montarre.api.MManifestType) // required manifest
          .build();
       
      Returns:
      A new MPackageDeclaration builder