- java.lang.Object
-
- de.carne.mcd.jvmdecoder.classfile.attribute.Attributes
-
public final class Attributes extends java.lang.ObjectUtility class providing Attribute related functions.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidprint(java.util.List<? extends Attribute> attributes, ClassPrinter out, ClassContext context)Prints a list of attributes.static voidprint(java.util.Optional<? extends Attribute> attribute, ClassPrinter out, ClassContext context)Prints an optional attributes.static <T extends Attribute>
java.util.List<T>resolveAttributes(java.util.List<Attribute> attributes, java.lang.Class<T> type)Resolves all attributes of a specific type.static <T extends Attribute>
java.util.Optional<T>resolveOptionalAttribute(java.util.List<Attribute> attributes, java.lang.Class<T> type)Resolves an optional attribute.static <T extends Attribute>
TresolveUniqueAttribute(java.util.List<Attribute> attributes, java.lang.Class<T> type)Resolves a unique attribute.
-
-
-
Method Detail
-
resolveAttributes
public static <T extends Attribute> java.util.List<T> resolveAttributes(java.util.List<Attribute> attributes, java.lang.Class<T> type)
Resolves all attributes of a specific type.- Type Parameters:
T- the actual attribute type to resolve.- Parameters:
attributes- the attribute list to examine.type- the attribute type to resolve.- Returns:
- the resolved list of attribute objects (may be empty).
-
resolveUniqueAttribute
public static <T extends Attribute> T resolveUniqueAttribute(java.util.List<Attribute> attributes, java.lang.Class<T> type) throws java.io.IOException
Resolves a unique attribute.- Type Parameters:
T- the actual attribute type to resolve.- Parameters:
attributes- the attribute list to examine.type- the attribute type to resolve.- Returns:
- the resolved attribute instance.
- Throws:
java.io.IOException- if the attribute does not exist or is not unique.
-
resolveOptionalAttribute
public static <T extends Attribute> java.util.Optional<T> resolveOptionalAttribute(java.util.List<Attribute> attributes, java.lang.Class<T> type) throws java.io.IOException
Resolves an optional attribute.- Type Parameters:
T- the actual attribute type to resolve.- Parameters:
attributes- the attribute list to examine.type- the attribute type to resolve.- Returns:
- the resolved attribute instance.
- Throws:
java.io.IOException- if the attribute is not unique.
-
print
public static void print(java.util.List<? extends Attribute> attributes, ClassPrinter out, ClassContext context) throws java.io.IOException
Prints a list of attributes.- Parameters:
attributes- the attributes to print.out- the ClassPrinter to print to.context- the ClassContext to use for printing.- Throws:
java.io.IOException- if an I/O error occurs.
-
print
public static void print(java.util.Optional<? extends Attribute> attribute, ClassPrinter out, ClassContext context) throws java.io.IOException
Prints an optional attributes.- Parameters:
attribute- the attributes to print.out- the ClassPrinter to print to.context- the ClassContext to use for printing.- Throws:
java.io.IOException- if an I/O error occurs.
-
-