Package net.sf.joafip.store.entity.classinfo

Examples of net.sf.joafip.store.entity.classinfo.FieldInfo


      final ClassInfo fieldType = originalFieldInfo.getFieldTypeInfo();
      final ClassInfo newFieldType = replacementClass(fromIdentifier,
          fieldType);

      final FieldInfo replacementFieldInfo;
      if (newFieldType == null) {
        // replacementFieldInfo = null;//originalFieldInfo;
        replacementFieldInfo = originalFieldInfo;
      } else {
        replacementFieldInfo = new FieldInfoForSerialization(
View Full Code Here


        assert assertFieldDefined(fieldInfo);
        // ASSERTX
        assert assertClassExists(fieldInfo);
        Integer index = convertedValuedFieldList
            .getFieldIndexByFieldInfo(fieldInfo);
        final FieldInfo toRemove;
        if (index == null) {
          index = convertedValuedFieldList
              .getFieldIndexByFieldName(fieldInfo.getFieldName());
          if (index == null) {
            // throw new ImportException(
View Full Code Here

  }

  public void setObjectState(final Object object, final ClassInfo classInfo,
      final ValuedFieldList valuedFieldList) throws ImportException {
    for (final ValuedField valuedField : valuedFieldList.getValuedFields()) {
      final FieldInfo fieldInfo = valuedField.getFieldInfo();
      final ObjectAndPersistInfo fieldValue = valuedField.getValue();
      try {
        helperReflect.setFieldValue(object, fieldInfo,
            fieldValue.getObject());
      } catch (final ReflectException exception) {
View Full Code Here

      final ObjectModelForImport fieldObjectModel = (ObjectModelForImport) data;

      final ObjectAndPersistInfo fieldObjectAndPersistInfo =
      /**/createObjectAndPersistInfo(fieldObjectModel);

      final FieldInfo fieldInfo = createFieldInfo(
          fieldDeclaringClassDef.getClassInfo(),
          fieldTypeDef.getClassInfo(), currentFieldName,
          Boolean.TRUE, Boolean.FALSE);

      if (fieldInfo != null) {
View Full Code Here

      throws ConversionException {
    final ValuedFieldList result = new ValuedFieldList();
    int index = 0;
    for (ValuedField fieldValue : valuedFieldList.getValuedFields()) {
      // replacement for read field by fieldInfo
      final FieldInfo fieldInfo = fieldValue.getFieldInfo();
      final FieldReplacementDef fieldReplacementDef;
      fieldReplacementDef = replacementDef
          .getReplacementFieldInfo(fieldInfo);
      final ObjectAndPersistInfo fiedlValue = fieldValue.getValue();
      if (fieldReplacementDef == null) {
        result.addNewFieldAndItsValue(index++, fieldInfo, fiedlValue);
      } else if (!fieldReplacementDef.isDeletedField()) {
        final FieldInfo newFieldInfo = fieldReplacementDef
            .getFieldInfo();
        result.addNewFieldAndItsValue(index++, newFieldInfo, fiedlValue);
      }
    }
    return result;
View Full Code Here

              "bad field definition, must not have field index declaration \""
                  + elts[fieldDefIndex]);
        }
        final ClassInfo fieldClass = classForName(fieldClassName);
        final ClassInfo declaringClass = classForName(declaringClassName);
        FieldInfo fieldInfo;
        try {
          // FIXMELUC ______known field
          fieldInfo = new FieldInfo(declaringClass, fieldName,// NOPMD
              fieldClass, staticField, transientField);
        } catch (ClassInfoException exception) {
          throw new ConversionException("bad field definition \""
              + elts[fieldDefIndex], exception);
        }
        conversionDefEntry.addToFieldList(fieldInfo);
      }

    } else {
      /*
       * replacement definition
       */
      if (listSize < 3 || listSize > 5) {// NOPMD
        throw new ConversionException("3 thru 5 elements expected for "
            + listSize + " get");
      } else {
        final int toIdentifier = computeIdentifier(elts[2]);
        if (listSize == 3) {
          conversionDefEntry = new ConversionDefEntry(originalClass,
              oldIdentifier, ClassInfo.NULL, toIdentifier,
              ClassInfo.NULL, ClassInfo.NULL);
        } else {
          final ClassInfo converterClass;
          final ClassInfo staticConverterClass;
          if (listSize == 5) {
            final String[] converterClassDef = elts[4].split(":");
            if (converterClassDef.length == 1) {
              converterClass = classForName(converterClassDef[0]);
              staticConverterClass = ClassInfo.NULL;
            } else if (converterClassDef.length == 2
                && "static".equals(converterClassDef[0])) {
              staticConverterClass = classForName(converterClassDef[1]);
              converterClass = ClassInfo.NULL;
            } else {
              throw new ConversionException(
                  "bad conversion class declaration \""
                      + elts[4] + "\"");
            }
          } else {
            converterClass = ClassInfo.NULL;
            staticConverterClass = ClassInfo.NULL;
          }

          try {
            fieldDefParser.parse(elts[3]);
          } catch (ConversionException exception) {
            throw new ConversionException(
                "bad replacemet class/field definition \""
                    + elts[3] + "\"", exception);
          }
          final String replacementClassName = fieldDefParser
              .getClassName();
          if (replacementClassName == null) {
            throw new ConversionException(
                "bad replacement class/field definition \""
                    + elts[3] + "\"");
          }
          final String replacementFieldName = fieldDefParser
              .getFieldName();
          final int replacementFieldIndex = fieldDefParser
              .getFieldIndex();
          final String replacementFieldClassName = normalizeClassName(fieldDefParser
              .getFieldClassName());
          final String replacementFieldDeclaringClassName = fieldDefParser
              .getFieldDeclaringClassName();
          final Boolean replacementStaticField = fieldDefParser
              .getStaticField();
          final Boolean replacementTransientField = fieldDefParser
              .getTransientField();
          final ClassInfo replacementFieldDeclaringClass;
          final ClassInfo replacementClass = classForName(replacementClassName);
          if (replacementFieldDeclaringClassName == null) {
            replacementFieldDeclaringClass = replacementClass;
          } else {
            replacementFieldDeclaringClass = classForName(replacementFieldDeclaringClassName);
          }

          if (originalFieldName == null) {
            conversionDefEntry = new ConversionDefEntry(
                originalClass, oldIdentifier, replacementClass,
                toIdentifier, converterClass,
                staticConverterClass);
          } else {
            final ClassInfo originalFieldDeclaringClass;
            if (originalFieldDeclaringClassName == null) {
              originalFieldDeclaringClass = originalClass;
            } else {
              originalFieldDeclaringClass = classForName(originalFieldDeclaringClassName);
            }
            final ClassInfo originalFieldType;
            if (originalFieldClassName == null) {
              originalFieldType = ClassInfo.NULL;
            } else {
              originalFieldType = classForName(originalFieldClassName);
            }
            final FieldInfo originalFieldInfo;
            try {
              originalFieldInfo = new FieldInfo(
                  originalFieldDeclaringClass,
                  originalFieldName, originalFieldType,
                  originalStaticField, originalTransientField);
            } catch (ClassInfoException exception) {
              throw new ConversionException(
                  "bad replacement class \"" + elts[1] + "\"",
                  exception);
            }
            try {
              final FieldInfo replacementFieldInfo;
              if (replacementFieldName == null) {
                replacementFieldInfo = null;
              } else {
                final ClassInfo replacementFieldType;
                if (replacementFieldClassName == null) {
                  throw new ConversionException(
                      "bad replacement class/field type must be defined \""
                          + elts[3] + "\"");
                } else {
                  replacementFieldType = classForName(replacementFieldClassName);
                }
                replacementFieldInfo = new FieldInfo(
                    replacementFieldDeclaringClass,
                    replacementFieldName,
                    replacementFieldType,
                    replacementStaticField,
                    replacementTransientField);
View Full Code Here

    stringBuilder.append("\nsetting field #");
    stringBuilder.append(fieldToSetIndex);
    stringBuilder.append(" of ");
    stringBuilder.append(objectAndPersistInfo.toString());

    final FieldInfo fieldToSet = fieldsInfo[fieldToSetIndex];

    stringBuilder.append("\nvalue from valueFieldList by fieldInfo=");
    try {
      stringBuilder.append(valuedFieldList.getValue(fieldToSet));
    } catch (ConversionException exception) {
      stringBuilder.append(exception.getMessage());
    }

    stringBuilder.append("\nfields:\n");
    int index = 0;
    for (FieldInfo fieldInfo : fieldsInfo) {
      stringBuilder.append('#');
      stringBuilder.append(String.format("%-3d", index));
      stringBuilder.append(':');
      stringBuilder.append(fieldInfo.toString());
      stringBuilder.append('\n');
      index++;
    }
    stringBuilder.append("valued field list:\n");
    final List<ObjectAndPersistInfo> fieldValueList = valuedFieldList
        .getFieldValueList();
    if (fieldValueList == null) {
      stringBuilder.append("none\n");
    } else {
      index = 0;
      for (ObjectAndPersistInfo fieldValue : fieldValueList) {
        stringBuilder.append("field #");
        stringBuilder.append(String.format("%-3d", index));
        stringBuilder.append(", info ");
        stringBuilder.append(valuedFieldList.getFieldInfo(index));
        stringBuilder.append(", value ");
        if (fieldValue == null) {
          stringBuilder.append(" null");
        } else {
          stringBuilder.append(fieldValue.toString());
        }
        stringBuilder.append('\n');
        index++;
      }
    }
    stringBuilder.append("value index by field information:\n");
    final Set<Entry<FieldInfo, Integer>> entrySet = valuedFieldList
        .getIndexByFieldInfoSet();
    if (entrySet.isEmpty()) {
      stringBuilder.append("none\n");
    } else {
      for (Entry<FieldInfo, Integer> entry : entrySet) {
        index = entry.getValue();
        final FieldInfo fieldInfo = entry.getKey();
        stringBuilder.append('#');
        stringBuilder.append(String.format("%-3d", index));
        stringBuilder.append(':');
        stringBuilder.append(fieldInfo.toString());
        stringBuilder.append('\n');
      }
    }
    return stringBuilder.toString();
  }
View Full Code Here

        currentObject.setFields(fieldsInfo);
        if (inRootObject) {
          final StoreRoot4 storeRoot = (StoreRoot4) currentObject
              .getObject();

          FieldInfo fieldInfo;

          final ClassInfo currentObjectClassInfo = currentObject
              .getClassInfo();
          fieldInfo = currentObjectClassInfo.getFieldInfo(
              StoreRoot4.class.getName(), "dataModelIdentifier");
View Full Code Here

        success = false;
      }
    } else {
      if ("field".equals(localName)) {
        startFieldElement(atts);
        final FieldInfo replacementFieldInfo;
        try {
          replacementFieldInfo = createFieldInfo(
              currentFieldDeclaringClassDef.getClassInfo(),
              fieldTypeDef.getClassInfo(), currentFieldName,
              staticField, transientField);
          final ClassInfo replacementFieldTypeInfo = replacementFieldInfo
              .getFieldTypeInfo();
          // AS-SERT
          if (ClassInfo.NULL.equals(replacementFieldTypeInfo)) {
            throw new SAXException("replacement field type for "
                + fieldTypeDef + " must be defined "
View Full Code Here

        final ObjectModelForImport fieldObjectModel = (ObjectModelForImport) data;

        final ObjectAndPersistInfo fieldObjectAndPersistInfo =
        /**/createObjectAndPersistInfo(fieldObjectModel);

        final FieldInfo fieldInfo = createFieldInfo(
            currentFieldDeclaringClassDef.getClassInfo(),
            fieldTypeDef.getClassInfo(), currentFieldName,
            staticField, transientField);

        try {
View Full Code Here

TOP

Related Classes of net.sf.joafip.store.entity.classinfo.FieldInfo

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.