Package aQute.bnd.osgi

Examples of aQute.bnd.osgi.Annotation


            String propertiesDesc = annotation.get("description");

            MetaType.OCD ocd = new MetaType.OCD(pid, propertiesHeading, propertiesDesc);
            for (Object p: (Object[]) annotation.get("metadata"))
            {
                Annotation property = (Annotation) p;
                String heading = property.get("heading");
                String id = property.get("id");
                String type = (String) property.get("type");
                type = (type != null) ? Patterns.parseClass(type, Patterns.CLASS, 1) : null;
                Object[] defaults = (Object[]) property.get("defaults");
                String description = property.get("description");
                Integer cardinality = property.get("cardinality");
                Boolean required = property.get("required");

                MetaType.AD ad = new MetaType.AD(id, type, defaults, heading, description,
                    cardinality, required);

                Object[] optionLabels = property.get("optionLabels");
                Object[] optionValues = property.get("optionValues");

                if (optionLabels == null
                    && optionValues != null
                    ||
                    optionLabels != null
View Full Code Here


            if (parameters != null)
            {
                JSONObject properties = new JSONObject();
                for (Object p : parameters)
                {
                    Annotation a = (Annotation) p;
                    String name = (String) a.get("name");

                    String type = a.get("type");
                    Class<?> classType;
                    try
                    {
                        classType = (type == null) ? String.class : Class.forName(Patterns.parseClass(type,
                            Patterns.CLASS, 1));
                    }
                    catch (ClassNotFoundException e)
                    {
                        // Theorically impossible
                        throw new IllegalArgumentException("Invalid Property type " + type
                            + " from annotation " + annotation + " in class " + m_className);
                    }

                    Object[] values;

                    if ((values = a.get("value")) != null)
                    {
                        values = checkPropertyType(name, classType, values);
                        addProperty(properties, name, values, classType);
                    }
                    else if ((values = a.get("values")) != null)
                    { // deprecated
                        values = checkPropertyType(name, classType, values);
                        addProperty(properties, name, values, classType);
                    }
                    else if ((values = a.get("longValue")) != null)
                    {
                        addProperty(properties, name, values, Long.class);
                    }
                    else if ((values = a.get("doubleValue")) != null)
                    {
                        addProperty(properties, name, values, Double.class);
                    }
                    else if ((values = a.get("floatValue")) != null)
                    {
                        addProperty(properties, name, values, Float.class);
                    }
                    else if ((values = a.get("intValue")) != null)
                    {
                        addProperty(properties, name, values, Integer.class);
                    }
                    else if ((values = a.get("byteValue")) != null)
                    {
                        addProperty(properties, name, values, Byte.class);
                    }
                    else if ((values = a.get("charValue")) != null)
                    {
                        addProperty(properties, name, values, Character.class);
                    }
                    else if ((values = a.get("booleanValue")) != null)
                    {
                        addProperty(properties, name, values, Boolean.class);
                    }
                    else if ((values = a.get("shortValue")) != null)
                    {
                        addProperty(properties, name, values, Short.class);
                    }
                    else
                    {
View Full Code Here

TOP

Related Classes of aQute.bnd.osgi.Annotation

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.