Revision 44669 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/FeatureAttributeDescriptor.java

View differences:

FeatureAttributeDescriptor.java
23 23
 */
24 24
package org.gvsig.fmap.dal.feature;
25 25

  
26
import java.math.MathContext;
26 27
import java.text.DateFormat;
27 28

  
28 29
import org.cresques.cts.IProjection;
......
31 32
import org.gvsig.fmap.geom.Geometry;
32 33
import org.gvsig.fmap.geom.type.GeometryType;
33 34
import org.gvsig.timesupport.Interval;
35
import org.gvsig.tools.dataTypes.Coercion;
34 36
import org.gvsig.tools.dynobject.DynField_v2;
35 37
import org.gvsig.tools.evaluator.Evaluator;
36 38
import org.gvsig.tools.util.LabeledValue;
39
import org.gvsig.tools.dataTypes.CoercionContext;
37 40

  
38 41
/**
39 42
 * A feature attribute descriptor contains information about
......
46 49
public interface FeatureAttributeDescriptor 
47 50
        extends DynField_v2, LabeledValue<FeatureAttributeDescriptor>
48 51
    {
52
    public static final int BYTE_MAX_PRECISION = 3; // max byte 255
53
    public static final int BYTE_DEFAULT_PRECISION = BYTE_MAX_PRECISION;
49 54

  
55
    public static final int INT_MAX_PRECISION = 10; // max int 2147483647.
56
    public static final int INT_DEFAULT_PRECISION = INT_MAX_PRECISION;
57

  
58
    public static final int LONG_MAX_PRECISION = 19; // max long 9223372036854775807.
59
    public static final int LONG_DEFAULT_PRECISION = LONG_MAX_PRECISION;
60

  
61
    // IEEE 754 Single-precision floating-point
62
    // https://en.m.wikipedia.org/wiki/Single-precision_floating-point_format
63
    public static final int FLOAT_MAX_PRECISION = 8; // 24bits
64
    public static final int FLOAT_DEFAULT_PRECISION = FLOAT_MAX_PRECISION;
65
    public static final int FLOAT_DEFAULT_SCALE = 3;
66

  
67
    // IEEE 754 Double-precision floating-point
68
    // https://en.m.wikipedia.org/wiki/Double-precision_floating-point_format
69
    public static final int DOUBLE_MAX_PRECISION = 16; // 54bits
70
    public static final int DOUBLE_DEFAULT_PRECISION = DOUBLE_MAX_PRECISION;
71
    public static final int DOUBLE_DEFAULT_SCALE = 8;
72

  
73
    // La precision de un BigDecimal es la de un BigInteger, que esta 
74
    // en 2^500000000, vamos a dejarla en que es algo mas de 2^5000000, siendo
75
    // consciente de que algunos proveedores no podran suportarla y la recortaran.
76
    public static final int DECIMAL_MAX_PRECISION = 2000000;
77
    public static final int DECIMAL_DEFAULT_PRECISION = 20; 
78
    public static final int DECIMAL_DEFAULT_SCALE = 3;
79
    
50 80
	/**
51 81
	 * Returns a clone of this attribute descriptor
52 82
	 *
......
79 109
	public int getSize();
80 110

  
81 111
	/**
82
	 * For attributes of type {@link DataTypes#DOUBLE} and {@link DataTypes#FLOAT}
83
	 * , this returns the maximum number of places after the decimal point. For
84
	 * other types, this must always return zero.
112
	 * For attributes of type {@link DataTypes#DECIMAL}, this returns the maximum 
113
   * number of digits.
114
   * For other types, this must always return zero.
115
   * 
116
   * @return 
85 117
	 */
86 118
	public int getPrecision();
87 119

  
88 120
	/**
121
	 * For attributes of type {@link DataTypes#DECIMAL}, this returns the maximum 
122
   * number of digits after the decimal point.
123
   * For other types, this must always return zero.
124
   * 
125
   * @return 
126
	 */
127
	public int getScale();
128

  
129
  /**
130
	 * For attributes of type {@link DataTypes#DECIMAL}, this returns the MathContext
131
   * associated to this.
132
   * For other types return {@link MathContext#UNLIMITED}.
133
   * 
134
   * @return 
135
	 */
136
  public MathContext getMathContext();
137
  
138
	/**
139
	 * Return a CoercionContext for this attribute.
140
   * 
141
   * @return the CoercionContext
142
	 */
143
  public CoercionContext getCoercionContext();
144
  
145
  /**
146
   * Return a Coercion to convert a value to the type of this attribute.
147
   * 
148
   * @return the Coercion.
149
   */
150
  public Coercion getCoercion();
151
  
152
	/**
89 153
	 * For attributes of type {@link DataTypes#OBJECT},
90 154
	 * this returns the Java {@link Class} object that class or interface that
91 155
	 * all values of this attribute can be cast to.
......
181 245
	 */
182 246
	public DateFormat getDateFormat();
183 247

  
248
        /**
249
         * Return the default value coerced to the data type of attribute.
250
         * Return null if can't coerce.
251
         * 
252
         * @return default value or null.
253
         */
254
        public Object getDefaultValueCoerced();
255

  
184 256
	/**
185 257
	 * Returns this attribute relative position within the {@link Feature}.
186 258
	 *

Also available in: Unified diff