Package com.tangosol.util
Class Extractors
- java.lang.Object
- 
- com.tangosol.util.Extractors
 
- 
 public class Extractors extends Object Simple Extractor DSL.The methods in this class are for the most part simple factory methods for various ValueExtractorclasses, but in some cases provide additional type safety. They also tend to make the code more readable, especially if imported statically, so their use is strongly encouraged in lieu of direct construction ofExtractorclasses.- Author:
- lh, hr, as, mf 2018.06.14
 
- 
- 
Constructor SummaryConstructors Constructor Description Extractors()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static <T,R>
 ValueExtractor<T,R>chained(ValueExtractor<?,?>... extractors)Returns an extractor that extracts the specified fields where extraction occurs in a chain where the result of each field extraction is the input to the next extractor.static <T,R>
 ValueExtractor<T,R>chained(String... fields)Returns an extractor that extracts the specified fields where extraction occurs in a chain where the result of each field extraction is the input to the next extractor.static <T,E>
 ValueExtractor<T,E>extract(String from)Returns an extractor that extracts the value of the specified field.static <T,E>
 ValueExtractor<T,E>extract(String from, Object... aoParam)Returns an extractor that extracts the value of the specified field.static <T> ValueExtractor<T,Fragment<T>>fragment(ValueExtractor<? super T,?>... aExtractors)Return aValueExtractorthat extracts aFragmentfrom a target object.static <T,E>
 ValueExtractor<T,Fragment<E>>fragment(ValueExtractor<? super T,E> from, ValueExtractor<? super E,?>... aExtractors)Return aValueExtractorthat extracts a nestedFragmentfrom a property of the target object.static <T> ValueExtractor<T,?>fromPof(int... indexes)Returns an extractor that extracts the value of the specified index(es) from a POF encoded binary value.static <T,E>
 ValueExtractor<T,E>fromPof(Class<E> cls, int... indexes)Returns an extractor that extracts the value of the specified index(es) from a POF encoded binary value.static <T,E>
 ValueExtractor<T,E>fromPof(Class<E> cls, PofNavigator navigator)Returns an extractor that extracts the value of the specified index(es) from a POF encoded binary value.static <T,E>
 ValueExtractor<T,E>fromPof(Class<E> cls, String sPath)Returns an extractor that extracts the value of the specified index(es) from a POF encoded@PortableType.static <T> ValueExtractor<T,T>identity()Returns an extractor that always returns its input argument.static <T,E>
 ValueExtractor<T,E>identityCast()Returns an extractor that casts its input argument.static <T> ValueExtractor<T,List<?>>multi(ValueExtractor<T,?>... extractors)Returns an extractor that extracts values using the specifiedValueExtractors and returns the extracted values in aList.static <T> ValueExtractor<T,List<?>>multi(String... fields)Returns an extractor that extracts the specified fields and returns the extracted values in aList.static <T,E>
 ValueExtractor<T,E>script(String sLanguage, String sScriptPath, Object... aoArgs)Instantiate aValueExtractorthat is implemented using the specified language.
 
- 
- 
- 
Method Detail- 
identitypublic static <T> ValueExtractor<T,T> identity() Returns an extractor that always returns its input argument.- Type Parameters:
- T- the type of the input and output objects to the function
- Returns:
- an extractor that always returns its input argument
 
 - 
extractpublic static <T,E> ValueExtractor<T,E> extract(String from) Returns an extractor that extracts the value of the specified field.- Type Parameters:
- T- the type of the object to extract from
- E- the type of the extracted value
- Parameters:
- from- the name of the field or method to extract the value from
- Returns:
- an extractor that extracts the value of the specified field
- See Also:
- UniversalExtractor
 
 - 
extractpublic static <T,E> ValueExtractor<T,E> extract(String from, Object... aoParam) Returns an extractor that extracts the value of the specified field.- Type Parameters:
- T- the type of the object to extract from
- E- the type of the extracted value
- Parameters:
- from- the name of the method to extract the value from (which must be the full method name)
- aoParam- the parameters to pass to the method
- Returns:
- an extractor that extracts the value of the specified field
- See Also:
- UniversalExtractor
 
 - 
multipublic static <T> ValueExtractor<T,List<?>> multi(String... fields) Returns an extractor that extracts the specified fields and returns the extracted values in aList.- Type Parameters:
- T- the type of the object to extract from
- Parameters:
- fields- the field names to extract
- Returns:
- an extractor that extracts the value(s) of the specified field(s)
- Throws:
- IllegalArgumentException- if the fields parameter is null or an empty array
- See Also:
- UniversalExtractor
 
 - 
multipublic static <T> ValueExtractor<T,List<?>> multi(ValueExtractor<T,?>... extractors) Returns an extractor that extracts values using the specifiedValueExtractors and returns the extracted values in aList.- Type Parameters:
- T- the type of the object to extract from
- Parameters:
- extractors- the- ValueExtractors to use to extract the list of values
- Returns:
- an extractor that extracts the value(s) of the specified field(s)
- Throws:
- IllegalArgumentException- if the fields parameter is null or an empty array
- See Also:
- UniversalExtractor
 
 - 
