Package net.sf.joafip.store.service.conversion

Examples of net.sf.joafip.store.service.conversion.ConversionException


      final FieldInfo fieldInfo = new FieldInfo(declaringClass,
          fieldName, fieldType, Boolean.valueOf(staticField),
          Boolean.valueOf(transientField));
      addNewFieldAndItsValue(fieldIndex, fieldInfo, fieldValue);
    } catch (ClassInfoException exception) {
      throw new ConversionException(exception);
    }
  }
View Full Code Here


    try {
      final ClassInfo typeInfo = fieldInfo.getFieldTypeInfo();
      if (typeInfo.classExists()) {
        final ClassInfo objectClassInfo = fieldValue.objectClassInfo;
        if (!typeInfo.isAssignableFrom(objectClassInfo)) {
          throw new ConversionException("field of type " + typeInfo
              + " not assignable from " + objectClassInfo);
        }
      }
    } catch (ClassInfoException exception) {
      throw new ConversionException(exception);
    }
  }
View Full Code Here

        // assertFieldAssignable(fieldInfo, fieldValue);
        // }
      } else {
        final int iPreviousIndex = previousIndex.intValue();
        if (iPreviousIndex != index) {
          throw new ConversionException("field \"" + fieldInfo
              + "\" have index " + iPreviousIndex
              + ", can not be set to index " + index);
        }
        final FieldInfo previousFieldInfo = fieldInfoByIndex
            .get(iPreviousIndex);
        if (!previousFieldInfo.equals(fieldInfo)) {
          throw new ConversionException("try to set field #" + index
              + " to \"" + fieldInfo + "\" and already set to \""
              + previousFieldInfo + "\"");
        }
      }
      fieldValueIndexByFieldNameMap.put(fieldName, index);
      return fieldValue;
    } catch (ClassInfoException exception) {
      throw new ConversionException(exception);
    }
  }
View Full Code Here

              conversionDefEntry.getOriginalFieldIndex(),
              replacementFieldInfo,
              conversionDefEntry.getReplacementFieldIndex());
        }
      } catch (ClassInfoException exception) {
        throw new ConversionException(exception);
      }
    }
  }
View Full Code Here

      final FieldInfo replacementFieldInfo) throws ClassInfoException,
      ConversionException {
    if (replacementFieldInfo != null
        && originalFieldInfo.isStaticField() != replacementFieldInfo
            .isStaticField()) {
      throw new ConversionException("field static type mismatch\n"
          + originalFieldInfo + "\n" + replacementFieldInfo);
    }
    return true;
  }
View Full Code Here

          originalDeclaringClass, originalFieldName,
          originalFieldType, null, null);
      final Integer index = fieldValueIndexByFieldInfoMap
          .remove(originalFieldInfo);
      if (index == null) {
        throw new ConversionException("previous field "
            + originalFieldInfo + "\n does not exist");
      }
      final FieldInfo fieldInfo = new FieldInfo(declaringClass,
          fieldName, fieldType, Boolean.valueOf(staticField),
          Boolean.valueOf(transientField));
      fieldValueIndexByFieldInfoMap.put(fieldInfo, index);
      fieldInfoByIndex.put(index, fieldInfo);
      fieldValueIndexByFieldNameMap.put(fieldName, index);
      // FIXMELUC x explain case not assignable accepted
      // assertFieldAssignable(fieldInfo, fieldsValue.get(index));
    } catch (ClassInfoException exception) {
      throw new ConversionException(exception);
    }
  }
