| Classes in this File | Line Coverage | Branch Coverage | Complexity | |||||||
| Db2OOMapper |
|
| 0.0;0 |
| 1 | /* |
|
| 2 | * Copyright 2006 Outsource Cafe, Inc. |
|
| 3 | * |
|
| 4 | * Licensed under the Apache License, Version 2.0 (the 'License') |
|
| 5 | * you may not use this file except in compliance with the License. |
|
| 6 | * You may obtain a copy of the License at |
|
| 7 | * |
|
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 9 | * |
|
| 10 | * Unless required by applicable law or agreed to in writing, software |
|
| 11 | * distributed under the License is distributed on an 'AS IS' BASIS, |
|
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 13 | * See the License for the specific language governing permissions and |
|
| 14 | * limitations under the License. |
|
| 15 | */ |
|
| 16 | package org.javagen.revgen.mapping; |
|
| 17 | ||
| 18 | import org.javagen.agile.db.model.Cardinality; |
|
| 19 | import org.javagen.agile.db.model.Column; |
|
| 20 | import org.javagen.agile.db.model.FkConstraint; |
|
| 21 | import org.javagen.agile.db.model.Table; |
|
| 22 | import org.javagen.agile.oo.model.Class; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * @todo need to clean this up and finish concept |
|
| 26 | */ |
|
| 27 | public interface Db2OOMapper { |
|
| 28 | ||
| 29 | 5 | public enum ReferenceNamingStrategy { useTargetClass, useFkColumn, useFkConstraint }; |
| 30 | ||
| 31 | void setReferenceNamingStrategy(ReferenceNamingStrategy strategy); |
|
| 32 | ||
| 33 | /** |
|
| 34 | * Generate a property name from a column. |
|
| 35 | */ |
|
| 36 | String propertyNameSingular(Column column); |
|
| 37 | ||
| 38 | /** |
|
| 39 | * Generate a class name from a table. |
|
| 40 | */ |
|
| 41 | String classNameSingular(Table table); |
|
| 42 | ||
| 43 | /** |
|
| 44 | * Generate a property type from a column. |
|
| 45 | */ |
|
| 46 | String propertyType(Column column); |
|
| 47 | ||
| 48 | /** |
|
| 49 | * Generate a reference type from a foreign key constraint. |
|
| 50 | */ |
|
| 51 | Class referenceType(FkConstraint fkConstraint); |
|
| 52 | ||
| 53 | /** |
|
| 54 | * @return an abstract collection name: SET, LIST, MAP, BAG, etc. |
|
| 55 | * @see org.javagen.agile.oo.namaing.Collections |
|
| 56 | */ |
|
| 57 | String containerType(FkConstraint fkConstraint); |
|
| 58 | ||
| 59 | /** |
|
| 60 | * @return property name for reference. |
|
| 61 | */ |
|
| 62 | String referenceName(FkConstraint fkConstraint); |
|
| 63 | ||
| 64 | /** |
|
| 65 | * @return true if FK is not unique |
|
| 66 | */ |
|
| 67 | boolean isManyCardinality(FkConstraint fkConstraint); |
|
| 68 | ||
| 69 | /** |
|
| 70 | * @return cardinality based on FkConstraint. |
|
| 71 | */ |
|
| 72 | Cardinality determineCardinality(FkConstraint fkConstraint); |
|
| 73 | ||
| 74 | ||
| 75 | ||
| 76 | } |