Package org.jboss.seam.annotations

Examples of org.jboss.seam.annotations.In


         field.setAccessible(true);
      }

      if ( field.isAnnotationPresent(In.class) )
      {
         In in = field.getAnnotation(In.class);
         String name = toName( in.value(), field );
         inAttributes.add( new BijectedField(name, field, in) );
      }
     
      if ( field.isAnnotationPresent(Out.class) )
      {
View Full Code Here


        return ann;
    }

    @Override
    public String getComponentName() {
        In inAnnot = this.getAnnotation(In.class);
        String compName = null;

        if (inAnnot != null) {
            if (inAnnot.value().trim().isEmpty()) {
                if (getter != null) {
                    compName = getter.getName().substring(3);
                } else if (setter != null) {
                    compName = setter.getName().substring(3);
                }
                compName =
                        compName.substring(0, 1).toLowerCase()
                                + compName.substring(1);
            } else {
                return inAnnot.value();
            }
        }
        return compName;
    }
View Full Code Here

        // Register all interfaces for this class
        this.registerInterfaces(componentClass);
        // Resolve injected Components
        for (ComponentAccessor accessor : getAllComponentAccessors(component)) {
            // Another annotated component
            In inAnnotation = accessor.getAnnotation(In.class);
            if (inAnnotation != null) {
                Object fieldVal = null;
                String compName = accessor.getComponentName();
                Class<?> compType = accessor.getComponentType();
                Class<?> implType = getImplClass(compType);

                // TODO stateless components should not / need not be cached
                // autowire the component if not done yet
                if (!namedComponents.containsKey(compName)) {
                    boolean required = inAnnotation.required();
                    boolean autoCreate = implType.isAnnotationPresent(AutoCreate.class);
                    Scope scopeAnn = implType.getAnnotation(Scope.class);
                    boolean stateless = false;
                    if (scopeAnn != null) {
                        stateless = scopeAnn.value() == ScopeType.STATELESS;
                    }
                    boolean mayCreate = inAnnotation.create() || autoCreate || stateless;
                    if (required && !mayCreate) {
                        String msg = "Not allowed to create required component "+compName+" with impl "+implType+". Try @AutoCreate or @In(create=true).";
                        if (ignoreNonResolvable) {
                            log.warn(msg);
                        } else {
View Full Code Here

    }

    @Override
    public String getComponentName() {
        String compName = null;
        In inAnnot = field.getAnnotation(In.class);

        if (inAnnot != null) {
            if (!inAnnot.value().trim().isEmpty()) {
                compName = inAnnot.value();
            }
        }

        // by default component name is the field name
        if (compName == null) {
View Full Code Here

   // Private methods

   private Object resolveSeamComponent(Field seamComponent)
   {
      final In in = seamComponent.getAnnotation(In.class);
      String name = in.value();
      if (name.isEmpty())
      {
         name = seamComponent.getName();
      }
      return getInstance(name);
View Full Code Here

TOP

Related Classes of org.jboss.seam.annotations.In

Copyright © 2018 www.massapicom. 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.