View Javadoc

1   /*
2    ORG Usurper is a random value object generator library 
3    Copyright (C) 2007  Pierre-Antoine Grégoire
4    
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9    
10   This library is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   Lesser General Public License for more details.
14   
15   You should have received a copy of the GNU Lesser General Public
16   License along with this library; if not, write to the Free Software
17   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18   */
19  package org.org.usurper.setup;
20  
21  import java.util.Map;
22  
23  import org.org.usurper.handlers.IHandler;
24  import org.org.usurper.handlers.basic.AbstractPropertyTypeHandler;
25  import org.org.usurper.handlers.basic.AbstractSpecificPropertyHandler;
26  import org.org.usurper.handlers.basic.ArrayHandler;
27  import org.org.usurper.handlers.basic.EnumHandler;
28  import org.org.usurper.model.ITargetDefinition;
29  import org.org.usurper.model.PropertyTypeDefinition;
30  import org.org.usurper.model.SpecificPropertyDefinition;
31  import org.org.usurper.setup.constants.OnMissingHandlers;
32  import org.org.usurper.setup.constants.PropertyWritingMechanism;
33  /**
34   * This is the interface for the setup of the behavior of the UsurperGenerator.<br>
35   * 
36   * @author pagregoire
37   */
38  public interface IUsurperGeneratorSetup {
39      
40      /**
41       * Gets the property type handlers map.
42       * @return the property type handlers map
43       */
44      public abstract Map<PropertyTypeDefinition, AbstractPropertyTypeHandler> getPropertyTypeHandlersMap();
45  
46      /**
47       * Gets the specific property handlers map.
48       * @return the specific property handlers map
49       */
50      public abstract Map<SpecificPropertyDefinition, AbstractSpecificPropertyHandler> getSpecificPropertyHandlersMap();
51  
52      /**
53       * Gets the array handler.
54       * @return the array handler
55       */
56      public abstract ArrayHandler getArrayHandler();
57  
58      /**
59       * Gets the enum handler.
60       * @return the enum handler
61       */
62      public abstract EnumHandler getEnumHandler();
63  
64      /**
65       * Gets the on missing handlers behavior.
66       * @return the on missing handlers
67       */
68      public abstract OnMissingHandlers getOnMissingHandlers();
69  
70      /**
71       * Gets the property writing mechanism behavior.
72       * 
73       * @return the property writing mechanism
74       */
75      public abstract PropertyWritingMechanism getPropertyWritingMechanism();
76  
77      /**
78       * Gets the count callback.
79       * 
80       * @return the count callback
81       */
82      public abstract ICountCallback getCountCallback();
83  
84      /**
85       * Gets all handlers.
86       * 
87       * @return the all handlers
88       */
89      public Map<ITargetDefinition, IHandler> getAllHandlers();
90  
91      /**
92       * This method tests if a handler is registered for a given Java Type.
93       * 
94       * @param propertyTypeDefinition the property type definition
95       * 
96       * @return true if one is registered, false otherwise
97       */
98      public boolean hasPropertyTypeHandler(PropertyTypeDefinition propertyTypeDefinition);
99  
100     /**
101      * This method retrieves the Handler for Properties of a given java type.
102      * 
103      * @param propertyTypeDefinition the property type definition
104      * 
105      * @return the registered handler or null if none is defined.
106      */
107     public AbstractPropertyTypeHandler getPropertyTypeHandler(PropertyTypeDefinition propertyTypeDefinition);
108 
109     /**
110      * This method tests if a handler is registered for a given Property of a given Class.
111      * 
112      * @param specificPropertyDefinition the specific property definition
113      * 
114      * @return true if one is registered, false otherwise
115      */
116     public boolean hasSpecificPropertyHandler(SpecificPropertyDefinition specificPropertyDefinition);
117 
118     /**
119      * This method retrieves the Handler for a given Property of a given Class.
120      * 
121      * @param specificPropertyDefinition the specific property definition
122      * 
123      * @return the registered property handler or null if none is defined.
124      */
125     public AbstractSpecificPropertyHandler getSpecificPropertyHandler(SpecificPropertyDefinition specificPropertyDefinition);
126 
127     /**
128      * The implementation of this method must return a String representation of the setup.
129      * 
130      * @return the String representation of the setup.
131      */
132     public String toStringRepresentation();
133 }