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


Java XStreamImplicit類代碼示例

本文整理匯總了Java中com.thoughtworks.xstream.annotations.XStreamImplicit的典型用法代碼示例。如果您正苦於以下問題:Java XStreamImplicit類的具體用法?Java XStreamImplicit怎麽用?Java XStreamImplicit使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: processImplicitAnnotation

import com.thoughtworks.xstream.annotations.XStreamImplicit; //導入依賴的package包/類
private void processImplicitAnnotation(final Field field) {
    final XStreamImplicit implicitAnnotation = field.getAnnotation(XStreamImplicit.class);
    if (implicitAnnotation != null) {
        if (implicitCollectionMapper == null) {
            throw new InitializationException("No " + ImplicitCollectionMapper.class.getName() + " available");
        }
        final String fieldName = field.getName();
        final String itemFieldName = implicitAnnotation.itemFieldName();
        final String keyFieldName = implicitAnnotation.keyFieldName();
        final boolean isMap = Map.class.isAssignableFrom(field.getType());
        Class<?> itemType = null;
        if (!field.getType().isArray()) {
            final Type genericType = field.getGenericType();
            if (genericType instanceof ParameterizedType) {
                final Type[] actualTypeArguments = ((ParameterizedType)genericType).getActualTypeArguments();
                final Type typeArgument = actualTypeArguments[isMap ? 1 : 0];
                itemType = getClass(typeArgument);
            }
        }
        if (isMap) {
            implicitCollectionMapper.add(field.getDeclaringClass(), fieldName, itemFieldName != null
                && !"".equals(itemFieldName) ? itemFieldName : null, itemType, keyFieldName != null
                && !"".equals(keyFieldName) ? keyFieldName : null);
        } else {
            if (itemFieldName != null && !"".equals(itemFieldName)) {
                implicitCollectionMapper.add(field.getDeclaringClass(), fieldName, itemFieldName, itemType);
            } else {
                implicitCollectionMapper.add(field.getDeclaringClass(), fieldName, itemType);
            }
        }
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:33,代碼來源:AnnotationMapper.java

示例2: processImplicitAnnotation

import com.thoughtworks.xstream.annotations.XStreamImplicit; //導入依賴的package包/類
private void processImplicitAnnotation(final Field field) {
    final XStreamImplicit implicitAnnotation = field.getAnnotation(XStreamImplicit.class);
    if (implicitAnnotation != null) {
        if (implicitCollectionMapper == null) {
            throw new InitializationException("No " + ImplicitCollectionMapper.class.getName() + " available");
        }
        final String fieldName = field.getName();
        final String itemFieldName = implicitAnnotation.itemFieldName();
        final String keyFieldName = implicitAnnotation.keyFieldName();
        final boolean isMap = Map.class.isAssignableFrom(field.getType());
        Class<?> itemType = null;
        if (!field.getType().isArray()) {
            final Type genericType = field.getGenericType();
            if (genericType instanceof ParameterizedType) {
                final Type[] actualTypeArguments = ((ParameterizedType)genericType).getActualTypeArguments();
                final Type typeArgument = actualTypeArguments[isMap ? 1 : 0];
                itemType = getClass(typeArgument);
            }
        }
        if (isMap) {
            implicitCollectionMapper.add(field.getDeclaringClass(), fieldName, itemFieldName != null
                && !"".equals(itemFieldName) ? itemFieldName : null, itemType, keyFieldName != null
                    && !"".equals(keyFieldName) ? keyFieldName : null);
        } else {
            if (itemFieldName != null && !"".equals(itemFieldName)) {
                implicitCollectionMapper.add(field.getDeclaringClass(), fieldName, itemFieldName, itemType);
            } else {
                implicitCollectionMapper.add(field.getDeclaringClass(), fieldName, itemType);
            }
        }
    }
}
 
開發者ID:x-stream,項目名稱:xstream,代碼行數:33,代碼來源:AnnotationMapper.java

示例3: processImplicitAnnotation

import com.thoughtworks.xstream.annotations.XStreamImplicit; //導入依賴的package包/類
private void processImplicitAnnotation(Field paramField)
{
  XStreamImplicit localXStreamImplicit = (XStreamImplicit)paramField.getAnnotation(XStreamImplicit.class);
  if (localXStreamImplicit != null)
  {
    if (this.implicitCollectionMapper == null)
      throw new InitializationException("No " + ImplicitCollectionMapper.class.getName() + " available");
    String str1 = paramField.getName();
    String str2 = localXStreamImplicit.itemFieldName();
    String str3 = localXStreamImplicit.keyFieldName();
    boolean bool1 = Map.class.isAssignableFrom(paramField.getType());
    boolean bool2 = paramField.getType().isArray();
    Class localClass1 = null;
    if (!bool2)
    {
      Type localType = paramField.getGenericType();
      boolean bool3 = localType instanceof ParameterizedType;
      localClass1 = null;
      if (bool3)
      {
        Type[] arrayOfType = ((ParameterizedType)localType).getActualTypeArguments();
        int i;
        if (bool1)
          i = 1;
        else
          i = 0;
        localClass1 = getClass(arrayOfType[i]);
      }
    }
    if (bool1)
    {
      ImplicitCollectionMapper localImplicitCollectionMapper = this.implicitCollectionMapper;
      Class localClass2 = paramField.getDeclaringClass();
      String str4;
      if ((str2 != null) && (!"".equals(str2)))
        str4 = str2;
      else
        str4 = null;
      Class localClass3 = localClass1;
      String str5;
      if ((str3 != null) && (!"".equals(str3)))
        str5 = str3;
      else
        str5 = null;
      localImplicitCollectionMapper.add(localClass2, str1, str4, localClass3, str5);
      return;
    }
    if ((str2 != null) && (!"".equals(str2)))
    {
      this.implicitCollectionMapper.add(paramField.getDeclaringClass(), str1, str2, localClass1);
      return;
    }
    this.implicitCollectionMapper.add(paramField.getDeclaringClass(), str1, localClass1);
  }
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:56,代碼來源:AnnotationMapper.java


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