Package org.apache.felix.service.command

Examples of org.apache.felix.service.command.Parameter


                Map<String, String> optionDescs = new TreeMap();
                List<String> params = new ArrayList();
                Annotation[][] anns = m.getParameterAnnotations();
                for (int paramIdx = 0; paramIdx < anns.length; paramIdx++)
                {
                    Parameter p = findAnnotation(anns[paramIdx], Parameter.class);
                    d = findAnnotation(anns[paramIdx], Descriptor.class);
                    if (p != null)
                    {
                        if (p.presentValue().equals(Parameter.UNSPECIFIED))
                        {
                            options.put(p.names()[0], p);
                            if (d != null)
                            {
                                optionDescs.put(p.names()[0], d.value());
                            }
                        }
                        else
                        {
                            flags.put(p.names()[0], p);
                            if (d != null)
                            {
                                flagDescs.put(p.names()[0], d.value());
                            }
                        }
                    }
                    else if (d != null)
                    {
View Full Code Here


            for (Annotation a : as)
            {
                if (a instanceof Parameter)
                {
                    int i = -1;
                    Parameter p = (Parameter) a;
                    for (String name : p.names())
                    {
                        i = parms.indexOf(name);
                        if (i >= 0)
                            break;
                    }

                    if (i >= 0)
                    {
                        // parameter present
                        parms.remove(i);
                        Object value = p.presentValue();
                        if (Parameter.UNSPECIFIED.equals(value))
                        {
                            if (i >= parms.size())
                                return null; // missing parameter, so try other methods
                            value = parms.remove(i);
                        }
                        out.add(value);
                    }
                    else
                    {
                        out.add(p.absentValue());
                    }

                }
            }
        }
View Full Code Here

            Annotation as[] = pas[argIndex];
            for (int a = 0; a < as.length; a++)
            {
                if (as[a] instanceof Parameter)
                {
                    Parameter o = (Parameter) as[a];
                    out[argIndex] = coerce(session, target, types[argIndex],
                        o.absentValue());
                    start = argIndex + 1;
                }
            }
        }

        in = new ArrayList(in);
        for (Iterator<Object> itArgs = in.iterator(); itArgs.hasNext();)
        {
            Object item = itArgs.next();
            if (item instanceof String)
            {
                if (((String) item).startsWith("-"))
                {
                    for (int argIndex = 0; argIndex < pas.length; argIndex++)
                    {
                        Annotation as[] = pas[argIndex];
                        for (int a = 0; a < as.length; a++)
                        {
                            if (as[a] instanceof Parameter)
                            {
                                Parameter param = (Parameter) as[a];
                                for (String name : param.names())
                                {
                                    if (name.equals(item))
                                    {
                                        if (param.presentValue() == null || param.presentValue().equals(Parameter.UNSPECIFIED))
                                        {
                                            itArgs.remove(); // parameter name
                                            assert itArgs.hasNext();
                                            Object value = itArgs.next(); // the value
                                            itArgs.remove(); // remove it
                                            out[argIndex] = coerce(session, target,
                                                types[argIndex], value);
                                        }
                                        else if (param.presentValue() != null)
                                        {
                                            itArgs.remove();
                                            out[argIndex] = coerce(session, target,
                                                types[argIndex], param.presentValue());
                                        }
                                        break;
                                    }
                                }
                            }
View Full Code Here

TOP

Related Classes of org.apache.felix.service.command.Parameter

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.