public boolean canConvert(final Type type) { for (PicoContainer container : containers) { if (container instanceof Converting && ((Converting) container).getConverters().canConvert(type)) { return true; } } return false; }
public boolean canConvert(final Type type) { for (PicoContainer container : containers) { if (container instanceof Converting && ((Converting) container).getConverters().canConvert(type)) { return true; } } return false; }
public Object convert(final String paramValue, final Type type) { for (PicoContainer container : containers) { if (container instanceof Converting) { Converters converter = ((Converting) container).getConverters(); if (converter.canConvert(type)) { return converter.convert(paramValue, type); } } } return null; } }
public Object convert(final String paramValue, final Type type) { for (PicoContainer container : containers) { if (container instanceof Converting) { Converters converter = ((Converting) container).getConverters(); if (converter.canConvert(type)) { return converter.convert(paramValue, type); } } } return null; } }
protected <T> boolean isCompatible(final Generic<T> type, final ComponentAdapter<?> testValue, final PicoContainer container) { Class<?> componentImplementation = testValue.getComponentImplementation(); //Normal happy path. boolean compatible = JTypeHelper.isAssignableFrom(type, testValue.getComponentImplementation()); if (compatible == false) { //String conversion if ((componentImplementation == String.class && getConverters(container).canConvert(type.getType()))) { compatible = true; } //javax.inject.Provider -- have to compare the return type of the provider to //the desired type instead. if (compatible == false) { if (testValue.findAdapterOfType(ProviderAdapter.class) != null) { ProviderAdapter providerAdapter = testValue.findAdapterOfType(ProviderAdapter.class); compatible = JTypeHelper.isAssignableFrom(type, providerAdapter.getProviderReturnType()); } } } return compatible; }
protected <T> boolean isCompatible(final Generic<T> type, final ComponentAdapter<?> testValue, final PicoContainer container) { Class<?> componentImplementation = testValue.getComponentImplementation(); //Normal happy path. boolean compatible = JTypeHelper.isAssignableFrom(type, testValue.getComponentImplementation()); if (compatible == false) { //String conversion if ((componentImplementation == String.class && getConverters(container).canConvert(type.getType()))) { compatible = true; } //javax.inject.Provider -- have to compare the return type of the provider to //the desired type instead. if (compatible == false) { if (testValue.findAdapterOfType(ProviderAdapter.class) != null) { ProviderAdapter providerAdapter = testValue.findAdapterOfType(ProviderAdapter.class); compatible = JTypeHelper.isAssignableFrom(type, providerAdapter.getProviderReturnType()); } } } return compatible; }