View Full Code Here

    if (ClassInfo.NULL.equals(converterClass)) {
      converterClass = conversionDefEntry.getConverterClass();
    } else if (!ClassInfo.NULL.equals(conversionDefEntry
        .getConverterClass())) {
      throw new ConversionException("can not change converter class "
          + converterClass + " to "
          + conversionDefEntry.getConverterClass() + FOR
          + conversionDefEntry);
    }
    if (ClassInfo.NULL.equals(staticConverterClass)) {
      staticConverterClass = conversionDefEntry.getStaticConverterClass();
    } else if (ClassInfo.NULL.equals(conversionDefEntry
        .getStaticConverterClass())) {
      throw new ConversionException(
          "can not change static converter class "
              + staticConverterClass + " to "
              + conversionDefEntry.getStaticConverterClass()
              + FOR + conversionDefEntry);
    }

    if (ClassInfo.NULL.equals(replacementClass)) {
      replacementClass = newReplacementClass;
    } else if (!ClassInfo.NULL.equals(newReplacementClass)
        && !replacementClass.equals(newReplacementClass)) {
      throw new ConversionException("replacement class missmatch was "
          + replacementClass + " and update with "
          + newReplacementClass + FOR + conversionDefEntry);
    }
    if (conversionDefEntry.isFieldReplacementDef()) {
      final FieldInfo originalFieldInfo = conversionDefEntry
          .getOriginalFieldInfo();
      final FieldInfo replacementFieldInfo = conversionDefEntry
          .getReplacementFieldInfo();
      try {
        // ASSERTX
        assert assertPerisstenceType(originalFieldInfo,
            replacementFieldInfo);
        if (originalFieldInfo.isStaticField()) {
          staticFieldConversionMap.add(originalFieldInfo,
              conversionDefEntry.getOriginalFieldIndex(),
              replacementFieldInfo,
              conversionDefEntry.getReplacementFieldIndex());
        } else {
          fieldConversionMap.add(originalFieldInfo,
              conversionDefEntry.getOriginalFieldIndex(),
              replacementFieldInfo,
              conversionDefEntry.getReplacementFieldIndex());
        }
      } catch (ClassInfoException exception) {
        throw new ConversionException("for\n" + conversionDefEntry,
            exception);
      }
    }
    if (fieldList.isEmpty()) {
      fieldList = conversionDefEntry.getFieldList();
      // ASSERTX
      assert fieldList != null : "field list can not be null, for\n"
          + conversionDefEntry;
    } else if (!conversionDefEntry.getFieldList().isEmpty()) {
      throw new ConversionException("duplicate field list definition, "
          + fieldList + ", and " + conversionDefEntry.getFieldList()
          + FOR + conversionDefEntry);
    }
  }
View Full Code Here

  public void changeOrder(final int[] newIndexList)
      throws ConversionException {
    // fieldsValue.changeOrder(newIndex);
    final int size = fieldsValue.size();
    if (newIndexList.length != size) {
      throw new ConversionException("bad index array size");
    }

    FieldInfo[] fieldInfos = new FieldInfo[size];
    for (Entry<FieldInfo, Integer> entry : fieldValueIndexByFieldInfoMap
        .entrySet()) {
View Full Code Here

  private boolean assertUpdateParamater(
      final ConversionDefEntry conversionDefEntry)
      throws ConversionException {
    if (!classInfo.equals(conversionDefEntry.getClassInfo())) {
      throw new ConversionException("original class mismatch, this is "
          + classInfo + ", and update with "
          + conversionDefEntry.getClassInfo() + FOR
          + conversionDefEntry);
    }
    if (identifier != conversionDefEntry.getIdentifier()) {
      throw new ConversionException("from identifier mismatch, this is "
          + identifier + ", and update with "
          + conversionDefEntry.getIdentifier() + FOR
          + conversionDefEntry);
    }
    if (toIdentifier != conversionDefEntry.getToIdentifier()) {
      throw new ConversionException("to identifier mismatch, this is "
          + toIdentifier + ", and update with "
          + conversionDefEntry.getToIdentifier() + FOR
          + conversionDefEntry);
    }
    return true;
View Full Code Here

      } else {
        fieldConversionMap.add(originalFieldInfo, originalFieldIndex,
            replacementFieldInfo, replacementFieldIndex);
      }
    } catch (ClassInfoException exception) {
      throw new ConversionException(exception);
    }
  }
View Full Code Here

TOP

Related Classes of net.sf.joafip.store.service.conversion.ConversionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.