|
| 1 | +package example.entity; |
| 2 | + |
| 3 | +import java.util.ArrayList; |
| 4 | +import java.util.Collections; |
| 5 | +import java.util.HashMap; |
| 6 | +import java.util.List; |
| 7 | +import java.util.Map; |
| 8 | +import java.util.function.BiFunction; |
| 9 | +import javax.annotation.Generated; |
| 10 | +import org.seasar.doma.internal.jdbc.scalar.BasicScalar; |
| 11 | +import org.seasar.doma.jdbc.entity.AbstractEntityType; |
| 12 | +import org.seasar.doma.jdbc.entity.EntityPropertyType; |
| 13 | +import org.seasar.doma.jdbc.entity.GeneratedIdPropertyType; |
| 14 | +import org.seasar.doma.jdbc.entity.NamingType; |
| 15 | +import org.seasar.doma.jdbc.entity.PostDeleteContext; |
| 16 | +import org.seasar.doma.jdbc.entity.PostInsertContext; |
| 17 | +import org.seasar.doma.jdbc.entity.PostUpdateContext; |
| 18 | +import org.seasar.doma.jdbc.entity.PreDeleteContext; |
| 19 | +import org.seasar.doma.jdbc.entity.PreInsertContext; |
| 20 | +import org.seasar.doma.jdbc.entity.PreUpdateContext; |
| 21 | +import org.seasar.doma.jdbc.entity.Property; |
| 22 | +import org.seasar.doma.jdbc.entity.TenantIdPropertyType; |
| 23 | +import org.seasar.doma.jdbc.entity.VersionPropertyType; |
| 24 | +import org.seasar.doma.jdbc.id.BuiltinIdentityIdGenerator; |
| 25 | +import org.seasar.doma.wrapper.IntegerWrapper; |
| 26 | + |
| 27 | +@Generated("") |
| 28 | +public class _AutoIncrement extends AbstractEntityType<AutoIncrement> { |
| 29 | + |
| 30 | + private static final _AutoIncrement singleton = new _AutoIncrement(); |
| 31 | + |
| 32 | + private final NamingType __namingType = NamingType.NONE; |
| 33 | + |
| 34 | + public final GeneratedIdPropertyType<AutoIncrement, Integer, Integer> id = |
| 35 | + new GeneratedIdPropertyType<>( |
| 36 | + AutoIncrement.class, |
| 37 | + () -> new BasicScalar<>(IntegerWrapper::new), |
| 38 | + "id", |
| 39 | + "ID", |
| 40 | + __namingType, |
| 41 | + false, |
| 42 | + new BuiltinIdentityIdGenerator()); |
| 43 | + |
| 44 | + private final String __name = "AutoIncrement"; |
| 45 | + |
| 46 | + private final String __catalogName = null; |
| 47 | + |
| 48 | + private final String __schemaName = null; |
| 49 | + |
| 50 | + private final String __tableName = ""; |
| 51 | + |
| 52 | + private final List<EntityPropertyType<AutoIncrement, ?>> __idPropertyTypes; |
| 53 | + |
| 54 | + private final List<EntityPropertyType<AutoIncrement, ?>> __entityPropertyTypes; |
| 55 | + |
| 56 | + private final Map<String, EntityPropertyType<AutoIncrement, ?>> __entityPropertyTypeMap; |
| 57 | + |
| 58 | + private _AutoIncrement() { |
| 59 | + List<EntityPropertyType<AutoIncrement, ?>> __idList = new ArrayList<>(); |
| 60 | + __idList.add(id); |
| 61 | + __idPropertyTypes = Collections.unmodifiableList(__idList); |
| 62 | + List<EntityPropertyType<AutoIncrement, ?>> __list = new ArrayList<>(); |
| 63 | + __list.add(id); |
| 64 | + __entityPropertyTypes = Collections.unmodifiableList(__list); |
| 65 | + Map<String, EntityPropertyType<AutoIncrement, ?>> __map = new HashMap<>(); |
| 66 | + __map.put("id", id); |
| 67 | + __entityPropertyTypeMap = Collections.unmodifiableMap(__map); |
| 68 | + } |
| 69 | + |
| 70 | + @Override |
| 71 | + public boolean isImmutable() { |
| 72 | + return false; |
| 73 | + } |
| 74 | + |
| 75 | + @Override |
| 76 | + public AutoIncrement newEntity(Map<String, Property<AutoIncrement, ?>> args) { |
| 77 | + AutoIncrement entity = new AutoIncrement(); |
| 78 | + args.values().forEach(v -> v.save(entity)); |
| 79 | + return entity; |
| 80 | + } |
| 81 | + |
| 82 | + @Override |
| 83 | + public Class<AutoIncrement> getEntityClass() { |
| 84 | + return AutoIncrement.class; |
| 85 | + } |
| 86 | + |
| 87 | + @Override |
| 88 | + public String getName() { |
| 89 | + return __name; |
| 90 | + } |
| 91 | + |
| 92 | + @Override |
| 93 | + public List<EntityPropertyType<AutoIncrement, ?>> getEntityPropertyTypes() { |
| 94 | + return __entityPropertyTypes; |
| 95 | + } |
| 96 | + |
| 97 | + @Override |
| 98 | + public EntityPropertyType<AutoIncrement, ?> getEntityPropertyType(String propertyName) { |
| 99 | + return __entityPropertyTypeMap.get(propertyName); |
| 100 | + } |
| 101 | + |
| 102 | + @Override |
| 103 | + public void saveCurrentStates(AutoIncrement __entity) {} |
| 104 | + |
| 105 | + @Override |
| 106 | + public AutoIncrement getOriginalStates(AutoIncrement entity) { |
| 107 | + return null; |
| 108 | + } |
| 109 | + |
| 110 | + @Override |
| 111 | + public GeneratedIdPropertyType<AutoIncrement, ?, ?> getGeneratedIdPropertyType() { |
| 112 | + return id; |
| 113 | + } |
| 114 | + |
| 115 | + @Override |
| 116 | + public VersionPropertyType<AutoIncrement, ?, ?> getVersionPropertyType() { |
| 117 | + return null; |
| 118 | + } |
| 119 | + |
| 120 | + @Override |
| 121 | + public TenantIdPropertyType<AutoIncrement, ?, ?> getTenantIdPropertyType() { |
| 122 | + return null; |
| 123 | + } |
| 124 | + |
| 125 | + @Override |
| 126 | + public List<EntityPropertyType<AutoIncrement, ?>> getIdPropertyTypes() { |
| 127 | + return __idPropertyTypes; |
| 128 | + } |
| 129 | + |
| 130 | + @Override |
| 131 | + public void preInsert(AutoIncrement entity, PreInsertContext<AutoIncrement> context) {} |
| 132 | + |
| 133 | + @Override |
| 134 | + public void preUpdate(AutoIncrement entity, PreUpdateContext<AutoIncrement> context) {} |
| 135 | + |
| 136 | + @Override |
| 137 | + public void preDelete(AutoIncrement entity, PreDeleteContext<AutoIncrement> context) {} |
| 138 | + |
| 139 | + @Override |
| 140 | + public void postInsert(AutoIncrement entity, PostInsertContext<AutoIncrement> context) {} |
| 141 | + |
| 142 | + @Override |
| 143 | + public void postUpdate(AutoIncrement entity, PostUpdateContext<AutoIncrement> context) {} |
| 144 | + |
| 145 | + @Override |
| 146 | + public void postDelete(AutoIncrement entity, PostDeleteContext<AutoIncrement> context) {} |
| 147 | + |
| 148 | + @Override |
| 149 | + public String getCatalogName() { |
| 150 | + return __catalogName; |
| 151 | + } |
| 152 | + |
| 153 | + @Override |
| 154 | + public String getSchemaName() { |
| 155 | + return __schemaName; |
| 156 | + } |
| 157 | + |
| 158 | + @Override |
| 159 | + @Deprecated |
| 160 | + public String getTableName() { |
| 161 | + return getTableName((namingType, text) -> namingType.apply(text)); |
| 162 | + } |
| 163 | + |
| 164 | + @Override |
| 165 | + public String getTableName(BiFunction<NamingType, String, String> namingFunction) { |
| 166 | + if (__tableName.isEmpty()) { |
| 167 | + return namingFunction.apply(getNamingType(), getName()); |
| 168 | + } |
| 169 | + return __tableName; |
| 170 | + } |
| 171 | + |
| 172 | + @Override |
| 173 | + public NamingType getNamingType() { |
| 174 | + return __namingType; |
| 175 | + } |
| 176 | + |
| 177 | + @Override |
| 178 | + public boolean isQuoteRequired() { |
| 179 | + return false; |
| 180 | + } |
| 181 | + |
| 182 | + public static _AutoIncrement getSingletonInternal() { |
| 183 | + return singleton; |
| 184 | + } |
| 185 | +} |
0 commit comments