/** * Unwrap meta value. * * @param metaValue the meta value * @return unwrapped value */ protected Object unwrap(MetaValue metaValue) { return valueFactory.unwrap(metaValue); }
/** * Create meta value. * * @param value the value * @return meta value instance */ protected MetaValue create(Object value) { return valueFactory.create(value); }
private MetaValueFactory getMetaValueFactory() { if(metaValueFactory == null) metaValueFactory = MetaValueFactory.getInstance(); return metaValueFactory; }
@Override public MetaValue createMetaValue(MetaType metaType, Set<ChannelInfo> object) MetaValueFactory valueFactory = MetaValueFactory.getInstance(); if (on != null) data.put("channelObjectName", valueFactory.create(on)); for (ObjectName protON : protNames) onValues.add(valueFactory.create(protON));
/** * Convert a simple meta value to a String. * * @param value the simple meta value. * @return the string. */ protected String convertSimple2String(SimpleValue value) { if(value == null) throw new IllegalArgumentException("Null value."); Object unwrappedValue = getMetaValueFactory().unwrap(value); if(unwrappedValue == null) return null; // Convert to String return ("" + unwrappedValue); }
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 Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (Object.class.equals(method.getDeclaringClass())) return handleObjectInvocation(method.getName(), args); MetaValue value = compositeValue.get(getCompositeDataKey(method)); Type returnType = method.getGenericReturnType(); return factory.unwrap(value, returnType); }
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); } }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Class<?> declaringClass = method.getDeclaringClass(); if (Object.class.equals(declaringClass)) return handleObjectInvocation(method.getName(), args); Type returnType = method.getGenericReturnType(); // size if(method.getName().equals("size")) return compositeValue.values().size(); MetaValue value = compositeValue.get(getCompositeDataKey(method)); return factory.unwrap(value, returnType); }
/** * Extract the value from the property MetaValue * @param info - template info * @param propName - the name of the property to return a value for * @return the unwrapped property value */ private Object getProperty(DeploymentTemplateInfo info, String propName) { Map<String, ManagedProperty> propsInfo = info.getProperties(); ManagedProperty prop = propsInfo.get(propName); if(prop == null) { return null; } Object value = prop.getValue(); if(value instanceof MetaValue) { return mvf.unwrap((MetaValue) value); } return value; }
public void setValue(BeanInfo beanInfo, ManagedProperty property, AbstractBeanMetaData attachment, MetaValue value) { String name = property.getName(); PropertyMetaData pmd = getExactPropertyMetaData(attachment, name); PropertyInfo propertyInfo = beanInfo.getProperty(name); if (pmd instanceof AbstractPropertyMetaData) { AbstractPropertyMetaData apmd = (AbstractPropertyMetaData)pmd; apmd.setValue(new AbstractValueMetaData(metaValueFactory.unwrap(value, propertyInfo.getType()))); } }
public void setValue(BeanInfo beanInfo, ManagedProperty property, AbstractBeanMetaData attachment, MetaValue value) { String name = property.getName(); PropertyMetaData pmd = getExactPropertyMetaData(attachment, name); PropertyInfo propertyInfo = beanInfo.getProperty(name); if (pmd instanceof AbstractPropertyMetaData) { AbstractPropertyMetaData apmd = (AbstractPropertyMetaData)pmd; apmd.setValue(new AbstractValueMetaData(metaValueFactory.unwrap(value, propertyInfo.getType()))); } }
String svalue = (String) getMetaValueFactory().unwrap(mapValue.get(name)); prop.setValue(svalue); list.add(prop);
String svalue = (String) getMetaValueFactory().unwrap(mapValue.get(name)); prop.setValue(svalue); list.add(prop);
Object unwrapped = metaValueFactory.unwrap(value, propertyInfo.getType()); if(unwrapped != null)
plainValue = metaValueFactory.unwrap(value, propertyInfo.getType());