@Override protected boolean isMetaDataAlreadyPresent(ClassInfo info, SpringBean annotation, BeanMetaData beanMetaData) { Set<PropertyMetaData> properties = beanMetaData.getProperties(); if (properties != null && properties.isEmpty() == false) { for (PropertyMetaData property : properties) { if (BNP.equals(property.getName())) { return true; } } } return false; } }
/** * Configure a bean * * @param object the object to configure * @param info the bean info * @param metaData the bean metadata * @throws Throwable for any error */ public static void configure(Object object, BeanInfo info, BeanMetaData metaData) throws Throwable { boolean trace = log.isTraceEnabled(); if (object == null) throw new IllegalArgumentException("Null object"); if (info == null) throw new IllegalArgumentException("Null bean info"); if (metaData == null) throw new IllegalArgumentException("Null bean metadata"); Set<PropertyMetaData> properties = metaData.getProperties(); if (properties != null && properties.isEmpty() == false) { ClassLoader cl = getClassLoader(metaData); for (Iterator<PropertyMetaData> i = metaData.getProperties().iterator(); i.hasNext();) { PropertyMetaData property = i.next(); configure(trace, object, info, cl, property); } } }
/** * Unconfigure a bean * * @param object the object to unconfigure * @param info the bean info * @param metaData the bean metadata * @throws Throwable for any error */ public static void unconfigure(Object object, BeanInfo info, BeanMetaData metaData) throws Throwable { if (object == null) throw new IllegalArgumentException("Null object"); if (info == null) throw new IllegalArgumentException("Null bean info"); if (metaData == null) throw new IllegalArgumentException("Null bean metadata"); ClassLoader cl = getClassLoader(metaData); Set<PropertyMetaData> propertys = metaData.getProperties(); if (propertys != null && propertys.isEmpty() == false) { for (Iterator<PropertyMetaData> i = metaData.getProperties().iterator(); i.hasNext();) { PropertyMetaData property = i.next(); unconfigure(object, cl, info, property); } } }
/** * Get the PropertyMetaData set. * * @param beanMetaData the bean meta data * @return set of existing PropertyMetaData */ protected Set<PropertyMetaData> getProperties(BeanMetaData beanMetaData) { Set<PropertyMetaData> properties = beanMetaData.getProperties(); if (properties == null) { properties = new HashSet<PropertyMetaData>(); AbstractBeanMetaData bean = checkIfNotAbstractBeanMetaDataSpecific(beanMetaData); bean.setProperties(properties); } return properties; }
/** * Find matching property metadata. * * @param info the property info * @param beanMetaData the bean metadata * @return matching property metadata or null */ protected PropertyMetaData findPropertyMetaData(T info, BeanMetaData beanMetaData) { Set<PropertyMetaData> properties = beanMetaData.getProperties(); if (properties != null && properties.isEmpty() == false) { for(PropertyMetaData pmd : properties) { if (pmd.getName().equals(getName(info))) return pmd; } } return null; }
/** * Set attributes/properties. * * @param context the context * @param target the target * @param info the bean info * @param metaData the bean metadata * @param nullify should we nullify attributes/properties * @throws Throwable for any error */ protected void setAttributes(KernelControllerContext context, Object target, BeanInfo info, BeanMetaData metaData, boolean nullify) throws Throwable { Set<PropertyMetaData> propertys = metaData.getProperties(); if (propertys != null && propertys.isEmpty() == false) { ClassLoader cl = Configurator.getClassLoader(metaData); for(PropertyMetaData property : propertys) { dispatchSetProperty(context, property, nullify, info, target, cl); } } }
return; Set<PropertyMetaData> properties = beanMetaData.getProperties();
/** * Get prototype class. * * @param cc the controller context * @return prototype's class */ protected Class<?> getPrototypeClass(ControllerContext cc) { if (cc instanceof KernelControllerContext == false) { return null; } KernelControllerContext kcc = (KernelControllerContext) cc; BeanMetaData bmd = kcc.getBeanMetaData(); Set<PropertyMetaData> properties = bmd.getProperties(); for (PropertyMetaData pmd : properties) { if ("bean".equals(pmd.getName())) { ValueMetaData value = pmd.getValue(); if (value != null && value.getUnderlyingValue() != null) { String className = value.getUnderlyingValue().toString(); return getBeanClass(className, kcc); } else { return null; } } } return null; }
injectionMetaData.setFromContext(FromContext.NAME); AbstractPropertyMetaData beanNameProperty = new AbstractPropertyMetaData(BNP, injectionMetaData); Set<PropertyMetaData> properties = metaData.getProperties(); if (properties == null)