Package com.google.inject

Examples of com.google.inject.ProvisionException


            }
          });
          errors.throwIfNewErrors(0);
          return t;
        } catch (ErrorsException e) {
          throw new ProvisionException(errors.merge(e.getErrors()).getMessages());
        }
      }

      @Override public String toString() {
        return factory.toString();
View Full Code Here


        case HBASE_98:
          // for our needs HBase 0.98 is API compatible with 0.96
          instance = createInstance(getHBase96Classname());
          break;
        case UNKNOWN:
          throw new ProvisionException("Unknown HBase version: " + HBaseVersion.getVersionString());
      }
    } catch (ClassNotFoundException cnfe) {
      throw new ProvisionException(cnfe.getMessage(), cnfe);
    }
    return instance;
  }
View Full Code Here

            H2EmbeddedDataSourceConfig config = injector.getInstance(Key.get(H2EmbeddedDataSourceConfig.class, annotation));
            try {
                return new H2EmbeddedDataSource(config);
            }
            catch (Exception e) {
                throw new ProvisionException("Error creating a H2EmbeddedDataSource", e);
            }
        }
View Full Code Here

                    try {
                        f.set(instance, context.get(f.getType()));
                    } catch (IllegalAccessException e) {
                        throw (Error) new IllegalAccessError(e.getMessage()).initCause(e);
                    } catch (InterruptedException e) {
                        throw new ProvisionException("Failed to set a context parameter", e);
                    } catch (IOException e) {
                        throw new ProvisionException("Failed to set a context parameter", e);
                    }
                }
            }

            class MethodInjector<T> extends ParameterInjector<T> {
                final Method m;

                MethodInjector(Method m) {
                    this.m = m;
                    m.setAccessible(true);
                }

                @Override
                public void injectMembers(T instance) {
                    try {
                        Class<?>[] types = m.getParameterTypes();
                        Object[] args = new Object[types.length];
                        for (int i = 0; i < args.length; i++) {
                            args[i] = context.get(types[i]);
                        }
                        m.invoke(instance, args);
                    } catch (IllegalAccessException e) {
                        throw (Error) new IllegalAccessError(e.getMessage()).initCause(e);
                    } catch (InvocationTargetException e) {
                        throw new ProvisionException("Failed to set a context parameter", e);
                    } catch (InterruptedException e) {
                        throw new ProvisionException("Failed to set a context parameter", e);
                    } catch (IOException e) {
                        throw new ProvisionException("Failed to set a context parameter", e);
                    }
                }
            }
        });
    }
View Full Code Here

                    try {
                        f.set(instance, context.get(f.getType()));
                    } catch (IllegalAccessException e) {
                        throw (Error) new IllegalAccessError(e.getMessage()).initCause(e);
                    } catch (InterruptedException e) {
                        throw new ProvisionException("Failed to set a context parameter", e);
                    } catch (IOException e) {
                        throw new ProvisionException("Failed to set a context parameter", e);
                    }
                }
View Full Code Here

                        }
                        m.invoke(instance, args);
                    } catch (IllegalAccessException e) {
                        throw (Error) new IllegalAccessError(e.getMessage()).initCause(e);
                    } catch (InvocationTargetException e) {
                        throw new ProvisionException("Failed to set a context parameter", e);
                    } catch (InterruptedException e) {
                        throw new ProvisionException("Failed to set a context parameter", e);
                    } catch (IOException e) {
                        throw new ProvisionException("Failed to set a context parameter", e);
                    }
                }
View Full Code Here

            method.invoke( bean, value );
        }
        catch ( final Exception e )
        {
            final Throwable cause = e instanceof InvocationTargetException ? e.getCause() : e;
            throw new ProvisionException( "Error injecting: " + method, cause );
        }
        catch ( final LinkageError e )
        {
            throw new ProvisionException( "Error injecting: " + method, e );
        }
    }
View Full Code Here

        {
            field.set( bean, value );
        }
        catch ( final Exception e )
        {
            throw new ProvisionException( "Error injecting: " + field, e );
        }
        catch ( final LinkageError e )
        {
            throw new ProvisionException( "Error injecting: " + field, e );
        }
    }
View Full Code Here

                        visited.remove( name );
                    }
                }
                catch ( final RuntimeException e )
                {
                    encounter.addError( new ProvisionException( "Error binding: " + property, e ) );
                }
            }
        }

        if ( bindings.size() > 0 )
View Full Code Here

            {
                value = key.substring( anchor + 2 );
            }
            if ( expressionNum++ >= EXPRESSION_RECURSION_LIMIT )
            {
                throw new ProvisionException( "Recursive configuration: " + template + " stopped at: " + buf );
            }
            final int len = buf.length();
            if ( 0 == x && len == y && String.class != clazz && clazz.isInstance( value ) )
            {
                return value; // found compatible (non-String) instance in the properties!
View Full Code Here

TOP

Related Classes of com.google.inject.ProvisionException

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.