Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package net.java.ao.types;
  
  import static com.google.common.base.Preconditions.checkNotNull;

Describes the underlying SQL schema type that corresponds to a given TypeInfo. This is determined by the database provider.
  
  public class SchemaProperties
 {
     private final String sqlTypeName;
     private final Integer overrideJdbcWriteType;
     private final boolean precisionAllowed;
     private final boolean scaleAllowed;
     private final boolean stringLengthAllowed;
     private final boolean defaultValueAllowed;
     
     private SchemaProperties(String sqlTypeName,
                              Integer overrideJdbcWriteType,
                              boolean precisionAllowed,
                              boolean scaleAllowed,
                              boolean stringLengthAllowed,
                              boolean defaultValueAllowed)
     {
         this. = sqlTypeName;
         this. = overrideJdbcWriteType;
         this. = precisionAllowed;
         this. = scaleAllowed;
         this. = stringLengthAllowed;
         this. = defaultValueAllowed;
     }
    
    
Constructs an instance that refers to the specified SQL type name (e.g. "VARCHAR").
 
     public static SchemaProperties schemaType(String sqlTypeName)
     {
         return new SchemaProperties(checkNotNull(sqlTypeName),
                                     nullfalsefalsefalsetrue);
     }
    
    
Returns a new instance with the same properties, but specifying a JDBC type code. This overrides the value given by the LogicalType.
 
     public SchemaProperties jdbcWriteType(int jdbcWriteType)
     {
         return new SchemaProperties(this.,
                                     jdbcWriteType,
                                     this.,
                                     this.,
                                     this.,
                                     this.);
     }
    
    
Returns a new instance with the same properties, but specifying whether or not the SQL type can include a numeric precision qualifier. This is false by default.
 
     public SchemaProperties precisionAllowed(boolean precisionAllowed)
     {
         return new SchemaProperties(this.,
                                     this.,
                                     precisionAllowed,
                                     this.,
                                     this.,
                                     this.);
     }

    
Returns a new instance with the same properties, but specifying whether or not the SQL type can include a numeric scale qualifier. This is false by default.
 
     public SchemaProperties scaleAllowed(boolean scaleAllowed)
     {
         return new SchemaProperties(this.,
                                     this.,
                                     this.,
                                     scaleAllowed,
                                     this.,
                                     this.);
     }

    
Returns a new instance with the same properties, but specifying whether or not the SQL type can include a string length qualifier. This is false by default.
 
     public SchemaProperties stringLengthAllowed(boolean stringLengthAllowed)
     {
         return new SchemaProperties(this.,
                                     this.,
                                     this.,
                                     this.,
                                     stringLengthAllowed,
                                     this.);
     }

    
Returns a new instance with the same properties, but specifying whether or not a column of this type can have a default value. This is true by default.
    public SchemaProperties defaultValueAllowed(boolean defaultValueAllowed)
    {
        return new SchemaProperties(this.,
                                    this.,
                                    this.,
                                    this.,
                                    this.,
                                    defaultValueAllowed);
    }

    
Returns the SQL type name (without any precision or length qualifiers).
    public String getSqlTypeName()
    {
        return ;
    }
    
    
Returns the JDBC type code to be used when writing to the database (e.g. java.sql.Types.VARCHAR), if this is different than the default from the LogicalType.
    {
        return ;
    }
    
    
Returns true if this instance specifies a JDBC type code that is different than the default from the LogicalType.
    public boolean hasOverrideJdbcWriteType()
    {
        return ( != null);
    }
    
    
Returns true if this type is allowed to have a numeric precision qualifier.
    public boolean isPrecisionAllowed()
    {
        return ;
    }
    
    
Returns true if this type is allowed to have a numeric scale qualifier.
    public boolean isScaleAllowed()
    {
        return ;
    }
    
    
Returns true if this type is allowed to have a string length qualifier.
    public boolean isStringLengthAllowed()
    {
        return ;
    }
    
    
Returns true if a column of this type is allowed to have a default value.
    public boolean isDefaultValueAllowed()
    {
        return ;
    }
    @Override
    public boolean equals(Object o)
    {
        if (this == oreturn true;
        if (!(o instanceof SchemaProperties)) return false;
        SchemaProperties that = (SchemaPropertieso;
        if ( != that.defaultValueAllowedreturn false;
        if ( != that.precisionAllowedreturn false;
        if ( != that.scaleAllowedreturn false;
        if ( != that.stringLengthAllowedreturn false;
        if ( != null ? !.equals(that.overrideJdbcWriteType) : that.overrideJdbcWriteType != nullreturn false;
        if ( != null ? !.equals(that.sqlTypeName) : that.sqlTypeName != nullreturn false;
        return true;
    }
    @Override
    public int hashCode()
    {
        int result =  != null ? .hashCode() : 0;
        result = 31 * result + ( != null ? .hashCode() : 0);
        result = 31 * result + ( ? 1 : 0);
        result = 31 * result + ( ? 1 : 0);
        result = 31 * result + ( ? 1 : 0);
        result = 31 * result + ( ? 1 : 0);
        return result;
    }
New to GrepCode? Check out our FAQ X