Examples of ComponentException


Examples of org.osgi.service.component.ComponentException

            {
                return Float.parseFloat((String)o );
            }
            catch ( NumberFormatException e )
            {
                throw new ComponentException(e);
            }
        }
        if (o instanceof Boolean)
        {
            return (Boolean)o? 1: 0;
        }
        if (o instanceof Character)
        {
            return ( float ) ((Character)o).charValue();
        }
        if (o instanceof Number)
        {
            return ((Number)o).floatValue();
        }
        if (o == null)
        {
            return 0;
        }
        throw new ComponentException( "Unrecognized input type: " + o);
    }
View Full Code Here

Examples of org.osgi.service.component.ComponentException

            {
                return Integer.parseInt( (String)o );
            }
            catch ( NumberFormatException e )
            {
                throw new ComponentException(e);
            }
        }
        if (o instanceof Boolean)
        {
            return (Boolean)o? 1: 0;
        }
        if (o instanceof Character)
        {
            return ( int ) ((Character)o).charValue();
        }
        if (o instanceof Number)
        {
            return ((Number)o).intValue();
        }
        if (o == null)
        {
            return 0;
        }
        throw new ComponentException( "Unrecognized input type: " + o);
    }
View Full Code Here

Examples of org.osgi.service.component.ComponentException

            {
                return Long.parseLong( (String)o );
            }
            catch ( NumberFormatException e )
            {
                throw new ComponentException(e);
            }
        }
        if (o instanceof Boolean)
        {
            return (Boolean)o? 1: 0;
        }
        if (o instanceof Character)
        {
            return ( long ) ((Character)o).charValue();
        }
        if (o instanceof Number)
        {
            return ((Number)o).longValue();
        }
        if (o == null)
        {
            return 0;
        }
        throw new ComponentException( "Unrecognized input type: " + o);
    }
View Full Code Here

Examples of org.osgi.service.component.ComponentException

            {
                return Short.parseShort( (String)o );
            }
            catch ( NumberFormatException e )
            {
                throw new ComponentException(e);
            }
        }
        if (o instanceof Boolean)
        {
            return (Boolean)o? 1: short0;
        }
        if (o instanceof Character)
        {
            return ( short ) ((Character)o).charValue();
        }
        if (o instanceof Number)
        {
            return ((Number)o).shortValue();
        }
        if (o == null)
        {
            return 0;
        }
        throw new ComponentException( "Unrecognized input type: " + o);
    }
View Full Code Here

Examples of org.osgi.service.component.ComponentException

            {
                return Boolean.parseBoolean( (String)o );
            }
            catch ( NumberFormatException e )
            {
                throw new ComponentException(e);
            }
        }
        if (o instanceof Character)
        {
            return ((Character)o).charValue() != 0;
        }
        if (o instanceof Number)
        {
            return ((Number)o).intValue() != 0;
        }
        if (o == null)
        {
            return false;
        }
        throw new ComponentException( "Unrecognized input type: " + o);
    }
View Full Code Here

Examples of org.osgi.service.component.ComponentException

            {
                return b.loadClass( (String)o );
            }
            catch ( ClassNotFoundException e )
            {
                throw new ComponentException(e);
            }
        }
        throw new ComponentException( "Unrecognized input type: " + o);
    }
View Full Code Here

Examples of org.osgi.service.component.ComponentException

            {
            return Enum.valueOf( clazz, (String)o );
            }
            catch ( IllegalArgumentException e )
            {
                throw new ComponentException(e);
            }
        }
        if (o == null)
        {
            return null;
        }
        throw new ComponentException( "Unrecognized input type: " + o);
    }
View Full Code Here

Examples of org.osgi.service.component.ComponentException

   
    private static Object firstCollectionElement( Object raw, Object defaultValue )
    {
        if (!(raw instanceof Collection))
        {
            throw new ComponentException("Not a collection: " + raw);
        }
        Collection<?> c = ( Collection<?> ) raw;
        if (c.isEmpty())
        {
            return defaultValue;
View Full Code Here

Examples of org.osgi.service.component.ComponentException

    }

    private static Object firstArrayElement(Object o, Object defaultValue)
    {
        if (o == null || !o.getClass().isArray()) {
            throw new ComponentException("Not an array: " + o);
        }
        if (Array.getLength( o ) == 0)
        {
            return defaultValue;
        }
View Full Code Here

Examples of org.osgi.service.component.ComponentException

                }
                buf.append( " as Component of Class " ).append( cMeta.getImplementationClassName() );
                message = buf.toString();
            }

            throw new ComponentException( message );
        }

        return key;
    }
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.