public Object getUnderlyingValue() { return value.getUnderlyingValue(); }
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); }
public Object endElement(Object o, QName qName, ElementBinding element) { Holder holder = (Holder) o; ValueMetaData value = (ValueMetaData) holder.getValue(); if (value == null || value.getUnderlyingValue() == null) throw new IllegalArgumentException("Factory should have a bean attribute or nested element."); return value; } }
/** * Set the factory * * @param factory the factory */ @XmlElement(name="factory", type=AbstractDependencyValueMetaData.class) public void setFactory(ValueMetaData factory) { // HACK to have wildcard factories if (factory != null && factory instanceof AbstractDependencyValueMetaData) { Object underlying = factory.getUnderlyingValue(); if (underlying != null && underlying instanceof ValueMetaData) factory = (ValueMetaData) underlying; } this.factory = factory; flushJBossObjectCache(); }
/** * 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; }
protected void buildDeployment(DeploymentUnit unit, BootstrapInfo info, BeanMetaDataBuilder builder) { WeldDiscoveryEnvironment env = unit.getAttachment(WeldDiscoveryEnvironment.class); builder.addConstructorParameter(WeldDiscoveryEnvironment.class.getName(), env); builder.addConstructorParameter(Collection.class.getName(), builder.createInject(info.getEjbServices().getUnderlyingValue(), "ejbs")); } }
@Override public void initialVisit(MetaDataVisitor visitor) { ValueMetaData factory = getFactory(); if (factory != null || getFactoryClass() != null) { if (getFactoryMethod() == null) throw new IllegalArgumentException("Constructor needs a factoryMethod attribute when there is a factoryClass attribute or factory element."); } if (factory != null) { if (factory.getUnderlyingValue() == null) throw new IllegalArgumentException("Factory should have a bean attribute or nested element."); } if (parameters != null) { for (int i = 0; i < parameters.size(); ++i) parameters.get(i).setIndex(i); } super.initialVisit(visitor); }
/** * 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; }
public ValueMetaData createValueMetaData(Annotation annotation, ValueMetaData previousValue) { if (previousValue == null) return new AbstractDependencyValueMetaData(new AnnotationsMatcher(annotation)); Object underlyingValue = previousValue.getUnderlyingValue(); if (underlyingValue instanceof AnnotationsMatcher) { AnnotationsMatcher am = (AnnotationsMatcher)underlyingValue; am.addAnnotation(annotation); } else { log.info("Ignoring custom annotation, previous value is not AnnotationsMatcher: " + previousValue); } return previousValue; } }
public ValueMetaData createValueMetaData(Annotation annotation, ValueMetaData previousValue) { if (previousValue == null) return new AbstractDependencyValueMetaData(new AnnotationsMatcher(annotation)); Object underlyingValue = previousValue.getUnderlyingValue(); if (underlyingValue instanceof AnnotationsMatcher) { AnnotationsMatcher am = (AnnotationsMatcher)underlyingValue; am.addAnnotation(annotation); } else { log.info("Ignoring custom annotation, previous value is not AnnotationsMatcher: " + previousValue); } return previousValue; } }
protected void buildDeployment(DeploymentUnit unit, BootstrapInfo info, BeanMetaDataBuilder builder) { builder.addConstructorParameter(String.class.getName(), unit.getName()); builder.addConstructorParameter(Collection.class.getName(), getArchiveInfos(unit)); builder.addConstructorParameter(Collection.class.getName(), builder.createInject(info.getEjbServices().getUnderlyingValue(), "ejbs")); builder.addConstructorParameter(EjbServices.class.getName(), info.getEjbServices()); builder.addUninstall("undeploy"); }
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; }
return true; Object fstObject = fstValue != null ? fstValue.getUnderlyingValue() : null; Object sndObject = sndValue != null ? sndValue.getUnderlyingValue() : null;
install.addParameterMetaData(Iterable.class.getName(), bootstrap.createInject(ejbServicesValue.getUnderlyingValue(), "ejbContainerNames")); install.addParameterMetaData(String.class.getName(), "Start"); install.addParameterMetaData(String.class.getName(), ControllerState.PRE_INSTALL.getStateString());