Package org.jboss.weld.util.reflection
Class Formats
java.lang.Object
org.jboss.weld.util.reflection.Formats
Utility class to produce friendly names e.g. for debugging
- Author:
- Pete Muir, Nicklas Karlsson, Jozef Hartinger
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringaddSpaceIfNeeded(String string) static Stringstatic StringformatActualTypeArguments(Type[] actualTypeArguments) static StringformatActualTypeArguments(Type[] actualTypeArguments, boolean simpleNames) static StringformatAnnotatedConstructor(jakarta.enterprise.inject.spi.AnnotatedConstructor<?> constructor) static StringformatAnnotatedField(jakarta.enterprise.inject.spi.AnnotatedField<?> field) static StringformatAnnotatedMethod(jakarta.enterprise.inject.spi.AnnotatedMethod<?> method) static StringformatAnnotatedParameter(jakarta.enterprise.inject.spi.AnnotatedParameter<?> parameter) static StringformatAnnotatedType(jakarta.enterprise.inject.spi.AnnotatedType<?> type) static StringformatAnnotations(Annotation[] annotations) Gets a string representation from an array of annotationsstatic StringformatAnnotations(Iterable<Annotation> annotations) static StringformatAsFormalParameterList(Iterable<? extends jakarta.enterprise.inject.spi.AnnotatedParameter<?>> parameters, boolean belongsToMethodInEnum) static StringformatAsStackTraceElement(jakarta.enterprise.inject.spi.InjectionPoint ij) See also WELD-1454.static StringformatAsStackTraceElement(Member member) static StringformatBusinessInterfaceDescriptors(Iterable<? extends org.jboss.weld.ejb.spi.BusinessInterfaceDescriptor<?>> businessInterfaceDescriptors) static StringformatInjectionPointType(Type type) static StringformatModifiers(int modifiers) static StringformatParameter(jakarta.enterprise.inject.spi.AnnotatedParameter<?> parameter) static StringformatSimpleClassName(Class<?> javaClass) static StringformatSimpleClassName(Object object) static StringformatType(Type baseType) static StringformatType(Type baseType, boolean simpleNames) static <D extends GenericDeclaration>
StringformatTypeParameters(TypeVariable<D>[] typeParams) static StringformatTypes(Iterable<? extends Type> baseTypes) static StringformatTypes(Iterable<? extends Type> baseTypes, boolean simpleNames) static intgetLineNumber(Member member) Try to get the line number associated with the given member.static StringAttempts to extract a name of a missing class loader dependency from an exception such asNoClassDefFoundErrororClassNotFoundException.static Stringstatic Stringversion()static Stringstatic StringwrapIfNecessary(String string, String prepend, String append)
-
Method Details
-
formatAsStackTraceElement
See also WELD-1454.- Parameters:
ij-- Returns:
- the formatted string
-
formatAsStackTraceElement
-
getLineNumber
Try to get the line number associated with the given member. The reflection API does not expose such an info and so we need to analyse the bytecode. Unfortunately, it seems there is no way to get this kind of information for fields. Moreover, theLineNumberTableattribute is just optional, i.e. the compiler is not required to store this information at all. See also Java Virtual Machine Specification Implementation note: it wouldn't be appropriate to add a bytecode scanning dependency just for this functionality, therefore Apache BCEL included in Oracle JDK 1.5+ and OpenJDK 1.6+ is used. Other JVMs should not crash as we only use it if it's on the classpath and by means of reflection calls.- Parameters:
member-- Returns:
- the line number or 0 if it's not possible to find it
-
formatInjectionPointType
-
formatType
-
formatType
-
formatTypes
-
formatTypes
-
formatBusinessInterfaceDescriptors
-
addSpaceIfNeeded
-
formatAsFormalParameterList
-
formatParameter
-
formatModifiers
-
formatActualTypeArguments
-
formatActualTypeArguments
-
formatActualTypeArguments
-
wrapIfNecessary
-
formatAnnotations
-
formatAnnotations
Gets a string representation from an array of annotations- Parameters:
annotations- The annotations- Returns:
- The string representation
-
version
- Returns:
- the formatted version
-
getSimpleVersion
- Returns:
- a simple version string, i.e. no formatting is applied
-
version
-
formatSimpleClassName
-
formatSimpleClassName
-
formatAnnotatedType
-
formatAnnotatedConstructor
public static String formatAnnotatedConstructor(jakarta.enterprise.inject.spi.AnnotatedConstructor<?> constructor) -
formatAnnotatedField
-
formatAnnotatedMethod
-
formatAnnotatedParameter
public static String formatAnnotatedParameter(jakarta.enterprise.inject.spi.AnnotatedParameter<?> parameter) -
getNameOfMissingClassLoaderDependency
Attempts to extract a name of a missing class loader dependency from an exception such asNoClassDefFoundErrororClassNotFoundException. -
formatTypeParameters
public static <D extends GenericDeclaration> String formatTypeParameters(TypeVariable<D>[] typeParams)
-