| 1 | /* |
| 2 | * Copyright 2007 brunella ltd |
| 3 | * |
| 4 | * Licensed under the LGPL Version 3 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * |
| 7 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 8 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 9 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 10 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 11 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 12 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 13 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 14 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 15 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 16 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 17 | * THE POSSIBILITY OF SUCH DAMAGE. |
| 18 | */ |
| 19 | package sf.qof.codegen; |
| 20 | |
| 21 | import net.sf.cglib.core.Signature; |
| 22 | |
| 23 | import org.objectweb.asm.Type; |
| 24 | |
| 25 | /** |
| 26 | * Internal - holds constants for type and signature definitions. |
| 27 | */ |
| 28 | public final class Constants { |
| 29 | |
| 30 | private Constants() { |
| 31 | } |
| 32 | |
| 33 | public static final String FIELD_NAME_DEFAULT_FETCH_SIZE = "DEFAULT_FETCH_SIZE"; |
| 34 | public static final String FIELD_NAME_DEFAULT_BATCH_SIZE = "DEFAULT_BATCH_SIZE"; |
| 35 | public static final String EXCEPTION_COLLECTIONS_DIFFERENT_SIZE = "Input collections have different size"; |
| 36 | public static final String EXCEPTION_EMPTY_RESULT = "Empty result set returned"; |
| 37 | public static final String EXCEPTION_MORE_THAN_ONE_RESULT = "More than one result in result set"; |
| 38 | |
| 39 | public static final String FIELD_NAME_BATCH_SIZE = "batchSize"; |
| 40 | public static final String FIELD_NAME_FETCH_SIZE = "fetchSize"; |
| 41 | |
| 42 | public static final String FIELD_NAME_FIRST_RESULT = "firstResult"; |
| 43 | public static final String FIELD_NAME_MAX_RESULTS = "maxResults"; |
| 44 | |
| 45 | // types |
| 46 | public static final Type TYPE_Byte = Type.getType("Ljava/lang/Byte;"); |
| 47 | public static final Type TYPE_Boolean = Type.getType("Ljava/lang/Boolean;"); |
| 48 | public static final Type TYPE_Short = Type.getType("Ljava/lang/Short;"); |
| 49 | public static final Type TYPE_Integer = Type.getType("Ljava/lang/Integer;"); |
| 50 | public static final Type TYPE_Long = Type.getType("Ljava/lang/Long;"); |
| 51 | public static final Type TYPE_Float = Type.getType("Ljava/lang/Float;"); |
| 52 | public static final Type TYPE_Double = Type.getType("Ljava/lang/Double;"); |
| 53 | public static final Type TYPE_Date = Type.getType("Ljava/util/Date;"); |
| 54 | public static final Type TYPE_String = Type.getType("Ljava/lang/String;"); |
| 55 | public static final Type TYPE_Character = Type.getType("Ljava/lang/Character;"); |
| 56 | public static final Type TYPE_byte = Type.getType("B"); |
| 57 | public static final Type TYPE_boolean = Type.getType("Z"); |
| 58 | public static final Type TYPE_short = Type.getType("S"); |
| 59 | public static final Type TYPE_int = Type.getType("I"); |
| 60 | public static final Type TYPE_long = Type.getType("J"); |
| 61 | public static final Type TYPE_float = Type.getType("F"); |
| 62 | public static final Type TYPE_double = Type.getType("D"); |
| 63 | public static final Type TYPE_char = Type.getType("C"); |
| 64 | |
| 65 | public static final Type TYPE_intArray = Type.getType("[I"); |
| 66 | |
| 67 | public static final Type TYPE_Throwable = Type.getType("Ljava/lang/Throwable;"); |
| 68 | public static final Type TYPE_RuntimeException = Type.getType("Ljava/lang/RuntimeException;"); |
| 69 | |
| 70 | public static final Type TYPE_Collection = Type.getType("Ljava/util/Collection;"); |
| 71 | public static final Type TYPE_Map = Type.getType("Ljava/util/Map;"); |
| 72 | public static final Type TYPE_Iterator = Type.getType("Ljava/util/Iterator;"); |
| 73 | public static final Type TYPE_List = Type.getType("Ljava/util/List;"); |
| 74 | public static final Type TYPE_ArrayList = Type.getType("Ljava/util/ArrayList;"); |
| 75 | public static final Type TYPE_HashSet = Type.getType("Ljava/util/HashSet;"); |
| 76 | public static final Type TYPE_HashMap = Type.getType("Ljava/util/HashMap;"); |
| 77 | |
| 78 | public static final Type TYPE_Connection = Type.getType("Ljava/sql/Connection;"); |
| 79 | public static final Type TYPE_Statement = Type.getType("Ljava/sql/Statement;"); |
| 80 | public static final Type TYPE_PreparedStatement = Type.getType("Ljava/sql/PreparedStatement;"); |
| 81 | public static final Type TYPE_CallableStatement = Type.getType("Ljava/sql/CallableStatement;"); |
| 82 | public static final Type TYPE_ResultSet = Type.getType("Ljava/sql/ResultSet;"); |
| 83 | public static final Type TYPE_SQLException = Type.getType("Ljava/sql/SQLException;"); |
| 84 | public static final Type TYPE_sqlDate = Type.getType("Ljava/sql/Date;"); |
| 85 | public static final Type TYPE_sqlTime = Type.getType("Ljava/sql/Time;"); |
| 86 | public static final Type TYPE_sqlTimestamp = Type.getType("Ljava/sql/Timestamp;"); |
| 87 | |
| 88 | public static final Type TYPE_System = Type.getType("Ljava/lang/System;"); |
| 89 | |
| 90 | public static final Signature SIG_init = new Signature("init", "()V"); |
| 91 | |
| 92 | // methods of Connection/PreparedStament/CallableStatement |
| 93 | public static final Signature SIG_prepareStatement = new Signature("prepareStatement", |
| 94 | "(Ljava/lang/String;)Ljava/sql/PreparedStatement;"); |
| 95 | public static final Signature SIG_prepareCall = new Signature("prepareCall", |
| 96 | "(Ljava/lang/String;)Ljava/sql/CallableStatement;"); |
| 97 | public static final Signature SIG_setNull = new Signature("setNull", "(II)V"); |
| 98 | public static final Signature SIG_setByte = new Signature("setByte", "(IB)V"); |
| 99 | public static final Signature SIG_getByte = new Signature("getByte", "(I)B"); |
| 100 | public static final Signature SIG_getByteNamed = new Signature("getByte", "(Ljava/lang/String;)B"); |
| 101 | public static final Signature SIG_setShort = new Signature("setShort", "(IS)V"); |
| 102 | public static final Signature SIG_getShort = new Signature("getShort", "(I)S"); |
| 103 | public static final Signature SIG_getShortNamed = new Signature("getShort", "(Ljava/lang/String;)S"); |
| 104 | public static final Signature SIG_setInt = new Signature("setInt", "(II)V"); |
| 105 | public static final Signature SIG_getInt = new Signature("getInt", "(I)I"); |
| 106 | public static final Signature SIG_getIntNamed = new Signature("getInt", "(Ljava/lang/String;)I"); |
| 107 | public static final Signature SIG_setLong = new Signature("setLong", "(IJ)V"); |
| 108 | public static final Signature SIG_getLong = new Signature("getLong", "(I)J"); |
| 109 | public static final Signature SIG_getLongNamed = new Signature("getLong", "(Ljava/lang/String;)J"); |
| 110 | public static final Signature SIG_setFloat = new Signature("setFloat", "(IF)V"); |
| 111 | public static final Signature SIG_getFloat = new Signature("getFloat", "(I)F"); |
| 112 | public static final Signature SIG_getFloatNamed = new Signature("getFloat", "(Ljava/lang/String;)F"); |
| 113 | public static final Signature SIG_setDouble = new Signature("setDouble", "(ID)V"); |
| 114 | public static final Signature SIG_getDouble = new Signature("getDouble", "(I)D"); |
| 115 | public static final Signature SIG_getDoubleNamed = new Signature("getDouble", "(Ljava/lang/String;)D"); |
| 116 | public static final Signature SIG_setBoolean = new Signature("setBoolean", "(IZ)V"); |
| 117 | public static final Signature SIG_getBoolean = new Signature("getBoolean", "(I)Z"); |
| 118 | public static final Signature SIG_getBooleanNamed = new Signature("getBoolean", "(Ljava/lang/String;)Z"); |
| 119 | public static final Signature SIG_setString = new Signature("setString", "(ILjava/lang/String;)V"); |
| 120 | public static final Signature SIG_getString = new Signature("getString", "(I)Ljava/lang/String;"); |
| 121 | public static final Signature SIG_getStringNamed = new Signature("getString", "(Ljava/lang/String;)Ljava/lang/String;"); |
| 122 | public static final Signature SIG_setDate = new Signature("setDate", "(ILjava/sql/Date;)V"); |
| 123 | public static final Signature SIG_getDate = new Signature("getDate", "(I)Ljava/sql/Date;"); |
| 124 | public static final Signature SIG_getDateNamed = new Signature("getDate", "(Ljava/lang/String;)Ljava/sql/Date;"); |
| 125 | public static final Signature SIG_setTime = new Signature("setTime", "(ILjava/sql/Time;)V"); |
| 126 | public static final Signature SIG_getTime = new Signature("getTime", "(I)Ljava/sql/Time;"); |
| 127 | public static final Signature SIG_getTimeNamed = new Signature("getTime", "(Ljava/lang/String;)Ljava/sql/Time;"); |
| 128 | public static final Signature SIG_setTimestamp = new Signature("setTimestamp", "(ILjava/sql/Timestamp;)V"); |
| 129 | public static final Signature SIG_getTimestamp = new Signature("getTimestamp", "(I)Ljava/sql/Timestamp;"); |
| 130 | public static final Signature SIG_getTimestampNamed = new Signature("getTimestamp", "(Ljava/lang/String;)Ljava/sql/Timestamp;"); |
| 131 | |
| 132 | public static final Signature SIG_wasNull = new Signature("wasNull", "()Z"); |
| 133 | public static final Signature SIG_next = new Signature("next", "()Z"); |
| 134 | public static final Signature SIG_close = new Signature("close", "()V"); |
| 135 | public static final Signature SIG_executeQuery = new Signature("executeQuery", "()Ljava/sql/ResultSet;"); |
| 136 | public static final Signature SIG_execute = new Signature("execute", "()Z"); |
| 137 | public static final Signature SIG_executeUpdate = new Signature("executeUpdate", "()I"); |
| 138 | public static final Signature SIG_executeBatch = new Signature("executeBatch", "()[I"); |
| 139 | public static final Signature SIG_addBatch = new Signature("addBatch", "()V"); |
| 140 | public static final Signature SIG_setFetchSize = new Signature("setFetchSize", "(I)V"); |
| 141 | public static final Signature SIG_registerOutParameter = new Signature("registerOutParameter", "(II)V"); |
| 142 | |
| 143 | public static final Signature SIG_byteValue = new Signature("byteValue", "()B"); |
| 144 | public static final Signature SIG_shortValue = new Signature("shortValue", "()S"); |
| 145 | public static final Signature SIG_intValue = new Signature("intValue", "()I"); |
| 146 | public static final Signature SIG_longValue = new Signature("longValue", "()J"); |
| 147 | public static final Signature SIG_floatValue = new Signature("floatValue", "()F"); |
| 148 | public static final Signature SIG_doubleValue = new Signature("doubleValue", "()D"); |
| 149 | public static final Signature SIG_booleanValue = new Signature("booleanValue", "()Z"); |
| 150 | |
| 151 | public static final Signature SIG_getTimeLong = new Signature("getTime", "()J"); |
| 152 | |
| 153 | public static final Signature SIG_size = new Signature("size", "()I"); |
| 154 | public static final Signature SIG_iterator = new Signature("iterator", "()Ljava/util/Iterator;"); |
| 155 | public static final Signature SIG_hasNext = new Signature("hasNext", "()Z"); |
| 156 | public static final Signature SIG_iterator_next = new Signature("next", "()Ljava/lang/Object;"); |
| 157 | public static final Signature SIG_add = new Signature("add", "(Ljava/lang/Object;)Z"); |
| 158 | public static final Signature SIG_put = new Signature("put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); |
| 159 | |
| 160 | public static final Signature SIG_getConnection = new Signature("getConnection", "()Ljava/sql/Connection;"); |
| 161 | public static final Signature SIG_setConnection = new Signature("setConnection", "(Ljava/sql/Connection;)V"); |
| 162 | |
| 163 | public static final Signature SIG_toString = new Signature("toString", "()Ljava/lang/String;"); |
| 164 | public static final Signature SIG_length = new Signature("length", "()I"); |
| 165 | |
| 166 | public static final Signature SIG_arraycopy = new Signature("arraycopy", "(Ljava/lang/Object;ILjava/lang/Object;II)V"); |
| 167 | |
| 168 | public static final Signature SIG_Byte_valueOf = new Signature("valueOf", "(B)Ljava/lang/Byte;"); |
| 169 | public static final Signature SIG_Short_valueOf = new Signature("valueOf", "(S)Ljava/lang/Short;"); |
| 170 | public static final Signature SIG_Integer_valueOf = new Signature("valueOf", "(I)Ljava/lang/Integer;"); |
| 171 | public static final Signature SIG_Long_valueOf = new Signature("valueOf", "(J)Ljava/lang/Long;"); |
| 172 | public static final Signature SIG_Float_valueOf = new Signature("valueOf", "(F)Ljava/lang/Float;"); |
| 173 | public static final Signature SIG_Double_valueOf = new Signature("valueOf", "(D)Ljava/lang/Double;"); |
| 174 | public static final Signature SIG_Character_valueOf = new Signature("valueOf", "(C)Ljava/lang/Character;"); |
| 175 | public static final Signature SIG_Boolean_valueOf = new Signature("valueOf", "(Z)Ljava/lang/Boolean;"); |
| 176 | |
| 177 | //TODO move |
| 178 | } |