Package net.neoforged.elc.attributes
Record Class MapAttribute
java.lang.Object
java.lang.Record
net.neoforged.elc.attributes.MapAttribute
- Record Components:
key- The E-Attribute key attribute.data- The internal map representing this E-Attribute.
- All Implemented Interfaces:
Map<String,,EValue<?>> EAttribute
public record MapAttribute(String key, Map<String,EValue<?>> data)
extends Record
implements EAttribute, Map<String,EValue<?>>
A Map Attribute represents the E-Attribute type
mapAttribute.
Due to limitations set by Eclipse, the serialized form must be a string-keyed map of strings.- Implementation Note:
- Do not rename
datatovalues, as it will shadowMap.values().
-
Nested Class Summary
-
Constructor Summary
ConstructorsConstructorDescriptionMapAttribute(String key) Constructs aMapAttributebacked by an emptyHashMap.MapAttribute(String key, Map<String, EValue<?>> data) Creates an instance of aMapAttributerecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) data()Returns the value of thedatarecord component.entrySet()final booleanIndicates whether some other object is "equal to" this one.EValue<?>final inthashCode()Returns a hash code value for this object.booleanisEmpty()key()Returns the value of thekeyrecord component.keySet()EValue<?>voidEValue<?>intsize()final StringtoString()Returns a string representation of this record class.Collection<EValue<?>>values()voidwrite(XMLStreamWriter writer, XMLOutputFactory outputFactory) Writes this E-Attribute to an XML stream.Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
MapAttribute
Constructs aMapAttributebacked by an emptyHashMap.- Parameters:
key- The key of the E-Attribute.
-
MapAttribute
Creates an instance of aMapAttributerecord class.
-
-
Method Details
-
write
Description copied from interface:EAttributeWrites this E-Attribute to an XML stream.- Specified by:
writein interfaceEAttribute- Throws:
XMLStreamException
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceMap<String,EValue<?>>
-
containsValue
- Specified by:
containsValuein interfaceMap<String,EValue<?>>
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
key
Returns the value of thekeyrecord component.- Specified by:
keyin interfaceEAttribute- Returns:
- the value of the
keyrecord component
-
data
Returns the value of thedatarecord component.- Returns:
- the value of the
datarecord component
-