01: /*
02: * $Header: /cvsroot/jvalidate/jvalidate-framework/jvalidate/src/test/java/nl/knowlogy/validation/test/Shop.java,v 1.3 2007/03/24 17:17:56 roberthofstra Exp $
03: * $Revision: 1.3 $
04: * $Date: 2007/03/24 17:17:56 $
05: *
06: *
07: * Created on Oct 6, 2004
08: *
09: * All right reserved(c) 2004, Knowlogy
10: *
11: * Copyright 2004 - 2005 Knowlogy, the Netherlands. All rights reserved.
12: * All Knowlogy brand and product names are trademarks or registered trademarks
13: * of Knowlogy in the Netherlands and other countries.
14: *
15: * No part of this publication may be reproduced, transmitted, stored in a retrieval system,
16: * or translated into any human or computer language, in any form, or by any means, electronic,
17: * mechanical, magnetic, optical, chemical, manual, or otherwise,
18: * without the prior written permission of the copyright owner, Knowlogy.
19: *
20: */
21: package nl.knowlogy.validation.test;
22:
23: import java.util.Vector;
24:
25: import nl.knowlogy.validation.Messages;
26:
27: /**
28: *
29: * @validate.class
30: *
31: * @author Robert
32: */
33: public class Shop {
34:
35: private String name;
36:
37: private Vector customers = new Vector();
38:
39: private static final ShopClassValidator shopClassValidator = new ShopClassValidator();
40:
41: /**
42: * @return Returns the name.
43: */
44: public String getName() {
45: return name;
46: }
47:
48: /**
49: * @validate.length value="20"
50: * @validate.notnull
51: *
52: * @param name The name to set.
53: */
54: public void setName(String name) {
55: this .name = name;
56: }
57:
58: public void validate(Messages errors) {
59: shopClassValidator.validate(this , errors);
60: }
61:
62: public void addCustomer(Customer customer) {
63: customers.add(customer);
64: }
65:
66: /**
67: * @validate.isvalid
68: *
69: * @return customers
70: */
71: public Customer[] getCustomers() {
72: return (Customer[]) customers.toArray(new Customer[customers
73: .size()]);
74: }
75:
76: }
|