@NotThreadSafe public class KeyedGroups extends KeyedValues
Extends KeyedValues to allow a hierarchy of KeyedValues.
Modifier and Type | Field and Description |
---|---|
static KeyedGroups |
MISSING_KEYED_GROUP
Missing keyed groups.
|
static KeyedGroups[] |
NO_KEYED_GROUPS
No keyed groups.
|
ANONYMOUS, HASH_LOAD_FACTOR, MAP_ENTRY_COMPARATOR
Modifier | Constructor and Description |
---|---|
|
KeyedGroups()
Constructs an instance.
|
protected |
KeyedGroups(KeyedGroups other)
Constructs an instance from an other.
|
protected |
KeyedGroups(String type,
Optional<String> name)
Constructs an instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addAll(KeyedGroups keyedGroups)
Adds all entries from an other KeyedGroups.
|
void |
addGroup(String key,
KeyedGroups properties)
Adds a group of keyed groups.
|
void |
clear()
Clears the dictionary.
|
boolean |
containsGroupKey(String key)
Asks if the key is associated with a group.
|
KeyedGroups |
copy()
Creates a copy of this.
|
boolean |
equals(Object other) |
KeyedGroups |
freeze()
Freezes this.
|
KeyedGroups |
frozen()
Returns a frozen copy of this.
|
KeyedGroups |
getGroup(String key)
Gets a group of keyed values.
|
KeyedGroups[] |
getGroups(String key)
Gets the groups for the specified key.
|
Set<Map.Entry<String,List<Object>>> |
getGroupsEntries()
Gets the set of group entries for readonly access.
|
Set<String> |
getGroupsKeys()
Gets the set of keys for the groups.
|
int |
getGroupsSize()
Gets the size of the groups map.
|
protected KeyedGroups |
getMissingGroup()
Gets the missing group.
|
Optional<String> |
getName()
Gets the name.
|
protected KeyedGroups[] |
getNoGroups()
Gets no groups.
|
int |
hashCode() |
boolean |
isEmpty()
Asks if this is empty.
|
boolean |
isMissing()
Asks if this is the missing group.
|
void |
removeGroup(String key)
Removes a group.
|
void |
setGroup(String key,
KeyedGroups properties)
Sets a group.
|
void |
setValue(String key,
Object value)
Sets a keyed value.
|
KeyedGroups |
thawed()
Returns a thawed instance of this.
|
Map<String,String> |
toPropertiesMap()
Returns the first value for each key in a properties map.
|
add, addAll, addObject, areValuesHidden, checkNotFrozen, containsValueKey, getBoolean, getBoolean, getBoolean, getClassDef, getClassDef, getClassDefs, getDouble, getElapsed, getInt, getInteger, getLong, getLong, getObject, getObjects, getPassword, getString, getString, getStrings, getThisLogger, getType, getValues, getValuesEntries, getValuesKeys, getValuesSize, hashCapacity, isFrozen, isHidden, isMultiple, removeValue, setHidden, setObjects, setValuesHidden, substitute, toString
public static final KeyedGroups MISSING_KEYED_GROUP
public static final KeyedGroups[] NO_KEYED_GROUPS
public KeyedGroups()
protected KeyedGroups(@Nonnull KeyedGroups other)
other
- The other instance.protected KeyedGroups(@Nonnull String type, @Nonnull Optional<String> name)
type
- A string identifying the type of value stored.name
- The optional name for the properties as a group.public final void addAll(@Nonnull KeyedGroups keyedGroups)
The new values and groups are appended to those already present.
keyedGroups
- The other keyed groups.public void addGroup(@Nonnull String key, @Nonnull KeyedGroups properties)
If the key is already in the dictionary, the group is appended to the list of groups for that key.
If the key is null, the effect is the same as addAll(org.rvpf.base.util.container.KeyedGroups)
.
key
- The name of the group.properties
- The keyed groups.public final void clear()
clear
in class KeyedValues
@CheckReturnValue public boolean containsGroupKey(@Nonnull String key)
key
- The key to look for.public KeyedGroups copy()
copy
in class KeyedValues
public boolean equals(Object other)
equals
in class KeyedValues
public KeyedGroups freeze()
freeze
in class KeyedValues
public KeyedGroups frozen()
frozen
in class KeyedValues
@Nonnull @CheckReturnValue public KeyedGroups getGroup(@Nonnull String key)
key
- The name of the group.@Nonnull @CheckReturnValue public KeyedGroups[] getGroups(@Nonnull String key)
key
- The groups name.@Nonnull @CheckReturnValue public final Set<Map.Entry<String,List<Object>>> getGroupsEntries()
@Nonnull @CheckReturnValue public final Set<String> getGroupsKeys()
@CheckReturnValue public int getGroupsSize()
public final Optional<String> getName()
public int hashCode()
hashCode
in class KeyedValues
public boolean isEmpty()
isEmpty
in class KeyedValues
@CheckReturnValue public boolean isMissing()
public final void removeGroup(@Nonnull String key)
key
- The name of the group.public final void setGroup(@Nonnull String key, @Nonnull KeyedGroups properties)
key
- The name of the group.properties
- The group.public void setValue(String key, Object value)
If the key is already in the dictionary, its value is replaced.
setValue
in class KeyedValues
key
- The value key.value
- The value.public KeyedGroups thawed()
thawed
in class KeyedValues
@Nonnull @CheckReturnValue public final Map<String,String> toPropertiesMap()
@Nonnull @CheckReturnValue protected KeyedGroups getMissingGroup()
@Nonnull @CheckReturnValue protected KeyedGroups[] getNoGroups()
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.