public boolean isCollection() { BeanRuntimeInfo.Classification classification = creator.getBeanRuntimeInfo().getClassification(); return (classification == Classification.COLLECTION_COLLECTION || classification == Classification.ARRAY_COLLECTION); }
public Class<?> getBeanClass() { return creator.getBeanRuntimeInfo().getPopulateType(); }
public Bean getModel(Class<?> beanType) { for(Bean model : models.values()) { if(model.getCreator().getBeanRuntimeInfo().getPopulateType() == beanType) { return model; } } return null; }
/** * Assert that the beanClass associated with this configuration is an array or Collection. */ private void assertBeanClassIsCollection() { BeanRuntimeInfo beanRuntimeInfo = beanInstanceCreator.getBeanRuntimeInfo(); if (beanRuntimeInfo.getClassification() != BeanRuntimeInfo.Classification.COLLECTION_COLLECTION && beanRuntimeInfo.getClassification() != BeanRuntimeInfo.Classification.ARRAY_COLLECTION) { throw new IllegalArgumentException("Invalid call to a Collection/array Bean.bindTo method for a non Collection/Array target. Binding target type '" + beanRuntimeInfo.getPopulateType().getName() + "' (beanId '" + getBeanId() + "'). Use one of the Bean.bindTo methods that specify a 'bindingMember' argument."); } }
private void createRootSerializers(List<XMLElementSerializationNode> graphs) { Collection<Bean> beanModels = beanModelSet.getModels().values(); for(Bean model : beanModels) { BeanInstanceCreator creator = model.getCreator(); SelectorStep[] selectorSteps = creator.getConfig().getSelectorSteps(); XMLElementSerializationNode createNode = (XMLElementSerializationNode) findNode(graphs, selectorSteps); // Only create serializers for routed elements... if(rootElementNames.contains(createNode.getQName())) { createNode = ((XMLElementSerializationNode) createNode.clone()); createNode.setParent(null); Class<?> beanClass = creator.getBeanRuntimeInfo().getPopulateType(); if(!Collection.class.isAssignableFrom(beanClass)) { // Ignore Collections... don't allow them to be serialized.... not enough type info. serializers.put(beanClass, new RootNodeSerializer(creator.getBeanId(), createNode)); addNamespaceAttributes(createNode); } } } }