public final class ByteBuddyCommons extends Object
Modifier and Type | Field and Description |
---|---|
static int |
FIELD_MODIFIER_MASK
A mask for modifiers that represents fields.
|
static int |
GENERAL_MODIFIER_MASK
A mask for modifiers that are represented by types and members.
|
static int |
MEMBER_MODIFIER_MASK
A mask for modifiers that represents type members.
|
static int |
METHOD_MODIFIER_MASK
A mask for modifiers that represents methods and constructors.
|
static int |
PARAMETER_MODIFIER_MASK
A mask for modifiers that represents method parameters.
|
static int |
TYPE_MODIFIER_MASK
A mask for modifiers that represents types.
|
static int |
VISIBILITY_MODIFIER_MASK
A mask for modifiers that represent a type's, method's or field's visibility.
|
Modifier and Type | Method and Description |
---|---|
static <T> List<T> |
filterUnique(List<? extends T> left,
List<? extends T> right)
Filters all values from the
right list and only includes them in the result of the left list
if they are not already present. |
static <T extends Collection<? extends GenericTypeDescription>> |
isActualType(T typeDescriptions)
Validates that a collection of types represents an actual type, i.e.
|
static <T extends GenericTypeDescription> |
isActualType(T typeDescription)
Validates that a type represents an actual type, i.e.
|
static <T extends Collection<? extends GenericTypeDescription>> |
isActualTypeOrVoid(T typeDescriptions)
Validates that a collection of types represents an actual type or
void , i.e. |
static <T extends GenericTypeDescription> |
isActualTypeOrVoid(T typeDescription)
Validates that a type represents an actual type or
void , i.e. |
static <T extends TypeDescription> |
isAnnotation(T typeDescription)
Validates that a type is an annotation type.
|
static <T extends TypeDescription> |
isDefineable(T typeDescription)
Validates that a type is defineable, i.e.
|
static <T extends Collection<?>> |
isEmpty(T collection,
String exceptionMessage)
Validates that a collection is empty.
|
static <T extends GenericTypeDescription> |
isExtendable(T typeDescription)
Validates that a type is extendable, i.e.
|
static <T extends Collection<? extends GenericTypeDescription>> |
isImplementable(T typeDescriptions)
Verifies that a collection of types can be implemented.
|
static <T extends GenericTypeDescription> |
isImplementable(T typeDescription)
Verifies that a type can be implemented.
|
static <T extends Collection<?>> |
isNotEmpty(T collection,
String exceptionMessage)
Validates that a collection is not empty.
|
static <T extends Collection<? extends GenericTypeDescription>> |
isThrowable(T typeDescriptions)
Validates that a collection of types only contains throwable types.
|
static <T extends GenericTypeDescription> |
isThrowable(T typeDescription)
Validates that a type is a throwable type.
|
static String |
isValidIdentifier(String identifier)
Validates that a string represents a valid Java identifier, i.e.
|
static String |
isValidTypeName(String typeName)
Validates a Java type name to be valid.
|
static <T> List<T> |
join(List<? extends T> leftList,
List<? extends T> rightList)
Joins two lists.
|
static <T> List<T> |
join(List<? extends T> list,
T element)
Creates a list that contains all elements of a given list with an additional appended element.
|
static <T> List<T> |
join(T element,
List<? extends T> list)
Creates a list that contains all elements of a given list with an additional prepended element.
|
static <T> List<T> |
joinUnique(List<? extends T> list,
T element)
Appends the given element to the list only if the element is not yet contained in the given list.
|
static <T extends GenericTypeDescription> |
joinUniqueRaw(Collection<? extends T> left,
Collection<? extends T> right)
Joins two collections where the left collection must only contain unique elements.
|
static <T> T |
nonNull(T value)
Validates that a value is not
null . |
static <T> T[] |
nonNull(T[] value)
Validates that no value of an array is
null . |
static int |
resolveModifierContributors(int mask,
ModifierContributor... modifierContributor)
Validates a mask against a number of modifier contributors and merges their contributions to a modifier.
|
static <T> List<T> |
toList(Collection<T> collection)
Converts a collection to a list, either by casting or by explicit conversion.
|
static <T> List<T> |
toList(Iterable<T> iterable)
Converts an iterable to a list, either by casting or by explicit conversion.
|
static <T extends Collection<?>> |
unique(T elements)
Validates that the given collection of elements is unique.
|
static <T extends Collection<? extends GenericTypeDescription>> |
uniqueRaw(T typeDescriptions)
Validates that a collection of generic type descriptions does not contain duplicate type erasure.
|
public static final int VISIBILITY_MODIFIER_MASK
public static final int GENERAL_MODIFIER_MASK
public static final int TYPE_MODIFIER_MASK
public static final int MEMBER_MODIFIER_MASK
public static final int FIELD_MODIFIER_MASK
public static final int METHOD_MODIFIER_MASK
public static final int PARAMETER_MODIFIER_MASK
public static <T> T nonNull(T value)
null
.T
- The type of the input value.value
- The input value to be validated.public static <T> T[] nonNull(T[] value)
null
.T
- The component type of the input value.value
- The input value to be validated.public static <T extends TypeDescription> T isAnnotation(T typeDescription)
T
- The type of the input value.typeDescription
- The type to validate.public static <T extends GenericTypeDescription> T isThrowable(T typeDescription)
T
- The type of the input value.typeDescription
- The type to validate.public static <T extends Collection<? extends GenericTypeDescription>> T isThrowable(T typeDescriptions)
T
- The type of the input value.typeDescriptions
- The types to validate.public static <T extends TypeDescription> T isDefineable(T typeDescription)
T
- The actual type of the validated instance.typeDescription
- The type to validate.public static <T extends GenericTypeDescription> T isExtendable(T typeDescription)
final
type.T
- The actual type of the validated instance.typeDescription
- The type to validate.public static <T extends GenericTypeDescription> T isImplementable(T typeDescription)
T
- The actual type of the input.typeDescription
- The type to verify.public static <T extends Collection<? extends GenericTypeDescription>> T isImplementable(T typeDescriptions)
T
- The actual type of the input.typeDescriptions
- The types to verify.public static <T extends GenericTypeDescription> T isActualType(T typeDescription)
void
.T
- The actual type of the argument.typeDescription
- The type to validate.public static <T extends Collection<? extends GenericTypeDescription>> T isActualType(T typeDescriptions)
void
.T
- The actual type of the argument.typeDescriptions
- The types to validate.public static <T extends GenericTypeDescription> T isActualTypeOrVoid(T typeDescription)
void
, i.e. not a wildcard.T
- The actual type of the argument.typeDescription
- The type to validate.public static <T extends Collection<? extends GenericTypeDescription>> T isActualTypeOrVoid(T typeDescriptions)
void
, i.e. not a wildcard.T
- The actual type of the argument.typeDescriptions
- The types to validate.public static <T extends Collection<?>> T unique(T elements)
T
- The actual type.elements
- The elements to validate for being unique.public static <T> List<T> join(List<? extends T> list, T element)
T
- The list's generic type.list
- The list of elements to be appended first.element
- The additional element.ArrayList
containing all elements.public static <T> List<T> join(T element, List<? extends T> list)
T
- The list's generic type.list
- The list of elements to be appended last.element
- The additional element.ArrayList
containing all elements.public static <T> List<T> join(List<? extends T> leftList, List<? extends T> rightList)
T
- The most specific common type of both lists.leftList
- The left list.rightList
- The right list.public static <T> List<T> filterUnique(List<? extends T> left, List<? extends T> right)
right
list and only includes them in the result of the left
list
if they are not already present.T
- The type of the list.left
- The left list which is not filtered.right
- The right list of which only elements are added if they are not present in the left list or the right list.public static <T> List<T> joinUnique(List<? extends T> list, T element)
T
- The type of the list.list
- The list of elements.element
- The element to append.public static <T extends Collection<? extends GenericTypeDescription>> T uniqueRaw(T typeDescriptions)
T
- The actual type of the argument.typeDescriptions
- The type descriptions to validate for being unique.public static <T extends GenericTypeDescription> List<T> joinUniqueRaw(Collection<? extends T> left, Collection<? extends T> right)
T
- The element type.left
- The left collection.right
- The right collection.public static String isValidIdentifier(String identifier)
identifier
- The identifier to validate.public static String isValidTypeName(String typeName)
typeName
- The suggested name.public static <T extends Collection<?>> T isNotEmpty(T collection, String exceptionMessage)
T
- The type of the collection.collection
- The collection to be validated.exceptionMessage
- The message of the exception that is thrown if the collection does not contain an element.public static <T extends Collection<?>> T isEmpty(T collection, String exceptionMessage)
T
- The type of the collection.collection
- The collection to be validated.exceptionMessage
- The message of the exception that is thrown if the collection does contain an element.public static int resolveModifierContributors(int mask, ModifierContributor... modifierContributor)
mask
- The mask to validate against.modifierContributor
- The modifier contributors to mergepublic static <T> List<T> toList(Collection<T> collection)
T
- The element type of the collection.collection
- The collection to convert to a list.public static <T> List<T> toList(Iterable<T> iterable)
T
- The element type of the collection.iterable
- The iterable to convert to a list.Copyright © 2014–2015. All rights reserved.