Skip to content

Package: ExpressionLiteralImpl

ExpressionLiteralImpl

nameinstructionbranchcomplexitylinemethod
ExpressionLiteralImpl(Object, CriteriaBuilder)
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
ExpressionLiteralImpl(String, String, CriteriaBuilder)
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
determineClass(Object)
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getLanguageTag()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getValue()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
setExpressionToQuery(StringBuilder, CriteriaParameterFiller)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%

Coverage

1: /*
2: * JOPA
3: * Copyright (C) 2024 Czech Technical University in Prague
4: *
5: * This library is free software; you can redistribute it and/or
6: * modify it under the terms of the GNU Lesser General Public
7: * License as published by the Free Software Foundation; either
8: * version 3.0 of the License, or (at your option) any later version.
9: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library.
17: */
18: package cz.cvut.kbss.jopa.query.criteria.expressions;
19:
20: import cz.cvut.kbss.jopa.query.criteria.CriteriaParameterFiller;
21: import cz.cvut.kbss.jopa.model.query.criteria.CriteriaBuilder;
22:
23: public class ExpressionLiteralImpl<T> extends AbstractExpression<T> {
24:
25: private final Object literal;
26: private final String languageTag;
27:
28: public ExpressionLiteralImpl(T literal, CriteriaBuilder cb) {
29: super(determineClass(literal), cb);
30: this.literal = literal;
31: languageTag = null;
32: }
33:
34: public ExpressionLiteralImpl(String literal, String languageTag, CriteriaBuilder cb) {
35: super(determineClass(literal), cb);
36: this.literal = literal;
37: this.languageTag = languageTag;
38: }
39:
40: @Override
41: public void setExpressionToQuery(StringBuilder query, CriteriaParameterFiller parameterFiller) {
42: query.append(parameterFiller.registerParameter(this));
43: }
44:
45: private static Class determineClass(Object literal) {
46: return literal.getClass();
47: }
48:
49: public Object getValue(){
50: return literal;
51: }
52:
53: public String getLanguageTag(){
54: return languageTag;
55: }
56:
57: }