Access (boolean accessedForReading, boolean accessedForWriting) { if (accessedForReading && accessedForWriting) { return Access.ReadWrite; } else if (accessedForReading) { return Access.Read; } else if (accessedForWriting) { return Access.Write; } else { throw new IllegalArgumentException("At least one of 'accessedForReading' or 'accessedForWriting' must be 'true'"); } }