It prevents primitives from being auto-boxed in a Number object. Common usage
would be static import of the methods in this class, so the class name is not
visible in the code.
The code then looks like
logger.debug("...{}", box(3.14));
Which communicates to the reader that we are manually wrapping the primitive
into an object instead of auto-boxing. Hence the "box" method name. It's also
really short which is important.
The class name Unbox again is a nice short name that reminds users this class
helps prevent auto-boxing.
It is in the util package but is intended for use by users, so this class
should actually not be "considered private".
Sent from my iPhone
> On 2016/05/30, at 3:58, Gary Gregory <[email protected]> wrote:
>
> Why is it called Unbox? Seems like a misleading and confusing name when all
> the methods are called "box"! "Boxer" might be better.
>
> Gary
>
>> On Thu, May 26, 2016 at 6:32 PM, Gary Gregory <[email protected]> wrote:
>> There are no callers of the method within Log4j ATM.
>>
>> Gary
>>
>>> On Thu, May 26, 2016 at 6:20 PM, Remko Popma <[email protected]> wrote:
>>> Where is this method used?
>>> It is intended to allow the caller to find out if the specified
>>> StringBuilder instance is managed by Unbox.
>>>
>>> Sent from my iPhone
>>>
>>>> On 2016/05/27, at 9:50, Gary Gregory <[email protected]> wrote:
>>>>
>>>> Ok, so let's drop it from master. I'm AFK ATM.
>>>>
>>>> Gary
>>>>
>>>>> On May 26, 2016 12:26 PM, "Matt Sicker" <[email protected]> wrote:
>>>>> Most of the classes in that package start with the italicized words
>>>>> Consider this class private.
>>>>>
>>>>>> On 26 May 2016 at 14:19, Gary Gregory <[email protected]> wrote:
>>>>>>> On Thu, May 26, 2016 at 11:36 AM, Matt Sicker <[email protected]> wrote:
>>>>>>> Everything in that util package is log4j-private, so there's no worries
>>>>>>> about removing things.
>>>>>>
>>>>>> Ah, yes, now I see:
>>>>>>
>>>>>> "Internal utility classes for the Log4j 2 API. Note that the use of any
>>>>>> classes in this package is not supported. There are no guarantees for
>>>>>> binary or logical compatibility in this package."
>>>>>>
>>>>>> I wonder if we should *bold* some of that text.
>>>>>>
>>>>>> Gary
>>>>>>
>>>>>>>
>>>>>>>> On 26 May 2016 at 12:13, Gary Gregory <[email protected]> wrote:
>>>>>>>> The method:
>>>>>>>>
>>>>>>>> org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)
>>>>>>>>
>>>>>>>> is unused and undocumented. Can we drop it?
>>>>>>>>
>>>>>>>> I guess it's already in the 2.6 RC1, which is too bad.
>>>>>>>>
>>>>>>>> Gary
>>>>>>>>
>>>>>>>> --
>>>>>>>> E-Mail: [email protected] | [email protected]
>>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>>> JUnit in Action, Second Edition
>>>>>>>> Spring Batch in Action
>>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>>> Home: http://garygregory.com/
>>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Matt Sicker <[email protected]>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> E-Mail: [email protected] | [email protected]
>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>> JUnit in Action, Second Edition
>>>>>> Spring Batch in Action
>>>>>> Blog: http://garygregory.wordpress.com
>>>>>> Home: http://garygregory.com/
>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Matt Sicker <[email protected]>
>>
>>
>>
>> --
>> E-Mail: [email protected] | [email protected]
>> Java Persistence with Hibernate, Second Edition
>> JUnit in Action, Second Edition
>> Spring Batch in Action
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>
>
>
> --
> E-Mail: [email protected] | [email protected]
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory