Skip to content

Package: DBConnectionStringHandler

DBConnectionStringHandler

nameinstructionbranchcomplexitylinemethod
DBConnectionStringHandler(String)
M: 13 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
getObject()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getObjectTypeString()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
handleCall(CallableStatement, int)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: package de.fhdw.wtf.persistence.utils;
2:
3: import java.sql.CallableStatement;
4: import java.sql.SQLException;
5:
6: import de.fhdw.wtf.persistence.exception.NotValidInputException;
7: import de.fhdw.wtf.persistence.meta.Object;
8: import de.fhdw.wtf.persistence.meta.StringValue;
9:
10: /**
11: * Wrapper for a String for a Database-Query.
12: */
13: public class DBConnectionStringHandler implements DBConnectionObjectHandler {
14:         
15:         private final String string;
16:         
17:         @Override
18:         public String getObjectTypeString() {
19:                 return "Str";
20:         }
21:         
22:         @Override
23:         public void handleCall(final CallableStatement call, final int parameterIndex) throws SQLException {
24:                 call.setString(parameterIndex, this.string);
25:         }
26:         
27:         @Override
28:         public Object getObject() {
29:                 return new StringValue(this.string);
30:         }
31:         
32:         /**
33:          * creates a wrapper for a string for a database connection.
34:          *
35:          * @param string
36:          * the wrapped string
37:          * @throws NotValidInputException
38:          * throws when the given string is null
39:          */
40:         public DBConnectionStringHandler(final String string) throws NotValidInputException {
41:                 super();
42:                 
43:•                if (string == null) {
44:                         throw new NotValidInputException("string");
45:                 }
46:                 
47:                 this.string = string;
48:         }
49: }