1 21 package oracle.toplink.essentials.internal.ejb.cmp3.metadata.columns; 23 24 import javax.persistence.DiscriminatorType; 25 import javax.persistence.DiscriminatorColumn; 26 27 33 public class MetadataDiscriminatorColumn { 34 public static final int DEFAULT_LENGTH = 31; 35 public static final String DEFAULT_NAME = "DTYPE"; 36 public static final String DEFAULT_COLUMN_DEFINITION = ""; 37 public static final String DEFAULT_DISCRIMINATOR_TYPE = DiscriminatorType.STRING.name(); 38 39 protected DiscriminatorColumn m_discriminatorColumn; 40 41 44 protected MetadataDiscriminatorColumn() {} 45 46 49 public MetadataDiscriminatorColumn(DiscriminatorColumn discriminatorColumn) { 50 m_discriminatorColumn = discriminatorColumn; 51 } 52 53 56 public String getColumnDefinition() { 57 return (m_discriminatorColumn == null) ? DEFAULT_COLUMN_DEFINITION : m_discriminatorColumn.columnDefinition(); 58 } 59 60 63 public String getDiscriminatorType() { 64 return (m_discriminatorColumn == null) ? DEFAULT_DISCRIMINATOR_TYPE : m_discriminatorColumn.discriminatorType().name(); 65 } 66 67 70 public int getLength() { 71 return (m_discriminatorColumn == null) ? DEFAULT_LENGTH : m_discriminatorColumn.length(); 72 } 73 74 77 public String getName() { 78 return (m_discriminatorColumn == null) ? null : m_discriminatorColumn.name(); 79 } 80 } 81 | Popular Tags |