java.lang.Object
com.github.ushiosan23.jvm.io.PrintUtils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDetermine the type of collection and how it will be printed. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanChecks if the object has the default "toString" method.toClassString(@NotNull Class<?> cls, boolean verbose) Classobject string representationtoCollectionString(@NotNull Collection<?> obj, boolean verbose, @NotNull PrintUtils.CollectionType type, boolean verboseItems) Collectionobject string representation.toCollectionString(Collection<?> obj, boolean verbose) Collectionobject string representation.toEntryString(Map.Entry<?, ?> obj, boolean verbose) Map.Entryobject string representation.toMapString(@NotNull Map<?, ?> obj, boolean verbose) Mapobject string representation.toRawString(@NotNull Object obj, boolean verbose) Any object string representation.Manages the printing process of an object.Manages the printing process of an object.
-
Method Details
-
isToStringOverwritten
Checks if the object has the default "toString" method.Note: This method is quite slow when parsing many objects, so it is recommended to use it only in necessary places.
- Parameters:
obj- The object to analyze- Returns:
- Returns
trueif the object has aObject.toString()method of its own, orfalseif it has the default behavior.
-
toString
@Contract(pure=true) @NotNull public static @NotNull String toString(@Nullable @Nullable Object obj, boolean verbose) Manages the printing process of an object. This in order to have an informative and clean way of displaying objects and avoid the default method that can be confusing when debugging.- Parameters:
obj- The object to analyzeverbose- Determines whether the printer should be wide or short- Returns:
- Returns the representation of the object in text
-
toString
@Contract(pure=true) @NotNull public static @NotNull String toString(@Nullable @Nullable Object obj) Manages the printing process of an object. This in order to have an informative and clean way of displaying objects and avoid the default method that can be confusing when debugging.- Parameters:
obj- The object to analyze- Returns:
- Returns the representation of the object in text
-
toClassString
@NotNull public static @NotNull String toClassString(@NotNull @NotNull Class<?> cls, boolean verbose) Classobject string representation- Parameters:
cls- The class to convertverbose- Determines if the result is going to be verbose or simple- Returns:
- Returns the object string representation
-
toCollectionString
@NotNull public static @NotNull String toCollectionString(@NotNull @NotNull Collection<?> obj, boolean verbose, @NotNull @NotNull PrintUtils.CollectionType type, boolean verboseItems) Collectionobject string representation. Method used for any object that implements theCollectioninterface commonly used for any collection of objects.- Parameters:
obj- The collection to convertverbose- Determines if the result is going to be verbose or simpletype- The type of collection to generate.verboseItems- Property that determines whether each object in the collection will be presented verbose or simply.- Returns:
- Returns the object string representation
-
toCollectionString
Collectionobject string representation. Method used for any object that implements theCollectioninterface commonly used for any collection of objects.- Parameters:
obj- The collection to convertverbose- Determines if the result is going to be verbose or simple- Returns:
- Returns the object string representation
-
toMapString
Mapobject string representation.- Parameters:
obj- The map to convertverbose- Determines if the result is going to be verbose or simple- Returns:
- Returns the object string representation
-
toEntryString
Map.Entryobject string representation.- Parameters:
obj- The entry to convertverbose- Determines if the result is going to be verbose or simple- Returns:
- Returns the object string representation
-
toRawString
Any object string representation.- Parameters:
obj- The object to convertverbose- Determines if the result is going to be verbose or simple- Returns:
- Returns the object string representation
-