if ( selection.getJavaType().isArray() ) { throw new IllegalArgumentException( "Selection items in a multi-select cannot contain compound array-valued elements" ); if ( Tuple.class.isAssignableFrom( selection.getJavaType() ) ) { throw new IllegalArgumentException( "Selection items in a multi-select cannot contain compound tuple-valued elements"
Class<? extends S> clazzType = select.getJavaType();
/** * @param selections * the selections * * @since 2.0.0 */ public void updateResultClass(List<Selection<?>> selections) { if (selections.size() == 1) { final Selection<?> selection = selections.get(0); this.resultType = (Class<T>) selection.getJavaType(); } else { this.resultType = (Class<T>) Object[].class; } }
/** * @param selections * the selections * * @since 2.0.0 */ public void updateResultClass(List<Selection<?>> selections) { if (selections.size() == 1) { final Selection<?> selection = selections.get(0); this.resultType = (Class<T>) selection.getJavaType(); } else { this.resultType = (Class<T>) Object[].class; } }
private Constructor<X> findConstructor(Class<X> cls, Selection<?>... selections) { Class<?>[] types = selections == null ? null : new Class[selections.length]; if (selections != null) { for (int i = 0; i < selections.length; i++) { types[i] = selections[i].getJavaType(); } } try { return cls.getConstructor(types); } catch (NoSuchMethodException e) { throw new IllegalArgumentException(_loc.get("select-no-ctor", cls, types == null ? "[]" : Arrays.toString(types)).getMessage()); } }
/** * Package-protected method to centralize checking of criteria query * multiselects as defined by the * {@link CriteriaQuery#multiselect(List)} method. * * @param selections The selection varargs to check * * @throws IllegalArgumentException If, as per * {@link CriteriaQuery#multiselect(List)} documentation, * <i>"An argument to the multiselect method must not be a tuple- * or array-valued compound selection item."</i> */ void checkMultiselect(List<Selection<?>> selections) { for ( Selection<?> selection : selections ) { if ( selection.isCompoundSelection() ) { if ( selection.getJavaType().isArray() ) { throw new IllegalArgumentException( "multiselect selections cannot contain " + "compound array-valued elements" ); } if ( Tuple.class.isAssignableFrom( selection.getJavaType() ) ) { throw new IllegalArgumentException( "multiselect selections cannot contain " + "compound tuple-valued elements" ); } } } }
private Constructor<X> findConstructor(Class<X> cls, Selection<?>... selections) { Class<?>[] types = selections == null ? null : new Class[selections.length]; if (selections != null) { for (int i = 0; i < selections.length; i++) { types[i] = selections[i].getJavaType(); } } try { return cls.getConstructor(types); } catch (NoSuchMethodException e) { throw new IllegalArgumentException(_loc.get("select-no-ctor", cls, types == null ? "[]" : Arrays.toString(types)).getMessage()); } }
private Constructor<X> findConstructor(Class<X> cls, Selection<?>... selections) { Class<?>[] types = selections == null ? null : new Class[selections.length]; if (selections != null) { for (int i = 0; i < selections.length; i++) { types[i] = selections[i].getJavaType(); } } try { return cls.getConstructor(types); } catch (NoSuchMethodException e) { throw new IllegalArgumentException(_loc.get("select-no-ctor", cls, types == null ? "[]" : Arrays.toString(types)).getMessage()); } }
private Constructor<X> findConstructor(Class<X> cls, Selection<?>... selections) { Class<?>[] types = selections == null ? null : new Class[selections.length]; if (selections != null) { for (int i = 0; i < selections.length; i++) { types[i] = selections[i].getJavaType(); } } try { return cls.getConstructor(types); } catch (NoSuchMethodException e) { throw new IllegalArgumentException(_loc.get("select-no-ctor", cls, types == null ? "[]" : Arrays.toString(types)).getMessage()); } }
if (selection.isCompoundSelection()) { if (selection.getJavaType().isArray()) { throw new IllegalArgumentException("Illegal array selection in multiselect selections"); if (Tuple.class.isAssignableFrom(selection.getJavaType())) { throw new IllegalArgumentException("Illegal tuple selection in multiselect selections");
if (selection.isCompoundSelection()) { if (selection.getJavaType().isArray()) { throw new IllegalArgumentException("Illegal array selection in multiselect selections"); if (Tuple.class.isAssignableFrom(selection.getJavaType())) { throw new IllegalArgumentException("Illegal tuple selection in multiselect selections");
selectionType = pluralJoin.getModel().getElementType().getJavaType(); } else { selectionType = selection.getJavaType(); if (selectionType.isPrimitive()) { if (selectionType == boolean.class) {
new Object[] { ((CompoundSelectionImpl)this.selection).getDuplicateAliasNames() })); if (selection.getJavaType().equals(Tuple.class)) { this.queryResult = ResultType.TUPLE; this.queryType = Tuple.class; Selection[] selectArray = selection.getCompoundSelectionItems().toArray(new Selection[selection.getCompoundSelectionItems().size()]); populateAndSetConstructorSelection((ConstructorSelectionImpl)selection, this.selection.getJavaType(), selectArray); this.queryType = selection.getJavaType(); } else { this.queryResult = ResultType.OBJECT_ARRAY; Class queryType = selection.getJavaType(); if (queryType != null) { this.queryType = queryType;
int count = 0; for (Selection select : selections) { constructorArgs[count++] = select.getJavaType();
public CompoundSelectionImpl( XCriteriaBuilder criteriaBuilder, Class<? extends X> javaType, Iterable<Selection<?>> compoundSelectionItems) { super(criteriaBuilder); Arguments.mustNotBeNull("javaType", javaType); List<Selection<?>> list; if (compoundSelectionItems != null) { if (compoundSelectionItems instanceof Collection<?>) { list = new ArrayList<>(((Collection<?>)compoundSelectionItems).size()); } else { list = new ArrayList<>(); } int index = 0; for (Selection<?> selection : compoundSelectionItems) { if (selection != null) { Class<?> subJavaType = selection.getJavaType(); Arguments.mustNotBeArray("compoundSelectionItems[" + index + ']', subJavaType); Arguments.mustNotBeCompatibleWithValue("compoundSelectionItems[" + index + ']', subJavaType, Tuple.class); this.mustUnderSameCriteriaBuilder("compoundSelectionItems[" + index + ']', selection); list.add(selection); } index++; } } else { list = MACollections.emptyList(); } this.javaType = javaType; this.compoundSelectionItems = MACollections.unmodifiable(list); }
Class<?> type = s.getJavaType(); if (type == null) type = Object.class; if (s.isCompoundSelection()) { CompoundSelection<?> cs = (CompoundSelection<?>)s; result = new ResultShape(s.getJavaType(), CompoundSelections.getFillStrategy(cs)); List<Selection<?>> terms = cs.getCompoundSelectionItems(); for (Selection<?> term : terms) {
Class<?> type = s.getJavaType(); if (type == null) type = Object.class; if (s.isCompoundSelection()) { CompoundSelection<?> cs = (CompoundSelection<?>)s; result = new ResultShape(s.getJavaType(), CompoundSelections.getFillStrategy(cs)); List<Selection<?>> terms = cs.getCompoundSelectionItems(); for (Selection<?> term : terms) {
Class<?> type = s.getJavaType(); if (type == null) type = Object.class; if (s.isCompoundSelection()) { CompoundSelection<?> cs = (CompoundSelection<?>)s; result = new ResultShape(s.getJavaType(), CompoundSelections.getFillStrategy(cs)); List<Selection<?>> terms = cs.getCompoundSelectionItems(); for (Selection<?> term : terms) {
Class<?> type = s.getJavaType(); if (type == null) type = Object.class; if (s.isCompoundSelection()) { CompoundSelection<?> cs = (CompoundSelection<?>)s; result = new ResultShape(s.getJavaType(), CompoundSelections.getFillStrategy(cs)); List<Selection<?>> terms = cs.getCompoundSelectionItems(); for (Selection<?> term : terms) {
public ConstructorReportItem translate(){ ConstructorReportItem item = new ConstructorReportItem(this.getAlias()); item.setResultType(this.getJavaType()); item.setConstructor(constructor); for(Selection selection : this.getCompoundSelectionItems()){ if (((SelectionImpl)selection).isCompoundSelection()){ item.addItem(((ConstructorSelectionImpl)selection).translate()); }else{ ReportItem reportItem = new ReportItem(item.getName()+item.getReportItems().size(), ((SelectionImpl)selection).getCurrentNode()); //bug: 297385 - set type here because the selection already knows the type reportItem.setResultType(selection.getJavaType()); item.addItem(reportItem); } } return item; }