01: /**
02: * Objective Database Abstraction Layer (ODAL)
03: * Copyright (c) 2004, The ODAL Development Group
04: * All rights reserved.
05: * For definition of the ODAL Development Group please refer to LICENCE.txt file
06: *
07: * Distributable under LGPL license.
08: * See terms of license at gnu.org.
09: */package com.completex.objective.components.persistency.rule.impl;
10:
11: import com.completex.objective.components.persistency.Record;
12:
13: /**
14: * @author Gennady Krizhevsky
15: */
16: public class RuleHelper {
17:
18: public static void assertIndex(Record record, int fieldIndex) {
19: if (fieldIndex >= record.size() || fieldIndex < 0) {
20: throw new IllegalArgumentException(
21: "fieldIndex >= size || fieldIndex < 0 : "
22: + fieldIndex);
23: }
24: }
25:
26: public static void assertRecordAndIndex(Record record,
27: int fieldIndex) {
28:
29: if (record == null) {
30: throw new IllegalArgumentException("Record is empty");
31: }
32:
33: if (fieldIndex >= record.size() || fieldIndex < 0) {
34: throw new IllegalArgumentException(
35: "fieldIndex >= size || fieldIndex < 0 : "
36: + fieldIndex);
37: }
38: }
39: }
|