abstractconfigintrospector.java
来自「RESIN 3.2 最新源码」· Java 代码 · 共 813 行 · 第 1/2 页
JAVA
813 行
EntityType type) { ArrayList<ForeignColumn> columns = new ArrayList<ForeignColumn>(); EntityType parentType = type; ArrayList<com.caucho.amber.table.AmberColumn> targetIdColumns; targetIdColumns = type.getId().getColumns(); while (targetIdColumns.size() == 0) { parentType = parentType.getParentType(); if (parentType == null) break; targetIdColumns = parentType.getId().getColumns(); } for (com.caucho.amber.table.AmberColumn key : targetIdColumns) { columns.add(mapTable.createForeignColumn(key.getName(), key)); } return columns; } static ArrayList<ForeignColumn> calculateColumns(com.caucho.amber.table.AmberTable mapTable, String prefix, EntityType type) { ArrayList<ForeignColumn> columns = new ArrayList<ForeignColumn>(); EntityType parentType = type; ArrayList<com.caucho.amber.table.AmberColumn> targetIdColumns; targetIdColumns = type.getId().getColumns(); while (targetIdColumns.size() == 0) { parentType = parentType.getParentType(); if (parentType == null) break; targetIdColumns = parentType.getId().getColumns(); } for (com.caucho.amber.table.AmberColumn key : targetIdColumns) { columns.add(mapTable.createForeignColumn(prefix + key.getName(), key)); } return columns; } protected static String loc(Method method) { return method.getDeclaringClass().getSimpleName() + "." + method.getName() + ": "; } protected static String loc(Field field) { return field.getDeclaringClass().getSimpleName() + "." + field.getName() + ": "; } public static String toSqlName(String name) { return name; // name.toUpperCase(); } class AnnotationConfig { private Annotation _annotation; private Object _config; public Annotation getAnnotation() { return _annotation; } public Object getConfig() { return _config; } public void setAnnotation(Annotation annotation) { _annotation = annotation; } public void setConfig(Object config) { _config = config; } public boolean isNull() { return (_annotation == null) && (_config == null); } public void reset() { _annotation = null; _config = null; } public void reset(Class type, Class cl) { _annotation = type.getAnnotation(cl); _config = null; } public void reset(AccessibleObject field, Class cl) { _annotation = field.getAnnotation(cl); _config = null; } public EmbeddableConfig getEmbeddableConfig() { return (EmbeddableConfig) _config; } public EntityConfig getEntityConfig() { return (EntityConfig) _config; } public MappedSuperclassConfig getMappedSuperclassConfig() { return (MappedSuperclassConfig) _config; } public EntityListenersConfig getEntityListenersConfig() { return (EntityListenersConfig) _config; } public TableConfig getTableConfig() { return (TableConfig) _config; } public SecondaryTableConfig getSecondaryTableConfig() { return (SecondaryTableConfig) _config; } public IdClassConfig getIdClassConfig() { return (IdClassConfig) _config; } public PostLoadConfig getPostLoadConfig() { return (PostLoadConfig) _config; } public PrePersistConfig getPrePersistConfig() { return (PrePersistConfig) _config; } public PostPersistConfig getPostPersistConfig() { return (PostPersistConfig) _config; } public PreUpdateConfig getPreUpdateConfig() { return (PreUpdateConfig) _config; } public PostUpdateConfig getPostUpdateConfig() { return (PostUpdateConfig) _config; } public PreRemoveConfig getPreRemoveConfig() { return (PreRemoveConfig) _config; } public PostRemoveConfig getPostRemoveConfig() { return (PostRemoveConfig) _config; } public InheritanceConfig getInheritanceConfig() { return (InheritanceConfig) _config; } public NamedQueryConfig getNamedQueryConfig() { return (NamedQueryConfig) _config; } public NamedNativeQueryConfig getNamedNativeQueryConfig() { return (NamedNativeQueryConfig) _config; } public SqlResultSetMappingConfig getSqlResultSetMappingConfig() { return (SqlResultSetMappingConfig) _config; } public PrimaryKeyJoinColumnConfig getPrimaryKeyJoinColumnConfig() { return (PrimaryKeyJoinColumnConfig) _config; } public DiscriminatorColumnConfig getDiscriminatorColumnConfig() { return (DiscriminatorColumnConfig) _config; } public IdConfig getIdConfig() { return (IdConfig) _config; } public EmbeddedIdConfig getEmbeddedIdConfig() { return (EmbeddedIdConfig) _config; } public ColumnConfig getColumnConfig() { return (ColumnConfig) _config; } public GeneratedValueConfig getGeneratedValueConfig() { return (GeneratedValueConfig) _config; } public BasicConfig getBasicConfig() { return (BasicConfig) _config; } public VersionConfig getVersionConfig() { return (VersionConfig) _config; } public ManyToOneConfig getManyToOneConfig() { return (ManyToOneConfig) _config; } public OneToOneConfig getOneToOneConfig() { return (OneToOneConfig) _config; } public ManyToManyConfig getManyToManyConfig() { return (ManyToManyConfig) _config; } public OneToManyConfig getOneToManyConfig() { return (OneToManyConfig) _config; } public MapKeyConfig getMapKeyConfig() { return (MapKeyConfig) _config; } public JoinTableConfig getJoinTableConfig() { return (JoinTableConfig) _config; } public JoinColumnConfig getJoinColumnConfig() { return (JoinColumnConfig) _config; } public AttributeOverrideConfig getAttributeOverrideConfig() { return (AttributeOverrideConfig) _config; } // public AttributeOverridesConfig getAttributeOverridesConfig() { // return (AttributeOverridesConfig) _config; // } public AssociationOverrideConfig getAssociationOverrideConfig() { return (AssociationOverrideConfig) _config; } // public AssociationOverridesConfig getAssociationOverridesConfig() { // return (AssociationOverridesConfig) _config; // } } static { // annotations allowed with a @Basic annotation _basicAnnotations.add("javax.persistence.Basic"); _basicAnnotations.add("javax.persistence.Column"); _basicAnnotations.add("javax.persistence.Enumerated"); _basicAnnotations.add("javax.persistence.Lob"); _basicAnnotations.add("javax.persistence.Temporal"); // non-serializable types allowed with a @Basic annotation _basicTypes.add("boolean"); _basicTypes.add("byte"); _basicTypes.add("char"); _basicTypes.add("short"); _basicTypes.add("int"); _basicTypes.add("long"); _basicTypes.add("float"); _basicTypes.add("double"); _basicTypes.add("[byte"); _basicTypes.add("[char"); _basicTypes.add("[java.lang.Byte"); _basicTypes.add("[java.lang.Character"); // annotations allowed with an @Id annotation _idAnnotations.add("javax.persistence.Column"); _idAnnotations.add("javax.persistence.GeneratedValue"); _idAnnotations.add("javax.persistence.Id"); _idAnnotations.add("javax.persistence.SequenceGenerator"); _idAnnotations.add("javax.persistence.TableGenerator"); _idAnnotations.add("javax.persistence.Temporal"); // allowed with a @Id annotation _idTypes.add("boolean"); _idTypes.add("byte"); _idTypes.add("char"); _idTypes.add("short"); _idTypes.add("int"); _idTypes.add("long"); _idTypes.add("float"); _idTypes.add("double"); _idTypes.add("java.lang.Boolean"); _idTypes.add("java.lang.Byte"); _idTypes.add("java.lang.Character"); _idTypes.add("java.lang.Short"); _idTypes.add("java.lang.Integer"); _idTypes.add("java.lang.Long"); _idTypes.add("java.lang.Float"); _idTypes.add("java.lang.Double"); _idTypes.add("java.lang.String"); _idTypes.add("java.util.Date"); _idTypes.add("java.sql.Date"); // annotations allowed with a @ManyToOne annotation _manyToOneAnnotations.add("javax.persistence.ManyToOne"); _manyToOneAnnotations.add("javax.persistence.JoinColumn"); _manyToOneAnnotations.add("javax.persistence.JoinColumns"); // annotations allowed with a @OneToMany annotation _oneToManyAnnotations.add("javax.persistence.OneToMany"); _oneToManyAnnotations.add("javax.persistence.JoinTable"); _oneToManyAnnotations.add("javax.persistence.MapKey"); _oneToManyAnnotations.add("javax.persistence.OrderBy"); // types allowed with a @OneToMany annotation _oneToManyTypes.add("java.util.Collection"); _oneToManyTypes.add("java.util.List"); _oneToManyTypes.add("java.util.Set"); _oneToManyTypes.add("java.util.Map"); // annotations allowed with a @ManyToMany annotation _manyToManyAnnotations.add("javax.persistence.ManyToMany"); _manyToManyAnnotations.add("javax.persistence.JoinTable"); _manyToManyAnnotations.add("javax.persistence.MapKey"); _manyToManyAnnotations.add("javax.persistence.OrderBy"); // types allowed with a @ManyToMany annotation _manyToManyTypes.add("java.util.Collection"); _manyToManyTypes.add("java.util.List"); _manyToManyTypes.add("java.util.Set"); _manyToManyTypes.add("java.util.Map"); // annotations allowed with a @OneToOne annotation _oneToOneAnnotations.add("javax.persistence.OneToOne"); _oneToOneAnnotations.add("javax.persistence.JoinColumn"); _oneToOneAnnotations.add("javax.persistence.JoinColumns"); // annotations allowed with a @ElementCollection annotation _elementCollectionAnnotations.add("javax.persistence.ElementCollection"); // types allowed with an @ElementCollection annotation _elementCollectionTypes.add("java.util.Collection"); _elementCollectionTypes.add("java.util.List"); _elementCollectionTypes.add("java.util.Set"); _elementCollectionTypes.add("java.util.Map"); // annotations allowed with a @Embedded annotation _embeddedAnnotations.add("javax.persistence.Embedded"); _embeddedAnnotations.add("javax.persistence.AttributeOverride"); _embeddedAnnotations.add("javax.persistence.AttributeOverrides"); _embeddedAnnotations.add("javax.persistence.Column"); // annotations allowed with a @EmbeddedId annotation _embeddedIdAnnotations.add("javax.persistence.EmbeddedId"); _embeddedIdAnnotations.add("javax.persistence.AttributeOverride"); _embeddedIdAnnotations.add("javax.persistence.AttributeOverrides"); // annotations allowed for a property _propertyAnnotations.add("javax.persistence.Basic"); _propertyAnnotations.add("javax.persistence.Column"); _propertyAnnotations.add("javax.persistence.Id"); _propertyAnnotations.add("javax.persistence.Transient"); _propertyAnnotations.add("javax.persistence.OneToOne"); _propertyAnnotations.add("javax.persistence.ManyToOne"); _propertyAnnotations.add("javax.persistence.OneToMany"); _propertyAnnotations.add("javax.persistence.ManyToMany"); _propertyAnnotations.add("javax.persistence.JoinColumn"); _propertyAnnotations.add("javax.persistence.Embedded"); _propertyAnnotations.add("javax.persistence.EmbeddedId"); _propertyAnnotations.add("javax.persistence.Version"); // annotations allowed with a @Version annotation _versionAnnotations.add("javax.persistence.Version"); _versionAnnotations.add("javax.persistence.Column"); _versionAnnotations.add("javax.persistence.Temporal"); // types allowed with a @Version annotation _versionTypes.add("short"); _versionTypes.add("int"); _versionTypes.add("long"); _versionTypes.add("java.lang.Short"); _versionTypes.add("java.lang.Integer"); _versionTypes.add("java.lang.Long"); _versionTypes.add("java.sql.Timestamp"); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?