Class PropertyUtils


  • public class PropertyUtils
    extends java.lang.Object
    Some basic functions that aide our use of properties, or help consolidate logic.
    • Constructor Detail

      • PropertyUtils

        public PropertyUtils()
    • Method Detail

      • coerceUnchecked

        public static java.lang.Object coerceUnchecked​(Property<?> target,
                                                       java.lang.Object value)
                                                throws PropertyTypeException
        This version of coerce does not return a generic type, and also will return a string if the incoming value appears to be a reference.
        Throws:
        PropertyTypeException
      • isDefault

        public static boolean isDefault​(Property<?> property,
                                        java.lang.Object value)
        Returns true if the value is *essentially* equal to the default value of the property. "Essentially" means normal equality, but also, Empty List or PropertySet to null and vice versa.
      • values

        public static <T extends Property<?>> T[] values​(java.lang.Class<?> classToSearch,
                                                         java.lang.Class<? extends T> propType)
        Searches the provided class for static Property values and returns them as an array. Does not return null.
        Parameters:
        classToSearch - the class that has static property definitions
        propType - the class type of the properties.
      • getReferenceAsString

        public static java.lang.String getReferenceAsString​(java.lang.Object value)
      • isReference

        public static boolean isReference​(java.lang.Object value)
      • bindParameterReference

        public static BoundValue bindParameterReference​(java.lang.Object value)
      • setPotentialParameterBoundValue

        public static void setPotentialParameterBoundValue​(PropertySet props,
                                                           Property<?> prop,
                                                           java.lang.Object value)
        Works with potentially non-bindable propertyset, and strings that may not have references. If not a reference, will try to coerce into correct value.
      • anyModified

        public static boolean anyModified​(VersionedPropertySet diff,
                                          Property<?>... props)
        Returns true if any of the provided properties are marked as modified in the diff.
      • anyModified

        public static boolean anyModified​(VersionedPropertySet diff,
                                          java.util.Collection<Property<?>> props)
        Returns true if any of the provided properties are marked as modified in the diff.