public boolean isEmpty(ClassEntry entry) { if (isPrimitive(entry)) return false; // Primitive classes are saved if ((entry.getSourceClass().isInterface()) || (entry.getSourceClass().getName().startsWith("java"))) return true; // Intefaces or java.** classes will never have attributes return false; }
private boolean isStorable(ClassEntry entry) { if (isPrimitive(entry)) return true; // Primitive classes are saved if ((entry.getSourceClass().isInterface()) || (entry.getSourceClass().getName().startsWith("java"))) return false; // Intefaces or java.** classes are non-storable if ((Modifier.isAbstract(entry.getSourceClass().getModifiers())) && (!hasStaticAttributes(entry))) return false; // Abstract superclasses which have no attributes return true; }
/** * Instantiate an object of this info entity. If the object in question is a dynamic object, it's * dynamic name will be set. * * @param marshalledValues The values for which this object will be created. */ public Object newInstance(Map marshalledValues) throws InstantiationException, IllegalAccessException { // If primitive type, then construct with primitive value if (isPrimitive()) return ((StrictPrimitiveHandler) getHandler(getSourceEntry())).newInstance(marshalledValues); // It's a custom object, create it Object result = sourceEntry.getSourceClass().newInstance(); // If it's a dynamic object, then set it's dynamic name if (DynamicObject.class.isAssignableFrom(sourceEntry.getSourceClass())) ((DynamicObject) result).setPersistenceDynamicName(sourceEntry.getDynamicName()); return result; }
private boolean isPrimitive(ClassEntry entry) { return classTracker.getType(entry.getSourceClass()) == ClassTracker.ClassType.TYPE_PRIMITIVE; }