Version 4.10.0

Package hirondelle.web4j.model

Tools for building business domain Model Objects (MOs).

See:
          Description

Interface Summary
ConvertParam Convert request parameters into common 'building block' objects.
ConvertParamError Instructs WEB4J how to respond to any errors found during parsing of raw user input into 'base' types such as Integer, Date, and so on.
MessageList List of AppResponseMessage objects to be shown to the user.
Validator Validate a field in a Model Object.
 

Class Summary
AppResponseMessage Informative message presented to the end user.
Check Returns commonly needed Validator objects.
Code An item in a code table.
ConvertParamImpl Default implementation of ConvertParam.
DateTime Building block class for an immutable date-time, with no time zone.
Decimal Represent an immutable number, using a natural, compact syntax.
Id Building block class for identifiers.
MessageListImpl General implementation of MessageList.
ModelFromRequest Parse a set of request parameters into a Model Object.
ModelUtil Collected utilities for overriding Object.toString(), Object.equals(java.lang.Object), and Object.hashCode(), and implementing Comparable.
 

Enum Summary
DateTime.DayOverflow Policy for treating 'day-of-the-month overflow' conditions encountered during some date calculations.
DateTime.Unit The seven parts of a DateTime object.
ModelUtil.NullsGo Define hows null items are treated in a comparison.
 

Exception Summary
AppException Base class for most exceptions defined by WEB4J.
BadRequestException Thrown by ApplicationFirewall when a problem with an incoming HTTP request is detected.
ModelCtorException Thrown when a Model Object (MO) cannot be constructed because of invalid constructor arguments.
 

Package hirondelle.web4j.model Description

Tools for building business domain Model Objects (MOs).

The important things about Model Objects in WEB4J are :

Restrictions on Model Objects

These are the restrictions on Model Objects in WEB4J :

These items can be added to Model Objects, if desired, but they are never used by WEB4J :

Validation

Validation in Model Objects is always in the constructor, and can usually be implemented using the Check class, which provides commonly needed implementions of the Validator interface. When a problem occurs, an error message is added to ModelCtorException, for later presentation to the user.

Object Methods

It is highly recommended that all Model Objects override equals, hashCode, and toString. (ModelUtil can help you implement these methods.)

Building Model Objects

In general, there are two sources for the data attached to Model Objects : manual entry by the end user, and the database. It is interesting that both of these sources should be treated as unreliable. Incoming HTTP request parameters are not constrained, and must always be aggressively validated on the server. Databases are independent servers, and cannot be assumed to be 'owned' by the application. Other applications and processes can interact with the data as well. Thus, an application cannot, in general, make any assumptions regarding the content of the database.

Thus, a Model Object must allow for all possible input when creating objects from both these sources.

WEB4J has two main tools for this task :

Both of these tools are simple to use because they use effective ordering conventions for data.


Version 4.10.0

Copyright Hirondelle Systems. Published October 19, 2013 - User Guide - All Docs.