com.sap.ip.me.api.persist.meta
Class AttributeType

java.lang.Object
  extended bycom.sap.ip.me.api.persist.meta.AttributeType
All Implemented Interfaces:
InstanceIdProvider, MeComparator

public abstract class AttributeType
extends java.lang.Object
implements MeComparator, InstanceIdProvider

Class provides persistence type mapping.

Version:
1.0
Author:
SAP

Field Summary
static AttributeType BIGDECIMAL
          BIGDECIMAL AttributeType is mapping java.math.BigDecimal.
static AttributeType BIGINTEGER
          BIGINTEGER AttributeType is mapping java.math.BigInteger.
static AttributeType BINARY
          Describes binary large objects (BLOB's) by mapping byte[] Maximum Size is limited by the available memory.
static AttributeType BOOLEAN
          BOOLEAN AttributeType maps instances of java.lang.Boolean
static AttributeType BYTE
          BYTE AttributeType maps instances of java.lang.Byte
static java.lang.String CODE_PAGE
           
static AttributeType DATE
          DATE AttributeType handles instances of java.util.Calendar.
static AttributeType DECIMAL
          Deprecated. Use BIGDECIMAL instead if precision of DOUBLE is not sufficient.
static AttributeType DOUBLE
          DOUBLE AttributeType maps instances of java.lang.Double
static AttributeType FLOAT
          FLOAT AttributeType maps instances of java.lang.Float
static AttributeType INTEGER
          INTEGER AttributeType maps instances of java.lang.Integer
 java.lang.Class javaType
          Description of the Field
 int jdbcType
          Description of the Field
static AttributeType LONG
          LONG AttributeType maps instances of java.lang.Long
static java.lang.String NULL_STR
           
static AttributeType SHORT
          SHORT AttributeType maps instances of java.lang.Short
static AttributeType SQLDATE
          SQLDATE AttributeType is mapping java.sql.Date
static AttributeType SQLTIME
          SQLTIME AttributeType is mapping java.sql.Time
 java.lang.String sqlType
          Description of the Field
static AttributeType STRING
          STRING AttributeType maps instances of java.lang.String
 
Constructor Summary
protected AttributeType(java.lang.Class javaType, int jdbcType, java.lang.String sqlType)
          Constructor for the AttributeType object
 
Method Summary
protected static int byteToInt(byte[] arr, int off)
           
protected static int byteToLength(byte[] arr, int off)
           
protected static long byteToLong(byte[] arr, int off)
           
protected static int byteToShort(byte[] arr, int off)
           
 java.lang.Object cloneMutable(java.lang.Object o)
          provide clone instance, if o is mutable class
abstract  int compare(byte[] b1, byte[] b2)
           
 int compare(byte[] row0, byte[] row1, int off, int len)
           
 int compare(byte[] row, int off, byte[] field)
           
protected  int compare(java.util.Date d1, java.util.Date d2)
           
protected  int compare(long i1, long i2)
           
abstract  int compare(java.lang.Object o1, java.lang.Object o2)
          Description of the Method
 boolean contains(byte[] row, int off, byte[] field)
           
abstract  boolean contains(byte[] b, java.lang.Object o)
           
 boolean equals(byte[] row, int off, byte[] field)
           
 boolean equals(byte[] b, java.lang.Object o)
           
 boolean equals(java.lang.Object o)
          Description of the Method
static AttributeType forInstanceId(int id)
           
abstract  java.lang.Object getDefaultValue(int len, int dec)
           
 int getInstanceId()
           
 boolean greaterThan(byte[] row, int off, byte[] field)
           
 boolean greaterThan(byte[] b, java.lang.Object o)
           
protected static void intToByte(byte[] arr, int off, int val)
           
abstract  boolean isValidType(java.lang.Object obj)
          check if the given objects has the rigth type
protected static void lengthToByte(byte[] arr, int off, int len)
           
protected static void longToByte(byte[] arr, int off, long val)
           
 boolean lowerThan(byte[] row, int off, byte[] field)
           
 boolean lowerThan(byte[] b, java.lang.Object o)
           
 boolean notEqual(byte[] row, int off, byte[] field)
           
 boolean notEqual(byte[] b, java.lang.Object o)
           
protected static long parseSignedLong(char[] in, int inOff, int inLen)
           
protected static void shortToByte(byte[] arr, int off, int val)
           
 boolean startsWith(byte[] row, int off, byte[] field)
           
abstract  boolean startWith(byte[] b, java.lang.Object o)
           
abstract  int toByte(byte[] arr, int off, java.lang.Object obj, int len, int dec)
          This method converts the object to byte array representation.
 int toByte(char[] in, int inOff, int inLen, byte[] out, int outOff, int outLen, int outDec)
           
abstract  int toByteLen(int len, int dec)
           
 java.lang.String toString()
          Description of the Method
abstract  java.lang.Object toValue(byte[] arr, int off)
          This method convert the byte array representation to a value object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CODE_PAGE

public static final java.lang.String CODE_PAGE
See Also:
Constant Field Values

NULL_STR

public static final java.lang.String NULL_STR
See Also:
Constant Field Values

STRING

public static final AttributeType STRING
STRING AttributeType maps instances of java.lang.String


INTEGER

public static final AttributeType INTEGER
INTEGER AttributeType maps instances of java.lang.Integer


SHORT

public static final AttributeType SHORT
SHORT AttributeType maps instances of java.lang.Short


LONG

public static final AttributeType LONG
LONG AttributeType maps instances of java.lang.Long


FLOAT

public static final AttributeType FLOAT
FLOAT AttributeType maps instances of java.lang.Float


DOUBLE

public static final AttributeType DOUBLE
DOUBLE AttributeType maps instances of java.lang.Double


BOOLEAN

public static final AttributeType BOOLEAN
BOOLEAN AttributeType maps instances of java.lang.Boolean


BYTE

public static final AttributeType BYTE
BYTE AttributeType maps instances of java.lang.Byte


BINARY

public static final AttributeType BINARY
Describes binary large objects (BLOB's) by mapping byte[] Maximum Size is limited by the available memory. Use with care, because of the high risk of OutOfMemory errors.


DATE

public static final AttributeType DATE
DATE AttributeType handles instances of java.util.Calendar. Avoid frequently usage, because instances of Calendar have a high memory consumption. Try to store dates with type LONG or even INTEGER.


DECIMAL

public static final AttributeType DECIMAL
Deprecated. Use BIGDECIMAL instead if precision of DOUBLE is not sufficient.

The usage of AttributeType DECIMAL is not recommended, because it handles instances of the deprecated type com.sap.ip.me.api.smartsync.FixedDecimal.


SQLDATE

public static final AttributeType SQLDATE
SQLDATE AttributeType is mapping java.sql.Date


SQLTIME

public static final AttributeType SQLTIME
SQLTIME AttributeType is mapping java.sql.Time


BIGDECIMAL

public static final AttributeType BIGDECIMAL
BIGDECIMAL AttributeType is mapping java.math.BigDecimal. Use with care, because instances of BigDecimal have a high memory consumption.

The length of your BIGDECIMAL attributes should not exceed 31 digits for best possible performance.


BIGINTEGER

public static final AttributeType BIGINTEGER
BIGINTEGER AttributeType is mapping java.math.BigInteger.

Use with care, because instances of java.math.BigInteger have a high memory consumption. Use LONG instead if a precision of 18 digits is sufficient.


javaType

public final java.lang.Class javaType
Description of the Field


jdbcType

public final int jdbcType
Description of the Field


sqlType

public final java.lang.String sqlType
Description of the Field

Constructor Detail

AttributeType

protected AttributeType(java.lang.Class javaType,
                        int jdbcType,
                        java.lang.String sqlType)
Constructor for the AttributeType object

Parameters:
javaType - Description of the Parameter
jdbcType - Description of the Parameter
sqlType - Description of the Parameter
Method Detail

getInstanceId

public int getInstanceId()
Specified by:
getInstanceId in interface InstanceIdProvider

greaterThan

public final boolean greaterThan(byte[] row,
                                 int off,
                                 byte[] field)

compare

public int compare(byte[] row,
                   int off,
                   byte[] field)

compare

public int compare(byte[] row0,
                   byte[] row1,
                   int off,
                   int len)

toByte

public int toByte(char[] in,
                  int inOff,
                  int inLen,
                  byte[] out,
                  int outOff,
                  int outLen,
                  int outDec)

lowerThan

public final boolean lowerThan(byte[] row,
                               int off,
                               byte[] field)

notEqual

public final boolean notEqual(byte[] row,
                              int off,
                              byte[] field)

equals

public final boolean equals(byte[] row,
                            int off,
                            byte[] field)

contains

public boolean contains(byte[] row,
                        int off,
                        byte[] field)

startsWith

public boolean startsWith(byte[] row,
                          int off,
                          byte[] field)

parseSignedLong

protected static long parseSignedLong(char[] in,
                                      int inOff,
                                      int inLen)

lengthToByte

protected static final void lengthToByte(byte[] arr,
                                         int off,
                                         int len)

byteToLength

protected static final int byteToLength(byte[] arr,
                                        int off)

shortToByte

protected static final void shortToByte(byte[] arr,
                                        int off,
                                        int val)

byteToShort

protected static final int byteToShort(byte[] arr,
                                       int off)

intToByte

protected static final void intToByte(byte[] arr,
                                      int off,
                                      int val)

byteToInt

protected static final int byteToInt(byte[] arr,
                                     int off)

longToByte

protected static final void longToByte(byte[] arr,
                                       int off,
                                       long val)

byteToLong

protected static final long byteToLong(byte[] arr,
                                       int off)

equals

public final boolean equals(java.lang.Object o)
Description of the Method

Specified by:
equals in interface MeComparator
Parameters:
o - Description of the Parameter
Returns:
Description of the Return Value

toString

public java.lang.String toString()
Description of the Method

Returns:
Description of the Return Value

isValidType

public abstract boolean isValidType(java.lang.Object obj)
check if the given objects has the rigth type

Parameters:
obj - the value object
Returns:
true if type matches false otherwise

compare

public abstract int compare(java.lang.Object o1,
                            java.lang.Object o2)
Description of the Method

Specified by:
compare in interface MeComparator
Parameters:
o1 - Description of the Parameter
o2 - Description of the Parameter
Returns:
Description of the Return Value

compare

public abstract int compare(byte[] b1,
                            byte[] b2)
Parameters:
b1 -
b2 -
Returns:

toByte

public abstract int toByte(byte[] arr,
                           int off,
                           java.lang.Object obj,
                           int len,
                           int dec)
This method converts the object to byte array representation. The caller has to ensure the length of the buffer and the offset.

Parameters:
arr - the destination byte array
off - the offset in byte array
obj - the value object (see types above)
len - Description of the Parameter
Returns:
the number of bytes written
Throws:
java.lang.IllegalArgumentException - if Object type is unsufficent

toValue

public abstract java.lang.Object toValue(byte[] arr,
                                         int off)
This method convert the byte array representation to a value object. The caller has to ensure the sizes and proper offsets

Parameters:
arr - Description of the Parameter
off - Description of the Parameter
Returns:
Description of the Return Value

toByteLen

public abstract int toByteLen(int len,
                              int dec)
Parameters:
len - the len of value object
Returns:
the maxium count of bytes nedded in array

contains

public abstract boolean contains(byte[] b,
                                 java.lang.Object o)
Returns:

startWith

public abstract boolean startWith(byte[] b,
                                  java.lang.Object o)
Returns:

getDefaultValue

public abstract java.lang.Object getDefaultValue(int len,
                                                 int dec)

cloneMutable

public java.lang.Object cloneMutable(java.lang.Object o)
provide clone instance, if o is mutable class

Parameters:
o -
Returns:

equals

public boolean equals(byte[] b,
                      java.lang.Object o)

notEqual

public boolean notEqual(byte[] b,
                        java.lang.Object o)

greaterThan

public boolean greaterThan(byte[] b,
                           java.lang.Object o)

lowerThan

public boolean lowerThan(byte[] b,
                         java.lang.Object o)

compare

protected final int compare(long i1,
                            long i2)

compare

protected final int compare(java.util.Date d1,
                            java.util.Date d2)

forInstanceId

public static AttributeType forInstanceId(int id)


Copyright © 2005 SAP AG. All Rights Reserved.