final JcrPropertyDefinition findBestPropertyDefinition ( Name primaryTypeNameOfParent , Collection < Name > mixinTypeNamesOfParent , org . modeshape . jcr . value . Property property , boolean isSingle , boolean skipProtected , boolean skipConstraints , NodeTypes nodeTypes ) { JcrPropertyDefinition definition = null ; int propertyType = PropertyTypeUtil . jcrPropertyTypeFor ( property ) ; // If single-valued ... ValueFactories factories = context ( ) . getValueFactories ( ) ; if ( isSingle ) { // Create a value for the ModeShape property value ... Object value = property . getFirstValue ( ) ; Value jcrValue = new JcrValue ( factories , propertyType , value ) ; definition = nodeTypes . findPropertyDefinition ( session , primaryTypeNameOfParent , mixinTypeNamesOfParent , property . getName ( ) , jcrValue , true , skipProtected ) ; } else { // Create values for the ModeShape property value ... Value [ ] jcrValues = new Value [ property . size ( ) ] ; int index = 0 ; for ( Object value : property ) { jcrValues [ index ++ ] = new JcrValue ( factories , propertyType , value ) ; } definition = nodeTypes . findPropertyDefinition ( session , primaryTypeNameOfParent , mixinTypeNamesOfParent , property . getName ( ) , jcrValues , skipProtected ) ; } if ( definition != null ) return definition ; // No definition that allowed the values ... return null ; }
Find the best property definition in this node s primary type and mixin types .