chainedpublic static <T,R> ValueExtractor<T,R> chained(String... fields) Returns an extractor that extracts the specified fields where extraction occurs in a chain where the result of each field extraction is the input to the next extractor. The result returned is the result of the final extractor in the chain.- Type Parameters:
- T- the type of the object to extract from
- Parameters:
- fields- the field names to extract (if any field name contains a dot '.' that field name is split into multiple field names delimiting on the dots.
- Returns:
- an extractor that extracts the value(s) of the specified field(s)
- Throws:
- IllegalArgumentException- if the fields parameter is null or an empty array
- See Also:
- UniversalExtractor
 
 - 
chainedpublic static <T,R> ValueExtractor<T,R> chained(ValueExtractor<?,?>... extractors) Returns an extractor that extracts the specified fields where extraction occurs in a chain where the result of each field extraction is the input to the next extractor. The result returned is the result of the final extractor in the chain.- Type Parameters:
- T- the type of the object to extract from
- Parameters:
- extractors- the- ValueExtractors to use to extract the list of values
- Returns:
- an extractor that extracts the value(s) of the specified field(s)
- Throws:
- IllegalArgumentException- if the extractors parameter is null or an empty array
- See Also:
- UniversalExtractor
 
 - 
identityCastpublic static <T,E> ValueExtractor<T,E> identityCast() Returns an extractor that casts its input argument.- Type Parameters:
- T- the type of the input objects to the function
- E- the type of the output objects to the function
- Returns:
- an extractor that always returns its input argument
 
 - 
fromPofpublic static <T> ValueExtractor<T,?> fromPof(int... indexes) Returns an extractor that extracts the value of the specified index(es) from a POF encoded binary value.- Type Parameters:
- T- the type of the object to extract from
- Parameters:
- indexes- the POF index(es) to extract
- Returns:
- an extractor that extracts the value of the specified field
 
 - 
fromPofpublic static <T,E> ValueExtractor<T,E> fromPof(Class<E> cls, int... indexes) Returns an extractor that extracts the value of the specified index(es) from a POF encoded binary value.- Type Parameters:
- T- the type of the POF serialized object to extract from
- E- the type of the extracted value
- Parameters:
- indexes- the POF index(es) to extract
- Returns:
- an extractor that extracts the value of the specified field
- Throws:
- NullPointerException- if the indexes parameter is null
 
 - 
fromPofpublic static <T,E> ValueExtractor<T,E> fromPof(Class<E> cls, String sPath) Returns an extractor that extracts the value of the specified index(es) from a POF encoded@PortableType.The specified class *must* be marked with @PortableTypeannotation and instrumented usingPortableTypeGeneratorin order for this method to work. Otherwise, anIllegalArgumentExceptionwill be thrown.- Type Parameters:
- T- the type of the POF serialized object to extract from
- E- the type of the extracted value
- Parameters:
- sPath- the path of the property to extract
- Returns:
- an extractor that extracts the value of the specified field
- Throws:
- NullPointerException- if the indexes parameter is null
- IllegalArgumentException- if the specified class isn't a portable type, or the specified property path doesn't exist
 
 - 
fromPofpublic static <T,E> ValueExtractor<T,E> fromPof(Class<E> cls, PofNavigator navigator) Returns an extractor that extracts the value of the specified index(es) from a POF encoded binary value.- Type Parameters:
- T- the type of the POF serialized object to extract from
- E- the type of the extracted value
- Parameters:
- navigator- the- PofNavigatorto use to determine the POF path to extract
- Returns:
- an extractor that extracts the value of the specified field
- Throws:
- NullPointerException- if the indexes parameter is null
 
 - 
scriptpublic static <T,E> ValueExtractor<T,E> script(String sLanguage, String sScriptPath, Object... aoArgs) Instantiate aValueExtractorthat is implemented using the specified language.- Type Parameters:
- T- the type of object to extract from
- E- the type of the extracted value
- Parameters:
- sLanguage- the string specifying one of the supported languages
- sScriptPath- the path where the script reside, relative to root
- aoArgs- the arguments to be passed to the script
- Returns:
- An instance of ValueExtractor
- Throws:
- ScriptException- if the- scriptcannot be loaded or any errors occur during its execution
- IllegalArgumentException- if the specified language is not supported
- Since:
- 14.1.1.0
 
 - 
fragment@SafeVarargs public static <T> ValueExtractor<T,Fragment<T>> fragment(ValueExtractor<? super T,?>... aExtractors) Return aValueExtractorthat extracts aFragmentfrom a target object.- Type Parameters:
- T- the type of object to extract from
- Parameters:
- aExtractors- an array of extractors to pass to- FragmentExtractor
- Returns:
- a ValueExtractorthat extracts aFragmentfrom a target object
 
 - 
fragment@SafeVarargs public static <T,E> ValueExtractor<T,Fragment<E>> fragment(ValueExtractor<? super T,E> from, ValueExtractor<? super E,?>... aExtractors) Return aValueExtractorthat extracts a nestedFragmentfrom a property of the target object.- Type Parameters:
- T- the type of the root object to extract from
- Parameters:
- from- an extractor for the nested property to extract the fragment from
- aExtractors- an array of extractors to pass to- FragmentExtractor
- Returns:
- a ValueExtractorthat extracts aFragmentfrom a target object's property
 
 
- 
 
-