org.modeshape.jcr.cache

## Class PropertyTypeUtil

- java.lang.Object
- - org.modeshape.jcr.cache.PropertyTypeUtil

-     @Immutable
      public class PropertyTypeUtil
      extends Object

  A utility for working with `JCR property types` and `ModeShape property types`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PropertyTypeUtil()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `jcrPropertyTypeFor(Property property)` Compute the JCR `PropertyType` for the given ModeShape `PropertyType`.
    `static int` | `jcrPropertyTypeFor(PropertyType dnaPropertyType)` Compute the ModeShape `PropertyType` for the given JCR `PropertyType` value.
    `static PropertyType` | `modePropertyTypeFor(int jcrPropertyType)` Compute the ModeShape `PropertyType` for the given JCR `PropertyType` value.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PropertyTypeUtil

          public PropertyTypeUtil()

  - ### Method Detail

    - #### jcrPropertyTypeFor

          public static final int jcrPropertyTypeFor(Property property)

      Compute the JCR `PropertyType` for the given ModeShape `PropertyType`.

      See MODE-328 for complete discussion on why this method works the way it does. The best option appears to be basing the PropertyType on the first value, since that should be compatible with the PropertyType that was used when the values were set on the property in the first place.

      Parameters:
        `property` - the ModeShape property for which the `PropertyType` is to be determined; never null
      Returns:
        the JCR property type; always a valid value and never `PropertyType.UNDEFINED`.

    - #### modePropertyTypeFor

          public static final PropertyType modePropertyTypeFor(int jcrPropertyType)

      Compute the ModeShape `PropertyType` for the given JCR `PropertyType` value.
      Parameters:
        `jcrPropertyType` - the JCR property type for which the `ModeShape PropertyType` is to be determined; never null
      Returns:
        the ModeShape property type; always a valid value and never `PropertyType.UNDEFINED`.

    - #### jcrPropertyTypeFor

          public static final int jcrPropertyTypeFor(PropertyType dnaPropertyType)

      Compute the ModeShape `PropertyType` for the given JCR `PropertyType` value.
      Parameters:
        `dnaPropertyType` - the ModeShape property type; never null
      Returns:
        the JCR property type; always a valid value and never `PropertyType.UNDEFINED`.

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.