类 ImmutableObjects

java.lang.Object
org.babyfish.jimmer.ImmutableObjects

public class ImmutableObjects extends Object
  • 方法详细资料

    • isLoaded

      public static boolean isLoaded(Object immutable, int prop)
      Jimmer object is dynamic, none properties are mandatory. This method can ask whether a property of the object is specified.
      参数:
      immutable - Object instance
      prop - Property id
      返回:
      Whether the property of the object is specified.
      抛出:
      IllegalArgumentException - The first argument is immutable object created by jimmer
    • isLoaded

      public static boolean isLoaded(Object immutable, String prop)
      Jimmer object is dynamic, none properties are mandatory. This method can ask whether a property of the object is specified.
      参数:
      immutable - Object instance
      prop - Property name
      返回:
      Whether the property of the object is specified.
      抛出:
      IllegalArgumentException - The first argument is immutable object created by jimmer
    • get

      public static Object get(Object immutable, int prop)
      Get the property value of immutable object, if the property is not loaded, exception will be thrown.
      参数:
      immutable - Object instance
      prop - Property id
      返回:
      Whether the property of the object is specified.
      抛出:
      IllegalArgumentException - There are two possibilities
      • The first argument is immutable object created by jimmer
      • The second argument is not a valid property name of immutable object
      UnloadedException - The property is not loaded
    • get

      public static Object get(Object immutable, String prop)
      Get the property value of immutable object, if the property is not loaded, exception will be thrown.
      参数:
      immutable - Object instance
      prop - Property name
      返回:
      Whether the property of the object is specified.
      抛出:
      IllegalArgumentException - There are two possibilities
      • The first argument is immutable object created by jimmer
      • The second argument is not a valid property name of immutable object
      UnloadedException - The property is not loaded
    • isIdOnly

      public static boolean isIdOnly(Object immutable)
    • isLonely

      public static boolean isLonely(Object immutable)
    • toString

      public static String toString(Object immutable)
      Convert an object to a JSON string. If the object is jimmer immutable object, unspecified properties can be automatically ignored.
      参数:
      immutable - Any object
      返回:
      JSON string
    • fromString

      public static <I> I fromString(Class<I> type, String json) throws com.fasterxml.jackson.core.JsonProcessingException
      Convert a JSON string to an object.
      参数:
      type - Object type, can be interface type.
      返回:
      Deserialized object
      抛出:
      com.fasterxml.jackson.core.JsonProcessingException