Class User

java.lang.Object
io.github.eggy03.ferrumx.windows.entity.user.User

@DeepImmutable public class User extends Object
Immutable representation of a user on a system. The service which retrieves this info is platform-agnostic.

Fields capture basic user information such as username, home directory, and user directory.

Usage examples

// Build a new User
User user = User.builder()
    .userName("john_doe")
    .userHome("C:\\Users\\john_doe")
    .userDirectory("C:\\Users\\john_doe\\Documents")
    .build();

// Create a modified copy using the builder
User updatedUser = user.toBuilder()
    .userName("jane_doe")
    .build();

Since:
2.0.0
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) @Nullable String
    Current working directory of the user.
    (package private) @Nullable String
    Fetches the user's home directory.
    (package private) @Nullable String
    Current username of the user behind this instance
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull String
    Retrieves the entity in a JSON pretty-print formatted string

    Methods inherited from class Object

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

    • userName

      @Nullable @Nullable String userName
      Current username of the user behind this instance
    • userHome

      @Nullable @Nullable String userHome
      Fetches the user's home directory. For more information on what the home directory could mean, check out the definitions provided by your OS.
    • userDirectory

      @Nullable @Nullable String userDirectory
      Current working directory of the user. This usually points to the directory where this library code exists.
  • Constructor Details

    • User

      public User()
  • Method Details

    • toString

      @NotNull public @NotNull String toString()
      Retrieves the entity in a JSON pretty-print formatted string
      Overrides:
      toString in class Object
      Returns:
      the String value of the object in JSON pretty-print format