/** * Checks if the class has a default constructor */ private void checkForDefaultConstructor() { try { beanRuntimeInfo.getPopulateType().getConstructor(); } catch (NoSuchMethodException e) { throw new SmooksConfigurationException("Invalid Smooks bean configuration. Bean class " + beanRuntimeInfo.getPopulateType().getName() + " doesn't have a public default constructor."); } }
/** * Checks if the class has a default constructor */ private void checkForDefaultConstructor() { try { beanRuntimeInfo.getPopulateType().getConstructor(); } catch (NoSuchMethodException e) { throw new SmooksConfigurationException("Invalid Smooks bean configuration. Bean class " + beanRuntimeInfo.getPopulateType().getName() + " doesn't have a public default constructor."); } }
/** * Checks if the class has a default constructor */ private void checkForDefaultConstructor() { try { beanRuntimeInfo.getPopulateType().getConstructor(); } catch (NoSuchMethodException e) { throw new SmooksConfigurationException("Invalid Smooks bean configuration. Bean class " + beanRuntimeInfo.getPopulateType().getName() + " doesn't have a public default constructor."); } }
public Class<?> getBeanClass() { return creator.getBeanRuntimeInfo().getPopulateType(); }
public Class<?> getBeanClass() { return creator.getBeanRuntimeInfo().getPopulateType(); }
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; }
private Class<?> resolveBindTypeReflectively() throws DataDecodeException { String bindingMember = (setterMethod != null? setterMethod : property); if(bindingMember != null && beanRuntimeInfo.getClassification() == Classification.NON_COLLECTION) { Method bindingMethod = Bean.getBindingMethod(bindingMember, beanRuntimeInfo.getPopulateType()); if(bindingMethod != null) { return bindingMethod.getParameterTypes()[0]; } } return null; }
private Class<?> resolveBindTypeReflectively() throws DataDecodeException { String bindingMember = (setterMethod != null? setterMethod : property); if(bindingMember != null && beanRuntimeInfo.getClassification() == Classification.NON_COLLECTION) { Method bindingMethod = Bean.getBindingMethod(bindingMember, beanRuntimeInfo.getPopulateType()); if(bindingMethod != null) { return bindingMethod.getParameterTypes()[0]; } } return null; }
public Bean getModel(Class<?> beanType) { for(Bean model : models.values()) { if(model.getCreator().getBeanRuntimeInfo().getPopulateType() == beanType) { return model; } } return null; }
private Class<?> resolveBindTypeReflectively() throws DataDecodeException { String bindingMember = (setterMethod != null? setterMethod : property); if(bindingMember != null && beanRuntimeInfo.getClassification() == Classification.NON_COLLECTION) { Method bindingMethod = Bean.getBindingMethod(bindingMember, beanRuntimeInfo.getPopulateType()); if(bindingMethod != null) { return bindingMethod.getParameterTypes()[0]; } } return null; }
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."); } }
/** * 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."); } }
/** * 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."); } }
@Override public boolean equals(Object obj) { if(obj == null) { return false; } if(obj == this) { return true; } if(!(obj instanceof BeanRuntimeInfo)) { return false; } BeanRuntimeInfo beanInfo = (BeanRuntimeInfo) obj; if(beanInfo.getArrayType() != getArrayType()) { return false; } if(beanInfo.getClassification() != getClassification()) { return false; } if(beanInfo.getPopulateType() != getPopulateType()) { return false; } return true; }
@Override public boolean equals(Object obj) { if(obj == null) { return false; } if(obj == this) { return true; } if(!(obj instanceof BeanRuntimeInfo)) { return false; } BeanRuntimeInfo beanInfo = (BeanRuntimeInfo) obj; if(beanInfo.getArrayType() != getArrayType()) { return false; } if(beanInfo.getClassification() != getClassification()) { return false; } if(beanInfo.getPopulateType() != getPopulateType()) { return false; } return true; }
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); } } } }
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); } } } }
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); } } } }