Package org.djutils.reflection
Class FieldSignature
- java.lang.Object
-
- org.djutils.reflection.FieldSignature
-
- All Implemented Interfaces:
Serializable
public class FieldSignature extends Object implements Serializable
A field descriptor represents the type of a class, instance, or local variable. It is a series of characters generated by the grammar described at The Java Virtual Machine class File Format .Copyright (c) 2002-2023 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
- Author:
- Peter Jacobs, Niels Lang, Alexander Verbraeck
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FieldSignature(Class<?> clazz)
constructs a new FieldSignature.FieldSignature(String value)
constructs a new FieldSignature.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<?>
getClassValue()
String
getStringValue()
static Class<?>
toClass(String descriptor)
converts a fieldDescriptor to its class representation.static String
toDescriptor(Class<?> clazz)
converts a field to its descriptor.static String
toDescriptor(Class<?>[] classes)
converts an array of fields to its descriptor.String
toString()
-
-
-
Method Detail
-
getStringValue
public String getStringValue()
- Returns:
- Returns the value of the field descriptor
-
getClassValue
public Class<?> getClassValue() throws ClassNotFoundException
- Returns:
- Returns the value of the field descriptor
- Throws:
ClassNotFoundException
- if the class cannot be found.
-
toDescriptor
public static final String toDescriptor(Class<?>[] classes)
converts an array of fields to its descriptor.- Parameters:
classes
- Class<?>[]; the classes to represent- Returns:
- String the descriptor String
-
toDescriptor
public static final String toDescriptor(Class<?> clazz)
converts a field to its descriptor.- Parameters:
clazz
- Class<?>; the clazz to represent- Returns:
- String the descriptor String
-
toClass
public static final Class<?> toClass(String descriptor) throws ClassNotFoundException
converts a fieldDescriptor to its class representation.- Parameters:
descriptor
- String; the descriptor- Returns:
- Class the class
- Throws:
ClassNotFoundException
- on failure
-
-