protected boolean isMetaDataComplete(PropertyMetaData pmd) { if (pmd == null) return false; ValueMetaData value = pmd.getValue(); Object underlyingValue = value.getUnderlyingValue(); return (underlyingValue instanceof AnnotationsMatcher == false); }
protected boolean isMetaDataComplete(PropertyMetaData pmd) { if (pmd == null) return false; ValueMetaData value = pmd.getValue(); Object underlyingValue = value.getUnderlyingValue(); return (underlyingValue instanceof AnnotationsMatcher == false); }
/** * Get a bean property * * @param name the name * @return the value metadata */ public ValueMetaData getBeanProperty(String name) { if (name == null) throw new IllegalArgumentException("Null name"); PropertyMetaData properties = getProperty("properties"); if (properties == null) return null; AbstractMapMetaData map = (AbstractMapMetaData) properties.getValue(); for (Iterator<Map.Entry<MetaDataVisitorNode, MetaDataVisitorNode>> i = map.entrySet().iterator(); i.hasNext();) { Map.Entry<MetaDataVisitorNode, MetaDataVisitorNode> entry = i.next(); ValueMetaData key = (ValueMetaData) entry.getKey(); if (key.getUnderlyingValue().equals(name)) { ValueMetaData vmd = (ValueMetaData) entry.getValue(); return (ValueMetaData) vmd.getUnderlyingValue(); } } return null; }
/** * Configure a bean property * * @param trace whether trace is enabled * @param object the object to configure * @param info the property info * @param cl the classloader * @param metaData the property metadata * @throws Throwable for any error */ public static void configure(boolean trace, Object object, PropertyInfo info, ClassLoader cl, PropertyMetaData metaData) throws Throwable { if (trace) log.trace("Configuring info=" + info + " metaData=" + metaData); if (trace) log.trace("Setting property " + info); info.set(object, metaData.getValue().getValue(info.getType(), cl)); }
/** * 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; }
/** * Add a bean property * * @param property the property */ public void addBeanProperty(PropertyMetaData property) { PropertyMetaData properties = getProperty("properties"); AbstractMapMetaData map; if (properties == null) { map = new AbstractMapMetaData(); properties = new AbstractPropertyMetaData("properties", map); addProperty(properties); } else { map = (AbstractMapMetaData) properties.getValue(); } ValueMetaData valueMetaData = property.getValue(); valueMetaData = new AbstractValueMetaData(valueMetaData); map.put(new AbstractValueMetaData(property.getName()), valueMetaData); }
protected PropertyMetaData getPropertyMetaData(PropertyInfo info, Annotation annotation, BeanMetaData beanMetaData) { PropertyMetaData pmd = findPropertyMetaData(info, beanMetaData); if (pmd != null) { ValueMetaData value = pmd.getValue(); Object underlyingValue = value.getUnderlyingValue(); if (underlyingValue instanceof AnnotationsMatcher == false) throw new IllegalArgumentException("Should not be here: " + toString()); AnnotationsMatcher am = (AnnotationsMatcher)underlyingValue; am.addAnnotation(annotation); } else { ValueMetaData value = createValueMetaData(annotation, null); pmd = new AbstractPropertyMetaData(getName(info), value); } return pmd; }
public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property, AbstractBeanMetaData attachment) { String name = property.getName(); PropertyMetaData pmd = getExactPropertyMetaData(attachment, name); PropertyInfo propertyInfo = beanInfo.getProperty(name); ValueMetaData valueMetaData = pmd.getValue(); try { Object value = valueMetaData.getValue(propertyInfo.getType(), getClassLoader(attachment)); return metaValueFactory.create(value, propertyInfo.getType()); } catch (Throwable t) { throw new UndeclaredThrowableException(t); } }
public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property, MetaData metaData, AbstractBeanMetaData attachment) { String name = property.getName(); PropertyMetaData pmd = getExactPropertyMetaData(attachment, name); PropertyInfo propertyInfo = beanInfo.getProperty(name); ValueMetaData valueMetaData = pmd.getValue(); try { Object value = valueMetaData.getValue(propertyInfo.getType(), getClassLoader(attachment)); return metaValueFactory.create(value, propertyInfo.getType()); } catch (Throwable t) { throw new UndeclaredThrowableException(t); } }
ValueMetaData valueMetaData = property.getValue(); Object value = valueMetaData.getValue(typeInfo, cl); validatePropertyValue(context, target, propertyInfo, value);
propertyTarget.addPropertyMetaData(property.getName(), property.getValue());
for (PropertyMetaData property : properties) propertyMap.put(property.getName(), property.getValue());