Class JsonViewUtils

java.lang.Object
cn.dinodev.spring.commons.json.JsonViewUtils

public class JsonViewUtils extends Object
Author:
Cody Lu
  • Constructor Details

    • JsonViewUtils

      public JsonViewUtils()
  • Method Details

    • isInView

      public static boolean isInView(Class<?> activeView, Class<?>[] views)
      判断是否在指定的视图中
      Parameters:
      activeView - 视图
      views - 视图集合
      Returns:
      true:在视图集合中,或者activeView==null, 或者views为空;false:不在视图集合中
    • isInView

      public static boolean isInView(Class<?> activeView, Class<?>[] views, boolean defaultViewInclusion)
      判断是否在指定的视图中
      Parameters:
      activeView - 视图
      views - 视图集合
      defaultViewInclusion - 是否默认包含默认视图
      Returns:
      true:在视图集合中,或者activeView==null, 或者(views为空&&defaultViewInclusion==true);false:不在视图集合中
    • findViews

      public static Class<?>[] findViews(AnnotatedElement element)
      获取方法的视图
      Parameters:
      element - Method, Field, Constructor, Parameter, Class等
      Returns:
      视图,如果没有视图或者方法为null,则返回null
    • isInView

      public static boolean isInView(AnnotatedElement element, Class<?> activeView)
      判断Method, Field, Constructor, Parameter, Class等是否在指定的视图中
      Parameters:
      element - Method, Field, Constructor, Parameter, Class等
      activeView - 视图
    • isInView

      public static boolean isInView(AnnotatedElement element, Class<?> activeView, boolean defaultViewInclusion)
      判断Method, Field, Constructor, Parameter, Class等是否在指定的视图中
      Parameters:
      element - Method, Field, Constructor, Parameter, Class等
      activeView - 视图
      defaultViewInclusion - 是否默认包含默认视图
      Returns: