public ComponentDef createComponentDef(Class<?> componentClass) { if (!namingConvention.isTargetClassName(componentClass.getName(), nameSuffix)) { return null; } final Class<?> targetClass = namingConvention.toCompleteClass(componentClass); if (targetClass.isInterface()) { if (!isEnableInterface()) { return null; } } else if (Modifier.isAbstract(targetClass.getModifiers())) { if (!isEnableAbstract()) { return null; } } final AnnotationHandler handler = AnnotationHandlerFactory.getAnnotationHandler(); final ComponentDef cd = handler.createComponentDef(targetClass, instanceDef, autoBindingDef, externalBinding); if (cd.getComponentName() == null) { cd.setComponentName(namingConvention.fromClassNameToComponentName(targetClass.getName())); } setupCompleteComponent(handler, cd); return cd; }
componentDef.setComponentName(name);
protected ComponentDef createComponentDef(Class<?> componentClass, String name, InstanceDef instanceDef, AutoBindingDef autoBindingDef, boolean externalBinding) { ComponentDef componentDef = new ComponentDefImpl(componentClass); if (!LdiStringUtil.isEmpty(name)) { componentDef.setComponentName(name); } if (instanceDef != null) { componentDef.setInstanceDef(instanceDef); } if (autoBindingDef != null) { componentDef.setAutoBindingDef(autoBindingDef); } componentDef.setExternalBinding(externalBinding); return componentDef; }
public ComponentDef createComponentDef(final AnnotationHandler annotationHandler, final Class<?> componentClass, final InstanceDef defaultInstanceDef, final AutoBindingDef defaultAutoBindingDef, final boolean defaultExternalBinding) { final Component component = componentClass.getAnnotation(Component.class); if (component == null) { return null; } final ComponentDef componentDef = new ComponentDefImpl(componentClass); if (!LdiStringUtil.isEmpty(component.name())) { componentDef.setComponentName(component.name()); } componentDef.setInstanceDef(getInstanceDef(component, defaultInstanceDef)); componentDef.setAutoBindingDef(getAutoBindingDef(component, defaultAutoBindingDef)); componentDef.setExternalBinding(component.externalBinding()); return componentDef; }
componentDef.setComponentName(componentName); annoHandler.appendDI(componentDef); annoHandler.appendAspect(componentDef);
protected ComponentDef actuallyCreateComponentDef(Class<?> implType) { final Class<?> targetClass = namingConvention.toCompleteClass(implType); checkImplementationCanBeCreated(targetClass); final AnnotationHandler handler = AnnotationHandlerFactory.getAnnotationHandler(); final ComponentDef cd = handler.createComponentDef(targetClass, instanceDef, autoBindingDef, externalBinding); if (cd.getComponentName() == null) { cd.setComponentName(deriveComponentName(targetClass)); } handler.appendDI(cd); customizer.customize(cd); handler.appendInitMethod(cd); handler.appendDestroyMethod(cd); handler.appendAspect(cd); handler.appendInterType(cd); return cd; }
protected ComponentDef actuallyCreateComponentDef(Class<?> implType) { final Class<?> targetClass = namingConvention.toCompleteClass(implType); checkImplementationCanBeCreated(targetClass); final AnnotationHandler handler = AnnotationHandlerFactory.getAnnotationHandler(); final ComponentDef cd = handler.createComponentDef(targetClass, instanceDef, autoBindingDef, externalBinding); if (cd.getComponentName() == null) { cd.setComponentName(deriveComponentName(targetClass)); } handler.appendDI(cd); customizer.customize(cd); handler.appendInitMethod(cd); handler.appendDestroyMethod(cd); handler.appendAspect(cd); handler.appendInterType(cd); return cd; }
protected void register(final String className) { final AnnotationHandler annoHandler = AnnotationHandlerFactory.getAnnotationHandler(); final ComponentDef cd = annoHandler.createComponentDef(className, instanceDef, autoBindingDef, externalBinding); if (cd.getComponentName() == null) { String[] names = LdiClassUtil.splitPackageAndShortClassName(className); cd.setComponentName(autoNaming.defineName(names[0], names[1])); } annoHandler.appendDI(cd); customize(cd); annoHandler.appendInitMethod(cd); annoHandler.appendDestroyMethod(cd); annoHandler.appendAspect(cd); annoHandler.appendInterType(cd); getContainer().register(cd); }