public Property getProperty(String name){ Property property = null; for (Property tmp : getProperties()){ if (tmp.getName().equals(name)){ property = tmp; break; } } return property; }
public Property getProperty(String name){ Property property = null; for (Property tmp : getProperties()){ if (tmp.getName().equals(name)){ property = tmp; break; } } return property; }
private static boolean removeProperty(JavaElementImpl prop, JavaImplementation type) { if(prop==null) { return false; } List<Property> props = type.getProperties(); for(int i=0;i<props.size();i++) { if(props.get(i).getName().equals(prop.getName())) { props.remove(i); return true; } } return false; }
/** * Use preProcess to validate and map the references and properties dynamically */ public void build(Component component) { for (Reference reference : component.getReferences()) { if (unresolvedBeanRef.containsKey(reference.getName())) { Reference ref = unresolvedBeanRef.get(reference.getName()); componentType.getReferences().add(createReference(reference, ref.getInterfaceContract())); unresolvedBeanRef.remove(reference.getName()); } } for (Property property : component.getProperties()) { if (unresolvedBeanRef.containsKey(property.getName())) { componentType.getProperties().add(createProperty(property)); this.setPropertyClass(property.getName(), property.getClass()); unresolvedBeanRef.remove(property.getName()); } } }
} catch (NumberFormatException ex) { throw new ObjectCreationException("Failed to create instance for property " + property .getName() + " with value " + aValue } catch (IllegalArgumentException ex) { throw new ObjectCreationException("Failed to create instance for property " + property .getName() + " with value " + aValue
public Object getInstance() throws ObjectCreationException { // TUSCANY-3791 if (result != null){ return result; } if (isSimpleType) { try { result = simpleTypeMapper.toJavaObject(property.getXSDType(), (String)propertyValue, null); } catch (NumberFormatException ex) { throw new ObjectCreationException("Failed to create instance for property " + property.getName() + " with value " + propertyValue, ex); } catch (IllegalArgumentException ex) { throw new ObjectCreationException("Failed to create instance for property " + property.getName() + " with value " + propertyValue, ex); } } else { result = mediator.mediate(propertyValue, sourceDataType, targetDataType, null); } return result; } }
} catch (NumberFormatException ex) { throw new ObjectCreationException("Failed to create instance for property " + property .getName() + " with value " + aValue } catch (IllegalArgumentException ex) { throw new ObjectCreationException("Failed to create instance for property " + property .getName() + " with value " + aValue
ObjectFactory<?> valueFactory = propertyFactory.createValueFactory(property); if (valueFactory != null) { scriptEngine.put(property.getName(), valueFactory.getInstance());
private void addPropertiesFromComponentType(Component component, Monitor monitor) { // Create component property for each property if (component.getImplementation() != null) { for (Property property : component.getImplementation().getProperties()) { // check for duplicate property names in implementation if (property != component.getImplementation().getProperty(property.getName())){ Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "DuplicateImplementationPropertyName", component.getName(), property.getName()); } ComponentProperty componentProperty = (ComponentProperty)component.getProperty(property.getName()); // if the component doesn't have a property with the same name as // the component type property then create one if (componentProperty == null) { componentProperty = assemblyFactory.createComponentProperty(); componentProperty.setName(property.getName()); componentProperty.setValue(property.getValue()); componentProperty.setMany(property.isMany()); componentProperty.setMustSupply(property.isMustSupply()); componentProperty.setXSDElement(property.getXSDElement()); componentProperty.setXSDType(property.getXSDType()); componentProperty.setProperty(property); component.getProperties().add(componentProperty); } } } }
private void addPropertiesFromComponentType(Component component, Monitor monitor) { // Create component property for each property if (component.getImplementation() != null) { for (Property property : component.getImplementation().getProperties()) { // check for duplicate property names in implementation if (property != component.getImplementation().getProperty(property.getName())){ Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "DuplicateImplementationPropertyName", component.getName(), property.getName()); } ComponentProperty componentProperty = (ComponentProperty)component.getProperty(property.getName()); // if the component doesn't have a property with the same name as // the component type property then create one if (componentProperty == null) { componentProperty = assemblyFactory.createComponentProperty(); componentProperty.setName(property.getName()); componentProperty.setValue(property.getValue()); componentProperty.setMany(property.isMany()); componentProperty.setMustSupply(property.isMustSupply()); componentProperty.setXSDElement(property.getXSDElement()); componentProperty.setXSDType(property.getXSDType()); componentProperty.setProperty(property); component.getProperties().add(componentProperty); } } } }
/** * Use preProcess to add any references and properties dynamically * TODO: also support introspection and handle WEB-INF/web.componentType (spec line 503) */ public void build(Component component) { if (!(component instanceof RuntimeComponent)) { return; } RuntimeComponent rtc = (RuntimeComponent) component; for (Reference reference : rtc.getReferences()) { if (getReference(reference.getName()) == null) { getReferences().add(createReference(reference)); } } for (Property property : rtc.getProperties()) { if (getProperty(property.getName()) == null) { getProperties().add(createProperty(property)); } } }
warning(context.getMonitor(), "PropertyTypeNotFound", property, property.getXSDType().toString(), property.getName(), parentName); } else {
warning(context.getMonitor(), "PropertyTypeNotFound", property, property.getXSDType().toString(), property.getName(), parentName); } else {
@Override public <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException { for (Property property : type.getProperties()) { String name = property.getName(); JavaElementImpl element = type.getPropertyMembers().get(name); introspect(property, element); DataType dt = property.getDataType(); Object logical = dt.getLogical(); if (logical instanceof XMLType && logical != XMLType.UNKNOWN) { XMLType xmlType = (XMLType)logical; property.setXSDType(xmlType.getTypeName()); property.setXSDElement(xmlType.getElementName()); } else { Class<?> baseType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType()); QName typeName = JavaXMLMapper.getXMLType(baseType); property.setXSDType(typeName); } } super.visitEnd(clazz, type); }
writeStart(writer, PROPERTY, new XAttr(NAME, property.getName()), new XAttr(MUST_SUPPLY, property.isMustSupply()), new XAttr(MANY, property.isMany()),
writeStart(writer, PROPERTY, new XAttr(NAME, property.getName()), new XAttr(MUST_SUPPLY, property.isMustSupply()), new XAttr(MANY, property.isMany()),
writeStart(writer, PROPERTY, new XAttr(NAME, property.getName()), new XAttr(MUST_SUPPLY, property.isMustSupply()), new XAttr(MANY, property.isMany()),
writeStart(writer, PROPERTY, new XAttr(NAME, property.getName()), new XAttr(MUST_SUPPLY, property.isMustSupply()), new XAttr(MANY, property.isMany()),