public static IJavaPropertyInfo maybeExtendProperty(JavaPropertyInfo javaProperty) { IJavaPropertyInfo result = javaProperty; IJavaClassMethod readMethod = javaProperty.getPropertyDescriptor().getReadMethod(); if (readMethod != null) { IAnnotationInfo extendedPropertyAnnotation = readMethod.getAnnotation(ExtendedProperty.class); if (extendedPropertyAnnotation != null) { ExtendedTypeDataFactory factory = getExtendedTypeDataFactory((IJavaType) javaProperty.getOwnersType()); if (factory != null) { ExtendedTypeData extendedTypeInfoData = factory.newPropertyData( (IJavaType) javaProperty.getOwnersType(), javaProperty.getName()); result = (IJavaPropertyInfo) Proxy.newProxyInstance( extendedTypeInfoData.getExtensionInterface().getClassLoader(), new Class[] { IJavaPropertyInfo.class, extendedTypeInfoData.getExtensionInterface() }, new ExtendedPropertyInvocationHandler( javaProperty, extendedTypeInfoData.getData())); } } } return result; }
public static IJavaTypeInternal maybeExtendType(JavaType javaType) { IJavaTypeInternal result = javaType; ExtendedTypeDataFactory factory = getExtendedTypeDataFactory(javaType); if (factory != null) { ExtendedTypeData extendedTypeInfoData = factory.newTypeData(javaType.getName()); result = (IJavaTypeInternal) Proxy.newProxyInstance( extendedTypeInfoData.getExtensionInterface().getClassLoader(), new Class[] { IJavaTypeInternal.class, extendedTypeInfoData.getExtensionInterface() }, new ExtendedTypeInvocationHandler(javaType, extendedTypeInfoData.getData())); } return result; }