當前位置: 首頁>>代碼示例>>Java>>正文


Java AnnotationIntrospector.hasCreatorAnnotation方法代碼示例

本文整理匯總了Java中com.fasterxml.jackson.databind.AnnotationIntrospector.hasCreatorAnnotation方法的典型用法代碼示例。如果您正苦於以下問題:Java AnnotationIntrospector.hasCreatorAnnotation方法的具體用法?Java AnnotationIntrospector.hasCreatorAnnotation怎麽用?Java AnnotationIntrospector.hasCreatorAnnotation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.fasterxml.jackson.databind.AnnotationIntrospector的用法示例。


在下文中一共展示了AnnotationIntrospector.hasCreatorAnnotation方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: _handleSingleArgumentFactory

import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入方法依賴的package包/類
protected boolean _handleSingleArgumentFactory(DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription, VisibilityChecker<?> paramVisibilityChecker, AnnotationIntrospector paramAnnotationIntrospector, CreatorCollector paramCreatorCollector, AnnotatedMethod paramAnnotatedMethod, boolean paramBoolean)
{
  Class localClass = paramAnnotatedMethod.getRawParameterType(0);
  if (localClass == String.class)
  {
    if ((paramBoolean) || (paramVisibilityChecker.isCreatorVisible(paramAnnotatedMethod)))
      paramCreatorCollector.addStringCreator(paramAnnotatedMethod);
    return true;
  }
  if ((localClass == Integer.TYPE) || (localClass == Integer.class))
  {
    if ((paramBoolean) || (paramVisibilityChecker.isCreatorVisible(paramAnnotatedMethod)))
      paramCreatorCollector.addIntCreator(paramAnnotatedMethod);
    return true;
  }
  if ((localClass == Long.TYPE) || (localClass == Long.class))
  {
    if ((paramBoolean) || (paramVisibilityChecker.isCreatorVisible(paramAnnotatedMethod)))
      paramCreatorCollector.addLongCreator(paramAnnotatedMethod);
    return true;
  }
  if ((localClass == Double.TYPE) || (localClass == Double.class))
  {
    if ((paramBoolean) || (paramVisibilityChecker.isCreatorVisible(paramAnnotatedMethod)))
      paramCreatorCollector.addDoubleCreator(paramAnnotatedMethod);
    return true;
  }
  if ((localClass == Boolean.TYPE) || (localClass == Boolean.class))
  {
    if ((paramBoolean) || (paramVisibilityChecker.isCreatorVisible(paramAnnotatedMethod)))
      paramCreatorCollector.addBooleanCreator(paramAnnotatedMethod);
    return true;
  }
  if (paramAnnotationIntrospector.hasCreatorAnnotation(paramAnnotatedMethod))
  {
    paramCreatorCollector.addDelegatingCreator(paramAnnotatedMethod, null);
    return true;
  }
  return false;
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:41,代碼來源:BasicDeserializerFactory.java

示例2: _addDeserializerFactoryMethods

import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入方法依賴的package包/類
protected void _addDeserializerFactoryMethods(DeserializationContext paramDeserializationContext, BeanDescription paramBeanDescription, VisibilityChecker<?> paramVisibilityChecker, AnnotationIntrospector paramAnnotationIntrospector, CreatorCollector paramCreatorCollector)
{
  DeserializationConfig localDeserializationConfig = paramDeserializationContext.getConfig();
  Iterator localIterator = paramBeanDescription.getFactoryMethods().iterator();
  while (localIterator.hasNext())
  {
    AnnotatedMethod localAnnotatedMethod = (AnnotatedMethod)localIterator.next();
    boolean bool = paramAnnotationIntrospector.hasCreatorAnnotation(localAnnotatedMethod);
    int i = localAnnotatedMethod.getParameterCount();
    if (i == 0)
    {
      if (bool)
        paramCreatorCollector.setDefaultCreator(localAnnotatedMethod);
    }
    else if (i == 1)
    {
      AnnotatedParameter localAnnotatedParameter2 = localAnnotatedMethod.getParameter(0);
      PropertyName localPropertyName3;
      if (localAnnotatedParameter2 == null)
        localPropertyName3 = null;
      else
        localPropertyName3 = paramAnnotationIntrospector.findNameForDeserialization(localAnnotatedParameter2);
      PropertyName localPropertyName4 = localPropertyName3;
      String str2;
      if (localPropertyName3 == null)
        str2 = null;
      else
        str2 = localPropertyName4.getSimpleName();
      if ((paramAnnotationIntrospector.findInjectableValueId(localAnnotatedParameter2) == null) && ((str2 == null) || (str2.length() == 0)))
        _handleSingleArgumentFactory(localDeserializationConfig, paramBeanDescription, paramVisibilityChecker, paramAnnotationIntrospector, paramCreatorCollector, localAnnotatedMethod, bool);
      else;
    }
    else if (paramAnnotationIntrospector.hasCreatorAnnotation(localAnnotatedMethod))
    {
      Object localObject1 = null;
      CreatorProperty[] arrayOfCreatorProperty = new CreatorProperty[i];
      int j = 0;
      int k = 0;
      for (int m = 0; m < i; m++)
      {
        AnnotatedParameter localAnnotatedParameter1 = localAnnotatedMethod.getParameter(m);
        PropertyName localPropertyName1;
        if (localAnnotatedParameter1 == null)
          localPropertyName1 = null;
        else
          localPropertyName1 = paramAnnotationIntrospector.findNameForDeserialization(localAnnotatedParameter1);
        PropertyName localPropertyName2 = localPropertyName1;
        String str1;
        if (localPropertyName1 == null)
          str1 = null;
        else
          str1 = localPropertyName2.getSimpleName();
        Object localObject2 = paramAnnotationIntrospector.findInjectableValueId(localAnnotatedParameter1);
        if ((str1 != null) && (str1.length() > 0))
        {
          j++;
          arrayOfCreatorProperty[m] = constructCreatorProperty(paramDeserializationContext, paramBeanDescription, str1, m, localAnnotatedParameter1, localObject2);
        }
        else if (localObject2 != null)
        {
          k++;
          arrayOfCreatorProperty[m] = constructCreatorProperty(paramDeserializationContext, paramBeanDescription, str1, m, localAnnotatedParameter1, localObject2);
        }
        else if (localObject1 == null)
        {
          localObject1 = localAnnotatedParameter1;
        }
      }
      if ((bool) || (j > 0) || (k > 0))
        if (j + k == i)
          paramCreatorCollector.addPropertyCreator(localAnnotatedMethod, arrayOfCreatorProperty);
        else if ((j == 0) && (k + 1 == i))
          paramCreatorCollector.addDelegatingCreator(localAnnotatedMethod, arrayOfCreatorProperty);
        else
          throw new IllegalArgumentException("Argument #" + localObject1.getIndex() + " of factory method " + localAnnotatedMethod + " has no property name annotation; must have name when multiple-paramater constructor annotated as Creator");
    }
  }
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:79,代碼來源:BasicDeserializerFactory.java


注:本文中的com.fasterxml.jackson.databind.AnnotationIntrospector.hasCreatorAnnotation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。