Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HSEARCH-3997 Add built-in container extractors for arrays of primitiv…
…e types
- Loading branch information
Showing
12 changed files
with
299 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...org/hibernate/search/mapper/pojo/extractor/builtin/impl/BooleanArrayElementExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.mapper.pojo.extractor.builtin.impl; | ||
|
||
import java.util.function.Consumer; | ||
|
||
import org.hibernate.search.mapper.pojo.extractor.ContainerExtractor; | ||
import org.hibernate.search.mapper.pojo.extractor.builtin.BuiltinContainerExtractors; | ||
|
||
public class BooleanArrayElementExtractor implements ContainerExtractor<boolean[], Boolean> { | ||
@Override | ||
public String toString() { | ||
return BuiltinContainerExtractors.ARRAY_BOOLEAN; | ||
} | ||
|
||
@Override | ||
public void extract(boolean[] container, Consumer<Boolean> consumer) { | ||
if ( container == null ) { | ||
return; | ||
} | ||
for ( boolean element : container ) { | ||
consumer.accept( element ); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...va/org/hibernate/search/mapper/pojo/extractor/builtin/impl/ByteArrayElementExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.mapper.pojo.extractor.builtin.impl; | ||
|
||
import java.util.function.Consumer; | ||
|
||
import org.hibernate.search.mapper.pojo.extractor.ContainerExtractor; | ||
import org.hibernate.search.mapper.pojo.extractor.builtin.BuiltinContainerExtractors; | ||
|
||
public class ByteArrayElementExtractor implements ContainerExtractor<byte[], Byte> { | ||
@Override | ||
public String toString() { | ||
return BuiltinContainerExtractors.ARRAY_BYTE; | ||
} | ||
|
||
@Override | ||
public void extract(byte[] container, Consumer<Byte> consumer) { | ||
if ( container == null ) { | ||
return; | ||
} | ||
for ( byte element : container ) { | ||
consumer.accept( element ); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...va/org/hibernate/search/mapper/pojo/extractor/builtin/impl/CharArrayElementExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.mapper.pojo.extractor.builtin.impl; | ||
|
||
import java.util.function.Consumer; | ||
|
||
import org.hibernate.search.mapper.pojo.extractor.ContainerExtractor; | ||
import org.hibernate.search.mapper.pojo.extractor.builtin.BuiltinContainerExtractors; | ||
|
||
public class CharArrayElementExtractor implements ContainerExtractor<char[], Character> { | ||
@Override | ||
public String toString() { | ||
return BuiltinContainerExtractors.ARRAY_CHAR; | ||
} | ||
|
||
@Override | ||
public void extract(char[] container, Consumer<Character> consumer) { | ||
if ( container == null ) { | ||
return; | ||
} | ||
for ( char element : container ) { | ||
consumer.accept( element ); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
.../org/hibernate/search/mapper/pojo/extractor/builtin/impl/DoubleArrayElementExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.mapper.pojo.extractor.builtin.impl; | ||
|
||
import java.util.function.Consumer; | ||
|
||
import org.hibernate.search.mapper.pojo.extractor.ContainerExtractor; | ||
import org.hibernate.search.mapper.pojo.extractor.builtin.BuiltinContainerExtractors; | ||
|
||
public class DoubleArrayElementExtractor implements ContainerExtractor<double[], Double> { | ||
@Override | ||
public String toString() { | ||
return BuiltinContainerExtractors.ARRAY_DOUBLE; | ||
} | ||
|
||
@Override | ||
public void extract(double[] container, Consumer<Double> consumer) { | ||
if ( container == null ) { | ||
return; | ||
} | ||
for ( double element : container ) { | ||
consumer.accept( element ); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...a/org/hibernate/search/mapper/pojo/extractor/builtin/impl/FloatArrayElementExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.mapper.pojo.extractor.builtin.impl; | ||
|
||
import java.util.function.Consumer; | ||
|
||
import org.hibernate.search.mapper.pojo.extractor.ContainerExtractor; | ||
import org.hibernate.search.mapper.pojo.extractor.builtin.BuiltinContainerExtractors; | ||
|
||
public class FloatArrayElementExtractor implements ContainerExtractor<float[], Float> { | ||
@Override | ||
public String toString() { | ||
return BuiltinContainerExtractors.ARRAY_FLOAT; | ||
} | ||
|
||
@Override | ||
public void extract(float[] container, Consumer<Float> consumer) { | ||
if ( container == null ) { | ||
return; | ||
} | ||
for ( float element : container ) { | ||
consumer.accept( element ); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...ava/org/hibernate/search/mapper/pojo/extractor/builtin/impl/IntArrayElementExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.mapper.pojo.extractor.builtin.impl; | ||
|
||
import java.util.function.Consumer; | ||
|
||
import org.hibernate.search.mapper.pojo.extractor.ContainerExtractor; | ||
import org.hibernate.search.mapper.pojo.extractor.builtin.BuiltinContainerExtractors; | ||
|
||
public class IntArrayElementExtractor implements ContainerExtractor<int[], Integer> { | ||
@Override | ||
public String toString() { | ||
return BuiltinContainerExtractors.ARRAY_INT; | ||
} | ||
|
||
@Override | ||
public void extract(int[] container, Consumer<Integer> consumer) { | ||
if ( container == null ) { | ||
return; | ||
} | ||
for ( int element : container ) { | ||
consumer.accept( element ); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...va/org/hibernate/search/mapper/pojo/extractor/builtin/impl/LongArrayElementExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.mapper.pojo.extractor.builtin.impl; | ||
|
||
import java.util.function.Consumer; | ||
|
||
import org.hibernate.search.mapper.pojo.extractor.ContainerExtractor; | ||
import org.hibernate.search.mapper.pojo.extractor.builtin.BuiltinContainerExtractors; | ||
|
||
public class LongArrayElementExtractor implements ContainerExtractor<long[], Long> { | ||
@Override | ||
public String toString() { | ||
return BuiltinContainerExtractors.ARRAY_LONG; | ||
} | ||
|
||
@Override | ||
public void extract(long[] container, Consumer<Long> consumer) { | ||
if ( container == null ) { | ||
return; | ||
} | ||
for ( long element : container ) { | ||
consumer.accept( element ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...a/org/hibernate/search/mapper/pojo/extractor/builtin/impl/ShortArrayElementExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.mapper.pojo.extractor.builtin.impl; | ||
|
||
import java.util.function.Consumer; | ||
|
||
import org.hibernate.search.mapper.pojo.extractor.ContainerExtractor; | ||
import org.hibernate.search.mapper.pojo.extractor.builtin.BuiltinContainerExtractors; | ||
|
||
public class ShortArrayElementExtractor implements ContainerExtractor<short[], Short> { | ||
@Override | ||
public String toString() { | ||
return BuiltinContainerExtractors.ARRAY_SHORT; | ||
} | ||
|
||
@Override | ||
public void extract(short[] container, Consumer<Short> consumer) { | ||
if ( container == null ) { | ||
return; | ||
} | ||
for ( short element : container ) { | ||
consumer.accept( element ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters