code: boolean canCastToTypeAndMatchesConstraints( JcrSession session,
                                                  JcrPropertyDefinition propertyDefinition,
                                                  Value value ) {
          try {
              assert value instanceof JcrValue : "Illegal implementation of Value interface";
              ((JcrValue)value).asType(propertyDefinition.getRequiredType()); // throws ValueFormatException if there's a problem
              return propertyDefinition.satisfiesConstraints(value, session);
          } catch (javax.jcr.ValueFormatException vfe) {
              // Cast failed
              return false;
          }
      }
docs: Returns <code>true</code> if <code>value</code> can be cast to <code>property.getRequiredType()</code> per the type
  conversion rules in section 3.6.4 of the JCR 2.0 specification AND <code>value</code> satisfies the constraints (if any)
  for the property definition. If the property definition has a required type of {@link PropertyType#UNDEFINED}, the cast
  will be considered to have succeeded and the value constraints (if any) will be interpreted using the semantics for the
  type specified in <code>value.getType()</code>.
  
  @param session the session in which the constraints are to be checked; may not be null
  @param propertyDefinition the property definition to validate against
  @param value the value to be validated
  @return <code>true</code> if the value can be cast to the required type for the property definition (if it exists) and
  satisfies the constraints for the property (if any exist).
  @see PropertyDefinition#getValueConstraints()
  @see JcrPropertyDefinition#satisfiesConstraints(Value,JcrSession)