/** * Always throws an exception -- this configuration contains no entries. * * @throws NullPointerException {@inheritDoc} * @throws NoSuchEntryException unless <code>component</code>, <code>name</code>, or * <code>type</code> is <code>null</code> */ protected Object getEntryInternal( String component, String name, Class type, Object data) throws NoSuchEntryException { if (component == null || name == null || type == null) { throw new NullPointerException( "component, name and type cannot be null"); } throw new NoSuchEntryException( "Entry not found for component " + component + ", name " + name); } }
/** * Always throws an exception -- this configuration contains no entries. * * @throws NullPointerException {@inheritDoc} * @throws NoSuchEntryException unless <code>component</code>, * <code>name</code>, or <code>type</code> is <code>null</code> */ @Override protected <T> T getEntryInternal( String component, String name, Class<T> type, Object data) throws NoSuchEntryException { if (component == null || name == null || type == null) { throw new NullPointerException( "component, name and type cannot be null"); } throw new NoSuchEntryException( "Entry not found for component " + component + ", name " + name); } }
protected Object getEntryInternal(String component, String name, Class type, Object data) throws ConfigurationException { Object entry = entries.get(component + '.' + name); if (entry == null) { String entrySysProperty = System.getProperty(component + "." + name); if (entrySysProperty != null) { if (type.equals(String.class)) { return entrySysProperty; } Object number = parseNumber(entrySysProperty, type); if (number != null) { return number; } throw new NoSuchEntryException("Entry for component [" + component + "] and name [" + name + "] can't be parsed, can't handle type [" + type.getName() + "]"); } throw new NoSuchEntryException("No entry for component [" + component + "] and name [" + name + "]"); } if (entry instanceof ConfigurationEntryFactory) { entry = ((ConfigurationEntryFactory) entry).create(); } if (type.equals(int.class) || type.equals(long.class) || type.equals(float.class) || type.equals(boolean.class) || type.equals(short.class) || type.equals(double.class)) { return new Primitive(entry); } return entry; }
/** * Calls throwConfigurationException with a default NoSuchEntryException. */ private void oopsNoSuchEntry(String what) throws ConfigurationException { ErrorDescriptor error = new ErrorDescriptor(0, 0, what, location); throwConfigurationException( new NoSuchEntryException(error.toString()), Collections.singletonList(error)); throw new AssertionError("throwConfigurationException must throw" + " an exception"); }
/** * Calls throwConfigurationException with a default NoSuchEntryException. */ private void oopsNoSuchEntry(String what) throws ConfigurationException { ErrorDescriptor error = new ErrorDescriptor(0, 0, what, location); throwConfigurationException( new NoSuchEntryException(error.toString()), Collections.singletonList(error)); throw new AssertionError("throwConfigurationException must throw" + " an exception"); }