private static Optional<PropertyDefinition> getDefinitionForPropertyName(final Node node, final String propertyName)
            throws RepositoryException {
        LOGGER.debug("Looking for property name: {}", propertyName);
        final Predicate<PropertyDefinition> sameName = p -> propertyName.equals(p.getName());

        final PropertyDefinition[] propDefs = node.getPrimaryNodeType().getPropertyDefinitions();
        final Optional<PropertyDefinition> primaryCandidate = stream(propDefs).filter(sameName).findFirst();
        return primaryCandidate.isPresent() ? primaryCandidate :
                stream(node.getMixinNodeTypes()).map(NodeType::getPropertyDefinitions).flatMap(Arrays::stream)
                        .filter(sameName).findFirst();
    }
private static Optional < PropertyDefinition > getDefinitionForPropertyName ( final Node node , final String propertyName ) throws RepositoryException { LOGGER . debug ( "Looking for property name: {}" , propertyName ) ; final Predicate < PropertyDefinition > sameName = p -> propertyName . equals ( p . getName ( ) ) ; final PropertyDefinition [ ] propDefs = node . getPrimaryNodeType ( ) . getPropertyDefinitions ( ) ; final Optional < PropertyDefinition > primaryCandidate = stream ( propDefs ) . filter ( sameName ) . findFirst ( ) ; return primaryCandidate . isPresent ( ) ? primaryCandidate : stream ( node . getMixinNodeTypes ( ) ) . map ( NodeType :: getPropertyDefinitions ) . flatMap ( Arrays :: stream ) . filter ( sameName ) . findFirst ( ) ; }
Get the property definition information (containing type and multi-value
information)

@param node the node to use for inferring the property definition
@param propertyName the property name to retrieve a definition for
@return a JCR PropertyDefinition, if available
@throws javax.jcr.RepositoryException if repository exception occurred