MutableUserStyle

public final class MutableUserStyle implements Iterable


A mutable UserStyle. This must be converted back to a UserStyle by calling toUserStyle.

Summary

Public methods

final UserStyleSetting.Option

Returns the UserStyleSetting.Option for settingId if there is one or null otherwise.

final UserStyleSetting.Option

Returns the UserStyleSetting.Option for setting if there is one or null otherwise.

final int

The number of entries in the style.

@NonNull Iterator<@NonNull Map.Entry<@NonNull UserStyleSetting, @NonNull UserStyleSetting.Option>>

Iterator over the elements of the user style.

final void
set(
    @NonNull UserStyleSetting.Id settingId,
    @NonNull UserStyleSetting.Option.Id optionId
)

Sets the UserStyleSetting.Option for the setting with the given settingId to the option with the given optionId.

final void
set(
    @NonNull UserStyleSetting.Id settingId,
    @NonNull UserStyleSetting.Option option
)

Sets the UserStyleSetting.Option for the setting with the given settingId to the given option.

final void
set(
    @NonNull UserStyleSetting setting,
    @NonNull UserStyleSetting.Option.Id optionId
)

Sets the UserStyleSetting.Option for setting to the option with the given optionId.

final void
set(
    @NonNull UserStyleSetting setting,
    @NonNull UserStyleSetting.Option option
)

Sets the UserStyleSetting.Option for setting to the given option.

@NonNull String
final @NonNull UserStyle

Converts this instance to an immutable UserStyle with the same mapping.

Public methods

get

Added in 1.0.0
public final UserStyleSetting.Option get(@NonNull UserStyleSetting.Id settingId)

Returns the UserStyleSetting.Option for settingId if there is one or null otherwise. Note this is an O(n) operation.

get

Added in 1.0.0
public final UserStyleSetting.Option get(@NonNull UserStyleSetting setting)

Returns the UserStyleSetting.Option for setting if there is one or null otherwise.

getSize

Added in 1.0.0
public final int getSize()

The number of entries in the style.

iterator

Added in 1.0.0
public @NonNull Iterator<@NonNull Map.Entry<@NonNull UserStyleSetting, @NonNull UserStyleSetting.Option>> iterator()

Iterator over the elements of the user style.

set

Added in 1.0.0
public final void set(
    @NonNull UserStyleSetting.Id settingId,
    @NonNull UserStyleSetting.Option.Id optionId
)

Sets the UserStyleSetting.Option for the setting with the given settingId to the option with the given optionId.

Throws
kotlin.IllegalArgumentException

if settingId is not in the schema or if optionId is unrecognized.

set

Added in 1.0.0
public final void set(
    @NonNull UserStyleSetting.Id settingId,
    @NonNull UserStyleSetting.Option option
)

Sets the UserStyleSetting.Option for the setting with the given settingId to the given option.

Parameters
@NonNull UserStyleSetting.Id settingId

The UserStyleSetting.Id of the UserStyleSetting we're setting the option for, must be in the schema.

@NonNull UserStyleSetting.Option option

the UserStyleSetting.Option we're setting. Must be a valid option for settingId.

Throws
kotlin.IllegalArgumentException

if settingId is not in the schema or if option is invalid for settingId.

set

Added in 1.0.0
public final void set(
    @NonNull UserStyleSetting setting,
    @NonNull UserStyleSetting.Option.Id optionId
)

Sets the UserStyleSetting.Option for setting to the option with the given optionId.

Parameters
@NonNull UserStyleSetting setting

The UserStyleSetting we're setting the optionId for, must be in the schema.

@NonNull UserStyleSetting.Option.Id optionId

the UserStyleSetting.Option.Id for the UserStyleSetting.Option we're setting.

Throws
kotlin.IllegalArgumentException

if setting is not in the schema or if optionId is unrecognized.

set

Added in 1.0.0
public final void set(
    @NonNull UserStyleSetting setting,
    @NonNull UserStyleSetting.Option option
)

Sets the UserStyleSetting.Option for setting to the given option.

Parameters
@NonNull UserStyleSetting setting

The UserStyleSetting we're setting the option for, must be in the schema.

@NonNull UserStyleSetting.Option option

the UserStyleSetting.Option we're setting. Must be a valid option for setting.

Throws
kotlin.IllegalArgumentException

if setting is not in the schema or if option is invalid for setting.

toString

public @NonNull String toString()

toUserStyle

Added in 1.0.0
public final @NonNull UserStyle toUserStyle()

Converts this instance to an immutable UserStyle with the same mapping.