javax.persistence.TupleElement Java Examples
The following examples show how to use
javax.persistence.TupleElement.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractMybatisQuery.java From spring-data-mybatis with Apache License 2.0 | 6 votes |
@Override public Object convert(Object source) { if (!(source instanceof Tuple)) { return source; } Tuple tuple = (Tuple) source; List<TupleElement<?>> elements = tuple.getElements(); if (elements.size() == 1) { Object value = tuple.get(elements.get(0)); if (type.isInstance(value) || value == null) { return value; } } return new TupleBackedMap(tuple); }
Example #2
Source File: TupleConverter.java From specification-with-projection with MIT License | 6 votes |
@Override public Object convert(Object source) { if (!(source instanceof Tuple)) { return source; } Tuple tuple = (Tuple) source; List<TupleElement<?>> elements = tuple.getElements(); if (elements.size() == 1) { Object value = tuple.get(elements.get(0)); if (type.isInstance(value) || value == null) { return value; } } return new TupleConverter.TupleBackedMap(tuple); }
Example #3
Source File: CriteriaQueryTupleTransformer.java From lams with GNU General Public License v2.0 | 6 votes |
public Object get(String alias) { int index = -1; if ( alias != null ) { alias = alias.trim(); if ( alias.length() > 0 ) { int i = 0; for ( TupleElement selection : (List<TupleElement>) tupleElements ) { if ( alias.equals( selection.getAlias() ) ) { index = i; break; } i++; } } } if ( index < 0 ) { throw new IllegalArgumentException( "Given alias [" + alias + "] did not correspond to an element in the result tuple" ); } // index should be "in range" by nature of size check in ctor return tuples[index]; }
Example #4
Source File: AbstractMybatisQuery.java From spring-data-mybatis with Apache License 2.0 | 5 votes |
@Override public Set<String> keySet() { return tuple.getElements().stream() // .map(TupleElement::getAlias) // .collect(Collectors.toSet()); }
Example #5
Source File: TupleConverter.java From specification-with-projection with MIT License | 5 votes |
@Override public Set<String> keySet() { return tuple.getElements().stream() // .map(TupleElement::getAlias) // .collect(Collectors.toSet()); }
Example #6
Source File: CriteriaQueryTupleTransformer.java From lams with GNU General Public License v2.0 | 5 votes |
public <X> X get(TupleElement<X> tupleElement) { int index = tupleElements.indexOf( tupleElement ); if ( index < 0 ) { throw new IllegalArgumentException( "Requested tuple element did not correspond to element in the result tuple" ); } // index should be "in range" by nature of size check in ctor return (X) tuples[index]; }
Example #7
Source File: NativeQueryTupleTransformer.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public List<TupleElement<?>> getElements() { List<TupleElement<?>> elements = new ArrayList<>( aliasToValue.size() ); for ( Map.Entry<String, Object> entry : aliasToValue.entrySet() ) { elements.add( new NativeTupleElementImpl<>( getValueClass( entry.getValue() ), entry.getKey() ) ); } return elements; }
Example #8
Source File: TupleBuilderTransformer.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public <X> X get(TupleElement<X> tupleElement) { if ( HqlTupleElementImpl.class.isInstance( tupleElement ) ) { return get( ( (HqlTupleElementImpl) tupleElement ).getPosition(), tupleElement.getJavaType() ); } else { return get( tupleElement.getAlias(), tupleElement.getJavaType() ); } }
Example #9
Source File: NativeQueryTupleTransformer.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public <X> X get(TupleElement<X> tupleElement) { return get( tupleElement.getAlias(), tupleElement.getJavaType() ); }
Example #10
Source File: TupleBuilderTransformer.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public List<TupleElement<?>> getElements() { return tupleElements; }
Example #11
Source File: ObjectArrayTupleImplTest.java From crnk-framework with Apache License 2.0 | 4 votes |
@Test(expected = UnsupportedOperationException.class) public void testGetByTupleNotSupported() { impl.get((TupleElement<?>) null); }
Example #12
Source File: CriteriaQueryTupleTransformer.java From lams with GNU General Public License v2.0 | 4 votes |
public List<TupleElement<?>> getElements() { return tupleElements; }
Example #13
Source File: ObjectArrayTupleImpl.java From katharsis-framework with Apache License 2.0 | 4 votes |
@Override public <X> X get(TupleElement<X> element) { throw new UnsupportedOperationException(); }
Example #14
Source File: ObjectArrayTupleImpl.java From katharsis-framework with Apache License 2.0 | 4 votes |
@Override public List<TupleElement<?>> getElements() { throw new UnsupportedOperationException(); }
Example #15
Source File: CriteriaTupleImpl.java From katharsis-framework with Apache License 2.0 | 4 votes |
@Override public <X> X get(TupleElement<X> tupleElement) { throw new UnsupportedOperationException("not implemented"); }
Example #16
Source File: CriteriaTupleImpl.java From katharsis-framework with Apache License 2.0 | 4 votes |
@Override public List<TupleElement<?>> getElements() { throw new UnsupportedOperationException("not implemented"); }
Example #17
Source File: ObjectArrayTupleImplTest.java From katharsis-framework with Apache License 2.0 | 4 votes |
@Test(expected = UnsupportedOperationException.class) public void testGetByTupleNotSupported() { impl.get((TupleElement<?>) null); }
Example #18
Source File: CriteriaTupleImpl.java From crnk-framework with Apache License 2.0 | 4 votes |
@Override public List<TupleElement<?>> getElements() { throw new UnsupportedOperationException("not implemented"); }
Example #19
Source File: CriteriaTupleImpl.java From crnk-framework with Apache License 2.0 | 4 votes |
@Override public <X> X get(TupleElement<X> tupleElement) { throw new UnsupportedOperationException("not implemented"); }
Example #20
Source File: ObjectArrayTupleImpl.java From crnk-framework with Apache License 2.0 | 4 votes |
@Override public List<TupleElement<?>> getElements() { throw new UnsupportedOperationException(); }
Example #21
Source File: ObjectArrayTupleImpl.java From crnk-framework with Apache License 2.0 | 4 votes |
@Override public <X> X get(TupleElement<X> element) { throw new UnsupportedOperationException(); }