public abstract void setProperty(Object instance, Object value, boolean convert); public abstract Object getProperty(Object instance);
public T resolve() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException { T object = newInstance(); if (object == null) throw new InstantiationException("Instantiator newInstance() method cannot return null"); for (Referer referer : referers) referer.property.setProperty(referer.object, object); return object; }
public void setPropertyValue(int index, Object instance, Object value) { Property prop = properties.get(index); if (value instanceof AbstractInstantiator<?>) ((AbstractInstantiator<?>)value).addReferer(instance, prop); else prop.setProperty(instance, value); }
public void setPropertyValue(String name, Object instance, Object value) { // instance must be an instance of Map... Property prop = new MapProperty(converters, name); if (value instanceof AbstractInstantiator<?>) ((AbstractInstantiator<?>)value).addReferer(instance, prop); else prop.setProperty(instance, value); }
public void readExternal(Object o, ObjectInput in) throws IOException, ClassNotFoundException, IllegalAccessException { if (o instanceof AbstractInstantiator<?>) { AbstractInstantiator<?> instantiator = (AbstractInstantiator<?>)o; List<String> fields = instantiator.getOrderedFieldNames(); log.debug("Reading bean with instantiator %s with fields %s", instantiator.getClass().getName(), fields); for (String fieldName : fields) instantiator.put(fieldName, in.readObject()); } else { List<Property> fields = findOrderedFields(o.getClass()); log.debug("Reading bean %s with fields %s", o.getClass().getName(), fields); for (Property field : fields) { Object value = in.readObject(); if (!(field instanceof MethodProperty && field.isAnnotationPresent(Include.class, true))) field.setProperty(o, value); } } }