Examples of Autowire


Examples of com.sun.jersey.api.spring.Autowire

    public IoCComponentProvider getComponentProvider(Class c) {
        return getComponentProvider(null, c);
    }

    public IoCComponentProvider getComponentProvider(ComponentContext cc, Class c) {
        final Autowire autowire = (Autowire) c.getAnnotation(Autowire.class);
        if (autowire != null) {
            if (LOGGER.isLoggable(Level.FINEST)) {
                LOGGER.finest("Creating resource class " +
                        c.getSimpleName() +
                        " annotated with @" +
View Full Code Here

Examples of com.sun.jersey.api.spring.Autowire

        return getComponentProvider(null, c);
    }

    @Override
    public IoCComponentProvider getComponentProvider(ComponentContext cc, Class c) {
        final Autowire autowire = (Autowire) c.getAnnotation(Autowire.class);
            if (autowire != null) {
            if (LOGGER.isLoggable(Level.FINEST)) {
                LOGGER.finest("Creating resource class " +
                        c.getSimpleName() +
                        " annotated with @" +
View Full Code Here

Examples of com.sun.jersey.api.spring.Autowire

        return getComponentProvider(null, c);
    }

    @Override
    public IoCComponentProvider getComponentProvider(ComponentContext cc, Class c) {
        final Autowire autowire = (Autowire) c.getAnnotation(Autowire.class);
            if (autowire != null) {
            if (LOGGER.isLoggable(Level.FINEST)) {
                LOGGER.finest("Creating resource class " +
                        c.getSimpleName() +
                        " annotated with @" +
View Full Code Here

Examples of org.apache.tuscany.core.system.annotation.Autowire

*/
public class AutowireProcessor extends ImplementationProcessorSupport {

    @Override
    public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException {
        Autowire annotation = method.getAnnotation(Autowire.class);
        if (annotation != null) {
            if (!Modifier.isPublic(method.getModifiers())) {
                InvalidSetterException e = new InvalidSetterException("Autowire setter method is not public");
                e.setIdentifier(method.toString());
                throw e;
View Full Code Here

Examples of org.apache.tuscany.core.system.annotation.Autowire

    @Override
    public void visitField(Field field, ComponentType type) throws ConfigurationLoadException {
        checkAutowireType(field.getType(),field.getDeclaringClass());
        int modifiers = field.getModifiers();
        Autowire annotation = field.getAnnotation(Autowire.class);
        if (annotation != null) {
            if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) {
                InvalidSetterException e = new InvalidSetterException("Autowire field is not public or protected");
                e.setIdentifier(field.getName());
                throw e;
View Full Code Here

Examples of org.apache.tuscany.spi.annotation.Autowire

        int pos,
        Class<?> param,
        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
        List<String> injectionNames) throws InvalidAutowireException, InvalidConstructorException {
        // the param is marked as an autowire
        Autowire autowireAnnot = (Autowire) annot;
        JavaMappedReference reference = new JavaMappedReference();
        reference.setAutowire(true);
        String name = autowireAnnot.name();
        if (name == null || name.length() == 0) {
            if (constructorNames.length > 1 && (constructorNames.length < pos + 1 || constructorNames[pos] == null)) {
                throw new InvalidAutowireException("Names in @Constructor and autowire parameter do not match at "
                    + (pos + 1));
            } else if (constructorNames.length == 1 && constructorNames[0].length() == 0) {
                // special case when @Constructor present with all autowire params not specifying any name
                name = param.getName() + String.valueOf(pos);
            } else if (constructorNames.length == 1
                && (constructorNames.length < pos + 1 || constructorNames[pos] == null)) {
                throw new InvalidAutowireException("Names in @Constructor and autowire parameter do not match at "
                    + (pos + 1));
            } else if (constructorNames.length == 1 && constructorNames[0].length() > 0) {
                name = constructorNames[pos];
            } else if (constructorNames.length == 0 || constructorNames[pos].length() == 0) {
                name = param.getName() + String.valueOf(pos);
            } else {
                name = constructorNames[pos];
            }
        } else if (pos < constructorNames.length && constructorNames[pos] != null
            && constructorNames[pos].length() != 0 && !name.equals(constructorNames[pos])) {
            throw new InvalidConstructorException("Name specified by @Constructor does not match autowire name at "
                + (pos + 1));
        }
        reference.setName(name);

        reference.setRequired(autowireAnnot.required());

        ServiceContract<?> contract = new JavaServiceContract();
        contract.setInterfaceClass(param);
        reference.setServiceContract(contract);
        type.getReferences().put(name, reference);
View Full Code Here

Examples of org.apache.tuscany.spi.annotation.Autowire

    public void visitMethod(CompositeComponent parent, Method method,
                            PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
                            DeploymentContext context)
        throws ProcessingException {
        Reference annotation = method.getAnnotation(Reference.class);
        Autowire autowire = method.getAnnotation(Autowire.class);
        boolean isAutowire = autowire != null;
        if (annotation == null && !isAutowire) {
            return; //Not a reference or autowire annotation.
        }
        if (method.getParameterTypes().length != 1) {
            IllegalReferenceException e = new IllegalReferenceException("Setter must have one parameter");
            e.setIdentifier(method.toString());
            throw e;
        }
        //process autowire required first let reference override. or if conflicting should this fault?
        boolean required = false;
        if (isAutowire) {
            required = autowire.required();
        }

        String name = null;

        if (annotation != null) {
View Full Code Here

Examples of org.springframework.beans.factory.annotation.Autowire

      if (dependsOn.length > 0) {
        beanDef.setDependsOn(dependsOn);
      }
    }

    Autowire autowire = (Autowire) beanAttributes.get("autowire");
    if (autowire.isAutowire()) {
      beanDef.setAutowireMode(autowire.value());
    }

    String initMethodName = (String) beanAttributes.get("initMethod");
    if (StringUtils.hasText(initMethodName)) {
      beanDef.setInitMethodName(initMethodName);
View Full Code Here

Examples of org.springframework.beans.factory.annotation.Autowire

      if (otherBeans.length > 0) {
        beanDef.setDependsOn(otherBeans);
      }
    }

    Autowire autowire = bean.getEnum("autowire");
    if (autowire.isAutowire()) {
      beanDef.setAutowireMode(autowire.value());
    }

    String initMethodName = bean.getString("initMethod");
    if (StringUtils.hasText(initMethodName)) {
      beanDef.setInitMethodName(initMethodName);
View Full Code Here

Examples of org.springframework.beans.factory.annotation.Autowire

      return;
    }

    AnnotationConfigUtils.processCommonDefinitionAnnotations(beanDef, metadata);

    Autowire autowire = bean.getEnum("autowire");
    if (autowire.isAutowire()) {
      beanDef.setAutowireMode(autowire.value());
    }

    String initMethodName = bean.getString("initMethod");
    if (StringUtils.hasText(initMethodName)) {
      beanDef.setInitMethodName(initMethodName);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.