Package org.apache.felix.ipojo.parser

Examples of org.apache.felix.ipojo.parser.FieldMetadata


    }

    /*
     * Get iPojo metadata
     */
    FieldMetadata fieldIPojoMetadata = null;
    if ((pojoMetadata != null) && (pojoMetadata.getField(fieldName) != null)) {
      fieldIPojoMetadata = pojoMetadata.getField(fieldName);
    }

    if (fieldIPojoMetadata != null) {

      /*
       * Verify if it is a collection
       */
      String collectionType = getCollectionType(fieldIPojoMetadata);
      if (collectionType != null) {
        return collectionType;
      }

      /*
       * Verify if it is a message
       */
      String messageType = getMessageType(fieldIPojoMetadata);
      if (messageType != null) {
        return messageType;
      }

      /*
       * Otherwise we just return the raw type
       */
      return fieldIPojoMetadata.getFieldType();
    }

    throw new NoSuchFieldException("unavailable field " + fieldName);

  }
View Full Code Here


    }
   
    /*
     * Get iPojo metadata
     */
    FieldMetadata fieldIPojoMetadata = null;
    if ((pojoMetadata != null) && (pojoMetadata.getField(fieldName) != null)) {
      fieldIPojoMetadata = pojoMetadata.getField(fieldName);
    }

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

    }

    /*
     * Get iPojo metadata
     */
    FieldMetadata fieldIPojoMetadata = null;
    if ((pojoMetadata != null) && (pojoMetadata.getField(fieldName) != null)) {
      fieldIPojoMetadata = pojoMetadata.getField(fieldName);
    }

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

     * TODO We keep a reference to the class of the field, this may prevent the class loader from being
     * garbage collected and the class from being updated. We need to verify what is the behavior of OSGi
     * when the class of a field is updated, and adjust this implementation accordingly.
     */
   
    FieldMetadata field = factory.getPojoMetadata().getField(injection.getName());
    String fieldType   = FieldMetadata.getReflectionType(field.getFieldType());
   
    this.fieldClass   = factory.loadClass(fieldType);
    this.isCollection   = injection.acceptMultipleProviders();
   
    /*
 
View Full Code Here

                + injection.getName() + " :"
                            + error.getLocalizedMessage());
                }

                if (injection instanceof InjectedField) {
                    FieldMetadata field = getPojoMetadata().getField(injection.getName());
                    if (field != null)
                        getInstanceManager().register(field, interceptor);
                }
            }
    }
View Full Code Here

            String id = field;
            if (deps[i].containsAttribute("id")) {
                id = deps[i].getAttribute("id");
            }

            FieldMetadata fieldmeta = manipulation.getField(field);
            if (fieldmeta == null) {
                error("The field " + field + " does not exist in the class " + getInstanceManager().getClassName());
                return;
            }

            boolean agg = false;
            boolean collection = false;
            String spec = fieldmeta.getFieldType();
            if (spec.endsWith("[]")) {
                agg = true;
                spec = spec.substring(0, spec.length() - 2);
            } else if (Collection.class.getName().equals(spec)) {
                agg = true;
View Full Code Here

        //First get Pojo Metadata metadata :
        PojoMetadata pojoMeta = getPojoMetadata();
        Enumeration e = m_properties.keys();
        while (e.hasMoreElements()) {
            String field = (String) e.nextElement();
            FieldMetadata fm = pojoMeta.getField(field);

            if (fm == null) { // The field does not exist
                throw new ConfigurationException("The field " + field + " is declared in the properties file but does not exist in the pojo");
            }

            // Then check that the field is a String field
            if (!fm.getFieldType().equals(String.class.getName())) {
                throw new ConfigurationException("The field " + field + " exists in the pojo, but is not a String");
            }

            // All checks are ok, register the interceptor.
            getInstanceManager().register(fm, this);
View Full Code Here

     * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.InstanceManager, org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)
     */
    public void configure(Element metadata, Dictionary configuration) throws ConfigurationException {
        Element[] controller = metadata.getElements("controller");
        m_field = controller[0].getAttribute("field");
        getInstanceManager().register(new FieldMetadata(m_field, "boolean"), this);
    }
View Full Code Here

        if (field == null) {
            throw new ConfigurationException("Lifecycle controller : the controller element needs to contain a field attribute");
        }

        PojoMetadata method = getFactory().getPojoMetadata();
        FieldMetadata fieldMetadata = method.getField(field);
        if (fieldMetadata == null) {
            throw new ConfigurationException("Lifecycle controller : The field " + field + " does not exist in the implementation class");
        }

        if (!fieldMetadata.getFieldType().equalsIgnoreCase("boolean")) {
            throw new ConfigurationException("Lifecycle controller : The field " + field + " must be a boolean (" + fieldMetadata.getFieldType() + " found)");
        }
    }
View Full Code Here

                    }
                    type = method[0].getMethodArguments()[0];
                    configurables[i].addAttribute(new Attribute("type", type)); // Add the type to avoid configure checking
                }
            } else if (fieldName != null) {
                FieldMetadata field = manipulation.getField(fieldName);
                if (field == null) { throw new ConfigurationException("Malformed property : The field " + fieldName + " does not exist in the implementation class"); }
                type = field.getFieldType();
                configurables[i].addAttribute(new Attribute("type", type)); // Add the type to avoid configure checking
            } else if (paramIndex != null) {
                int index = Integer.parseInt(paramIndex);
                type = configurables[i].getAttribute("type");
                MethodMetadata[] cts = manipulation.getConstructors();
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.parser.FieldMetadata

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.