You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Simone Tripodi <si...@apache.org> on 2011/09/20 17:16:00 UTC

[functor] Utility classes should not have a public or default constructor.

Hi all guys,
there are classes in [functor] that are affected by the checkstyle
violation as reported in the subject.
That behavior is expected by design, as reported in the comment below

    /**
     * <p>{@code EachElement} instances should NOT be constructed in
     * standard programming. Instead, the methods of the class should be invoked
     * statically.</p>
     *
     * <p>This constructor is public to permit tools that require a JavaBean
     * instance to operate.</p>
     */

I can not immagine a scenario where classes with static methods only
would require to be instantiated, AFAIK static method should be
invoked only by static reference - even the compiler allows the
invocation from an instance - so my questions is: can you please
provide me an explanation why that should be wished? I'm asking
because I was ready to drop that contructors, but before finding
myself in the position of rolling-back... :P

Follow below the list of affected classes.
Thanks in advance, have a nice day!
Simo

org.apache.commons.functor.core.LeftIdentity
org.apache.commons.functor.core.RightIdentity
org.apache.commons.functor.core.composite.Composite
org.apache.commons.functor.core.composite.Conditional
org.apache.commons.functor.generator.util.EachElement

http://people.apache.org/~simonetripodi/
http://www.99soft.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [functor] Utility classes should not have a public or default constructor.

Posted by Matt Benson <gu...@gmail.com>.
On Tue, Sep 20, 2011 at 10:16 AM, Simone Tripodi
<si...@apache.org> wrote:
> Hi all guys,
> there are classes in [functor] that are affected by the checkstyle
> violation as reported in the subject.
> That behavior is expected by design, as reported in the comment below
>
>    /**
>     * <p>{@code EachElement} instances should NOT be constructed in
>     * standard programming. Instead, the methods of the class should be invoked
>     * statically.</p>
>     *
>     * <p>This constructor is public to permit tools that require a JavaBean
>     * instance to operate.</p>
>     */
>
> I can not immagine a scenario where classes with static methods only
> would require to be instantiated, AFAIK static method should be
> invoked only by static reference - even the compiler allows the
> invocation from an instance - so my questions is: can you please
> provide me an explanation why that should be wished? I'm asking
> because I was ready to drop that contructors, but before finding
> myself in the position of rolling-back... :P

Simo:
  See the various class comments for e.g. [lang] *Utils classes:  in
some contexts you might be using a tool that can only make static
calls by performing them against bean instances.

Matt

>
> Follow below the list of affected classes.
> Thanks in advance, have a nice day!
> Simo
>
> org.apache.commons.functor.core.LeftIdentity
> org.apache.commons.functor.core.RightIdentity
> org.apache.commons.functor.core.composite.Composite
> org.apache.commons.functor.core.composite.Conditional
> org.apache.commons.functor.generator.util.EachElement
>
> http://people.apache.org/~simonetripodi/
> http://www.99soft.org/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org