1 23 24 29 30 package com.sun.jdo.spi.persistence.generator.database; 31 32 import java.text.MessageFormat ; 33 34 40 class DDLTemplateFormatter { 44 45 private static MessageFormat createTableStart = null; 46 47 48 private static MessageFormat alterTableAddConstraintStart = null; 49 50 51 private static MessageFormat alterTableDropConstraint = null; 52 53 54 private static MessageFormat primaryKeyConstraint = null; 55 56 57 private static MessageFormat foreignKeyConstraint = null; 58 59 60 private static MessageFormat dropTable = null; 61 62 63 66 private DDLTemplateFormatter() { 67 } 68 69 74 static void reset(MappingPolicy mappingPolicy) { 75 createTableStart = new MessageFormat ( 76 mappingPolicy.getCreateTableStart()); 77 78 alterTableAddConstraintStart = new MessageFormat ( 79 mappingPolicy.getAlterTableAddConstraintStart()); 80 81 alterTableDropConstraint = new MessageFormat ( 82 mappingPolicy.getAlterTableDropConstraint()); 83 84 primaryKeyConstraint = new MessageFormat ( 85 mappingPolicy.getPrimaryKeyConstraint()); 86 87 foreignKeyConstraint = new MessageFormat ( 88 mappingPolicy.getForeignKeyConstraint()); 89 90 dropTable = new MessageFormat ( 91 mappingPolicy.getDropTable()); 92 } 93 94 95 98 static String formatCreateTable(Object o) { 99 return createTableStart.format(o); 100 } 101 102 105 static String formatAlterTableAddConstraint(Object o) { 106 return alterTableAddConstraintStart.format(o); 107 } 108 109 112 static String formatAlterTableDropConstraint(Object o) { 113 return alterTableDropConstraint.format(o); 114 } 115 116 119 static String formatPKConstraint(Object o) { 120 return primaryKeyConstraint.format(o); 121 } 122 123 126 static String formatFKConstraint(Object o) { 127 return foreignKeyConstraint.format(o); 128 } 129 130 133 static String formatDropTable(Object o) { 134 return dropTable.format(o); 135 } 136 } 137 | Popular Tags |