« Return to Thread: upgrading

Re: upgrading

by Charles Harvey III :: Rate this Message:

Reply to Author | View in Thread

As far as your own tools goes, I want to make sure I've got it right:

Old:
-------------------------------------------------------------
public class MyTool implements ViewTool
{
    private String theString;

    public void init( Object o )
    {
        if( !( obj instanceof ViewContext ) )
        {
            throw new IllegalArgumentException( "Tool can only be
initialized with a ViewContext" );
        }
    }

    public String getTheString()
    {
        return "this string comes from a velocity tool";
    }
}
-------------------------------------------------------------


New:
-------------------------------------------------------------
public class MyTool
{
    private String theString;

    public void init( Object o )
    {
        if( !( obj instanceof ViewContext ) )
        {
            throw new IllegalArgumentException( "Tool can only be
initialized with a ViewContext" );
        }
    }

    public String getTheString()
    {
        return "this string comes from a velocity tool";
    }
}
-------------------------------------------------------------


Do I still need the init method?  Or can I skip that too?

Thanks.


Charlie





Nathan Bubna said the following on 4/1/2008 1:06 PM:

> there are some issues with multi-line comments within macros in Velocity 1.5
>
> if you have written your own custom tools, then you'll find the
> ViewTool and Configurable interfaces have been axed in VelocityTools
> 1.4.  just remove the implements declarations for those interfaces.
> they are unnecessary, as Tools 1.4 will automatically look for their
> methods in any tool class.  if you haven't written any tools of your
> own, i don't think there's anything to be concerned about.
>
> that's all i can think of right now, but of course, feel free to ask
> questions/report problems here.
>
> On Tue, Apr 1, 2008 at 8:49 AM, Glenn Holmer <gholmer@...> wrote:
>  
>> I'm doing maintenance on an app that uses Velocity 1.4 and VelocityTools
>>  1.1, and would like to upgrade to Velocity 1.5 and tools 1.4.  Are there
>>  any gotchas I should watch out for?
>>
>>  --
>>  ____________________________________________________________
>>  Glenn Holmer                          gholmer@...
>>  Software Engineer                        phone: 414-908-1809
>>  Weyco Group, Inc.                          fax: 414-908-1601
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: user-unsubscribe@...
>>  For additional commands, e-mail: user-help@...
>>
>>
>>    
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>
>
>  

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...

 « Return to Thread: upgrading

LightInTheBox - Buy quality products at wholesale price