public class FieldStream
extends java.lang.Object
| Constructor and Description |
|---|
FieldStream(RStream parent,
boolean withSuper) |
| Modifier and Type | Method and Description |
|---|---|
FieldWrapper |
by(int index)
Get a field by the given index.
|
FieldWrapper |
by(java.lang.String name)
Get a field by the given name.
|
FieldStream |
filter(boolean isStatic)
Filter the fields by whether they are static.
|
FieldStream |
filter(java.lang.Class<?> clazz)
Filter the fields by the given type.
|
FieldStream |
filter(java.util.Collection<java.lang.String> names)
Filter the fields by the given names.
|
FieldStream |
filter(java.util.function.Predicate<FieldWrapper> filter)
Filter the fields with the given filter.
|
FieldStream |
filter(java.lang.String... names)
Filter the fields by the given names.
|
FieldStream |
filterAnnotation(java.lang.Class<?> annotation)
Filter the fields by whether they have the given annotation.
|
FieldStream |
forEach(java.util.function.Consumer<FieldWrapper> consumer)
Loop through all fields in this stream.
|
java.util.Iterator<FieldWrapper> |
iterator() |
java.util.stream.Stream<FieldWrapper> |
jstream() |
<T> java.util.stream.Stream<T> |
map(java.util.function.Function<FieldWrapper,T> mapFunction)
Map the fields to a new stream.
|
java.util.Optional<FieldWrapper> |
opt(int index)
Get a field by the given index.
|
java.util.Optional<FieldWrapper> |
opt(java.lang.String name)
Get a field by the given name.
|
RStream |
parent() |
int |
size() |
public FieldStream(RStream parent, boolean withSuper)
public RStream parent()
public int size()
public java.util.Optional<FieldWrapper> opt(java.lang.String name)
name - The name of the fieldpublic java.util.Optional<FieldWrapper> opt(int index)
index - The index of the fieldpublic FieldWrapper by(java.lang.String name)
name - The name of the fieldFieldNotFoundException - If the field doesn't existpublic FieldWrapper by(int index)
index - The index of the fieldFieldNotFoundException - If the field doesn't existpublic FieldStream filter(java.util.function.Predicate<FieldWrapper> filter)
filter - The filterpublic FieldStream filter(java.util.Collection<java.lang.String> names)
names - The names of the fieldspublic FieldStream filter(java.lang.String... names)
names - The names of the fieldspublic FieldStream filter(java.lang.Class<?> clazz)
clazz - The typepublic FieldStream filter(boolean isStatic)
isStatic - Whether the fields should be staticpublic FieldStream filterAnnotation(java.lang.Class<?> annotation)
annotation - The annotationpublic java.util.Iterator<FieldWrapper> iterator()
public <T> java.util.stream.Stream<T> map(java.util.function.Function<FieldWrapper,T> mapFunction)
jstream() and then Stream.map(Function).T - The type of the new streammapFunction - The map functionpublic java.util.stream.Stream<FieldWrapper> jstream()
public FieldStream forEach(java.util.function.Consumer<FieldWrapper> consumer)
consumer - The consumer