public abstract boolean isAnnotationPresent(Class<? extends Annotation> annotationClass, boolean recursive);
public abstract <T extends Annotation> T getAnnotation(Class<T> annotationClass, boolean recursive);
public abstract void setValue(Object instance, Object value, boolean convert); public abstract Object getValue(Object instance);
public SpecialValueFactory<?> getValueFactory(Property property) { Type propertyType = property.getType(); Class<?> type = TypeUtil.classOfType(propertyType); if (!Externalizable.class.isAssignableFrom(type)) { if ((type.isArray() && type.getComponentType() != byte.class) || Collection.class.isAssignableFrom(type)) { if (property.isAnnotationPresent(AMFVectorInt.class)) return new AMFVectorIntValueFactory(property.getAnnotation(AMFVectorInt.class)); if (property.isAnnotationPresent(AMFVectorNumber.class)) return new AMFVectorNumberValueFactory(property.getAnnotation(AMFVectorNumber.class)); if (property.isAnnotationPresent(AMFVectorUint.class)) return new AMFVectorUintValueFactory(property.getAnnotation(AMFVectorUint.class)); if (property.isAnnotationPresent(AMFVectorObject.class)) { AMFVectorObject annotation = property.getAnnotation(AMFVectorObject.class); String vectorComponentType = annotation.type(); if (vectorComponentType == null || vectorComponentType.length() == 0) { Class<?> componentClass = TypeUtil.componentClassOfType(propertyType); vectorComponentType = vectorObjectAlias.aliasFor(componentClass); } return new AMFVectorObjectValueFactory(annotation, vectorComponentType); } } else if (Map.class.isAssignableFrom(type) && property.isAnnotationPresent(AMFDictionary.class)) { return new AMFDictionaryValueFactory(property.getAnnotation(AMFDictionary.class)); } } return null; }
log.debug("Reading entity %s with fields %s", oClass.getName(), fields); for (Property field : fields) { if (field.getName().equals("jdoDetachedState")) continue; if (!(field instanceof MethodProperty && field.isAnnotationPresent(Include.class, true))) { value = newCollection((AbstractExternalizablePersistentCollection)value, field); else { Type targetType = TypeUtil.resolveTypeVariable(field.getType(), field.getDeclaringClass(), declaringTypes); value = converters.convert(value, targetType); field.setValue(o, value, false);
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.setValue(o, value); } } }
protected void readStandard(ActionScriptClassDescriptor desc, Object result) throws IOException { // defined values... final int count = desc.getPropertiesCount(); for (int i = 0; i < count; i++) { Property property = desc.getProperty(i); Object value = readObject(readUnsignedByte()); if (value != null && value.getClass() == property.getType()) property.setValue(result, value, false); else property.setValue(result, value, true); } // dynamic values... if (desc.isDynamic()) { while (true) { String name = readAMF3String(); if (name.length() == 0) break; Object value = readObject(readUnsignedByte()); desc.setPropertyValue(name, result, value); } } }
log.debug("Writing entity %s with fields %s", o.getClass().getName(), fields); for (Property field : fields) { if (field.getName().equals("jdoDetachedState")) continue; Object value = field.getValue(o); if (isValueIgnored(value)) { out.writeObject(null); if (loadedState.containsKey(field.getName()) && !loadedState.get(field.getName())) { Class<?> fieldClass = TypeUtil.classOfType(field.getType());
public String getPropertyName(int index) { return properties[index].getName(); }
protected Object convert(Object value) { return converters.convert(value, getType()); }
if (field.isAnnotationPresent(Id.class)) { out.writeObject(field.getValue(o)); break; log.debug("Writing entity %s with fields %s", o.getClass().getName(), fields); for (Property field : fields) { Object value = field.getValue(o);
public Object getPropertyValue(int index, Object instance) { return properties[index].getValue(instance); } }
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); } } }
public SpecialValueFactory<?> getValueFactory(Property property) { Type propertyType = property.getType(); Class<?> type = TypeUtil.classOfType(propertyType); if (!Externalizable.class.isAssignableFrom(type)) { if ((type.isArray() && type.getComponentType() != byte.class) || Collection.class.isAssignableFrom(type)) { if (property.isAnnotationPresent(AMFVectorInt.class)) return new AMFVectorIntValueFactory(property.getAnnotation(AMFVectorInt.class)); if (property.isAnnotationPresent(AMFVectorNumber.class)) return new AMFVectorNumberValueFactory(property.getAnnotation(AMFVectorNumber.class)); if (property.isAnnotationPresent(AMFVectorUint.class)) return new AMFVectorUintValueFactory(property.getAnnotation(AMFVectorUint.class)); if (property.isAnnotationPresent(AMFVectorObject.class)) { AMFVectorObject annotation = property.getAnnotation(AMFVectorObject.class); String vectorComponentType = annotation.type(); if (vectorComponentType == null || vectorComponentType.length() == 0) { Class<?> componentClass = TypeUtil.componentClassOfType(propertyType); vectorComponentType = vectorObjectAlias.aliasFor(componentClass); } return new AMFVectorObjectValueFactory(annotation, vectorComponentType); } } else if (Map.class.isAssignableFrom(type) && property.isAnnotationPresent(AMFDictionary.class)) { return new AMFDictionaryValueFactory(property.getAnnotation(AMFDictionary.class)); } } return null; }
for (Property field : fields) { Object value = in.readObject(); if (!(field instanceof MethodProperty && field.isAnnotationPresent(Include.class, true))) { Type targetType = TypeUtil.resolveTypeVariable(field.getType(), field.getDeclaringClass(), declaringTypes); value = converters.convert(value, targetType); field.setValue(o, value, false);
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.setValue(o, value); } } }
protected void readStandard(ActionScriptClassDescriptor desc, Object result) throws IOException { // defined values... final int count = desc.getPropertiesCount(); for (int i = 0; i < count; i++) { Property property = desc.getProperty(i); Object value = readObject(readUnsignedByte()); if (value != null && value.getClass() == property.getType()) property.setValue(result, value, false); else property.setValue(result, value, true); } // dynamic values... if (desc.isDynamic()) { while (true) { String name = readAMF3String(); if (name.length() == 0) break; Object value = readObject(readUnsignedByte()); desc.setPropertyValue(name, result, value); } } }
public String getPropertyName(int index) { return properties[index].getName(); }
protected Object convert(Object value) { return converters.convert(value, getType()); }
public Object getPropertyValue(int index, Object instance) { return properties[index].getValue(instance); } }