concept utility in category liferay

appears as: utilities, utility, utility
Liferay in Action: The Official Guide to Liferay Portal Development

This is an excerpt from Manning's book Liferay in Action: The Official Guide to Liferay Portal Development.

As far as standards go, Liferay is also based on widely used, standard ways of doing things. It adheres to the JSR-286 portlet standard. In addition to that, it includes utilities such as Service Builder to automatically generate interfaces to databases (something not covered by the standard). Under the hood, Service Builder is just Spring and Hibernate—widely used by Java developers everywhere. You get the benefit of using the platform to get your site done more quickly while taking advantage of standards that keep your code free.

Liferay includes a utility that can perform field validation. Rather than writing something yourself or using a framework, you can use Liferay’s utility to easily validate the data your users enter. Often this utility is much easier to use than what comes with a particular framework—especially if you’re learning the framework for the first time. It can be used for any portlet, whether you’re using a framework or not.

Liferay’s utility is the com.liferay.portalkernel.util.Validator class. You create a separate Validator class for your portlet that contains validation logic for all the objects you want to persist to the database. You’ve already seen this class in use in the addProduct method. The following listing contains the method you call to validate the product coming from the form.