Is this code convertible to a lambda style?
Marcos Antonio
marcos_antonio_ps at hotmail.com
Tue Dec 24 06:48:31 PST 2013
I'm really having trouble trying to convert this piece of code to lambda style, which makes me think if it is even possible.
Property getParent()
{
for (PropertyDescriptor parent : getMetadataReader().getPropertyDescriptors())
{
if (parent.getType() == PropertyType.ENTITY)
{
MetadataReader metadataReader =
DataFactory.getInstance().getMetadataReader(parent.getReaderMethod().getReturnType());
for (CollectionDescriptor collection : metadataReader.getCollectionDescriptors())
{
if (collection.isChildAssociation(parent))
{
return parent.convertToProperty()
}
}
}
}
return null;
}
I think this code seems very simple but in trying to convert it I'm not able to keep the reference to the parent to later methods in the stream pipeline.
Any help?
Thank you.
Marcos
More information about the lambda-dev
mailing list