Package org.jboss.serial.classmetamodel

Examples of org.jboss.serial.classmetamodel.FieldsManager


    static void writeSlotWithDefaultMethod(ClassMetaDataSlot slot, ObjectOutput out, Object obj, ObjectSubstitutionInterface substitution) throws IOException
  {
       ObjectOutputStream oos = new ObjectOutputStreamProxy(out,obj,slot,substitution);
       ObjectOutputStream.PutField putField = oos.putFields();
       ClassMetadataField[] fields = slot.getFields();
       FieldsManager fieldsManager = FieldsManager.getFieldsManager();
      
       if (isDebug)
       {
           log.debug("writeSlotWithDefaultMethod slot=" + slot.getSlotClass().getName() + " and " + fields.length + " fields");
       }

       for (int fieldNR=0;fieldNR<fields.length;fieldNR++)
       {
           ClassMetadataField classMetadataField = fields[fieldNR];
           Class type = classMetadataField.getField().getType();
           String fieldName = classMetadataField.getFieldName();
          
           if (isDebug)
           {
               log.debug("writeSlotWithDefaultMethod FieldNr=" + fieldNR);
           }
          
           if (type==Boolean.TYPE)
           {
               putField.put(fieldName, fieldsManager.getBoolean(obj,classMetadataField));
           }
           else
           if (type==Byte.TYPE)
           {
               putField.put(fieldName, fieldsManager.getByte(obj,classMetadataField));
           }
           else
           if (type==Character.TYPE)
           {
               putField.put(fieldName, fieldsManager.getCharacter(obj,classMetadataField));
           }
           else
           if (type==Short.TYPE)
           {
               putField.put(fieldName, fieldsManager.getShort(obj,classMetadataField));
           }
           else
           if (type==Integer.TYPE)
           {
               putField.put(fieldName, fieldsManager.getInt(obj,classMetadataField));
           }
           else
           if (type==Long.TYPE)
           {
               putField.put(fieldName, fieldsManager.getLong(obj,classMetadataField));
           }
           else
           if (type==Float.TYPE)
           {
               putField.put(fieldName, fieldsManager.getFloat(obj,classMetadataField));
           }
           else
           if (type==Double.TYPE)
           {
               putField.put(fieldName, fieldsManager.getDouble(obj,classMetadataField));
           }
           else
           {
               Object value = fieldsManager.getObject(obj,classMetadataField);
               putField.put(fieldName, value);
               if (isDebug)
               {
                   if (value==null)
                   {
View Full Code Here


       {
           ClassMetadataField classMetadata = slot.getFields()[fieldsKey[i]];
           Field field = classMetadata.getField();
           Class type = field.getType();
           String name = classMetadata.getFieldName();
           FieldsManager fieldsManager = FieldsManager.getFieldsManager();
          
           if (isDebug)
           {
               log.debug("FieldName on Read=" + name);
           }
           if (type==Boolean.TYPE)
           {
               fieldsManager.setBoolean(obj,classMetadata,getField.get(name, false));
           }
           else
           if (type==Byte.TYPE)
           {
               fieldsManager.setByte(obj,classMetadata,getField.get(name, (byte) 0));
           }
           else
           if (type==Character.TYPE)
           {
               fieldsManager.setCharacter(obj,classMetadata,getField.get(name, (char) 0));
           }
           else
           if (type==Short.TYPE)
           {
               fieldsManager.setShort(obj,classMetadata,getField.get(name, (short) 0));
           }
           else
           if (type==Integer.TYPE)
           {
               fieldsManager.setInt(obj,classMetadata,getField.get(name, (int) 0));
           }
           else
           if (type==Long.TYPE)
           {
               fieldsManager.setLong(obj,classMetadata,getField.get(name, (long) 0));
           }
           else
           if (type==Float.TYPE)
           {
               fieldsManager.setFloat(obj,classMetadata,getField.get(name, (float) 0));
           }
           else
           if (type==Double.TYPE)
           {
               fieldsManager.setDouble(obj,classMetadata,getField.get(name, (double) 0));
           }
           else
           {
               if (isDebug)
               {
                   log.debug("readSlotWithDefaultMethod slot=" + slot.getSlotClass().getName() + " field=" + classMetadata.getFieldName() + "<<-reading Object");
               }
               fieldsManager.setObject(obj,classMetadata,getField.get(name, null));
           }
       }
  }
View Full Code Here

TOP

Related Classes of org.jboss.serial.classmetamodel.FieldsManager

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.