org.gradle.internal.reflect.ObjectInstantiationException Java Examples
The following examples show how to use
org.gradle.internal.reflect.ObjectInstantiationException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TaskFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private TaskInternal createTaskObject(ProjectInternal project, final Class<? extends TaskInternal> type, String name, boolean generateGetters) { if (!Task.class.isAssignableFrom(type)) { throw new InvalidUserDataException(String.format( "Cannot create task of type '%s' as it does not implement the Task interface.", type.getSimpleName())); } final Class<? extends TaskInternal> generatedType; if (generateGetters) { generatedType = generator.generate(type); } else { generatedType = type; } return AbstractTask.injectIntoNewInstance(project, name, new Callable<TaskInternal>() { public TaskInternal call() throws Exception { try { return instantiator.newInstance(generatedType); } catch (ObjectInstantiationException e) { throw new TaskInstantiationException(String.format("Could not create task of type '%s'.", type.getSimpleName()), e.getCause()); } } }); }
Example #2
Source File: TaskFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private TaskInternal createTaskObject(ProjectInternal project, final Class<? extends TaskInternal> type, String name, boolean generateGetters) { if (!Task.class.isAssignableFrom(type)) { throw new InvalidUserDataException(String.format( "Cannot create task of type '%s' as it does not implement the Task interface.", type.getSimpleName())); } final Class<? extends TaskInternal> generatedType; if (generateGetters) { generatedType = generator.generate(type); } else { generatedType = type; } return AbstractTask.injectIntoNewInstance(project, name, new Callable<TaskInternal>() { public TaskInternal call() throws Exception { try { return instantiator.newInstance(generatedType); } catch (ObjectInstantiationException e) { throw new TaskInstantiationException(String.format("Could not create task of type '%s'.", type.getSimpleName()), e.getCause()); } } }); }
Example #3
Source File: TaskFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private TaskInternal createTaskObject(ProjectInternal project, final Class<? extends TaskInternal> type, String name, boolean generateGetters) { if (!Task.class.isAssignableFrom(type)) { throw new InvalidUserDataException(String.format( "Cannot create task of type '%s' as it does not implement the Task interface.", type.getSimpleName())); } final Class<? extends TaskInternal> generatedType; if (generateGetters) { generatedType = generator.generate(type); } else { generatedType = type; } return AbstractTask.injectIntoNewInstance(project, name, new Callable<TaskInternal>() { public TaskInternal call() throws Exception { try { return instantiator.newInstance(generatedType); } catch (ObjectInstantiationException e) { throw new TaskInstantiationException(String.format("Could not create task of type '%s'.", type.getSimpleName()), e.getCause()); } } }); }
Example #4
Source File: TaskFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private TaskInternal createTaskObject(ProjectInternal project, final Class<? extends TaskInternal> type, String name, boolean generateGetters) { if (!Task.class.isAssignableFrom(type)) { throw new InvalidUserDataException(String.format( "Cannot create task of type '%s' as it does not implement the Task interface.", type.getSimpleName())); } final Class<? extends TaskInternal> generatedType; if (generateGetters) { generatedType = generator.generate(type); } else { generatedType = type; } return AbstractTask.injectIntoNewInstance(project, name, new Callable<TaskInternal>() { public TaskInternal call() throws Exception { try { return instantiator.newInstance(generatedType); } catch (ObjectInstantiationException e) { throw new TaskInstantiationException(String.format("Could not create task of type '%s'.", type.getSimpleName()), e.getCause()); } } }); }
Example #5
Source File: BaseLanguageSourceSet.java From javaide with GNU General Public License v3.0 | 5 votes |
public static <T extends LanguageSourceSet> T create(Class<? extends LanguageSourceSet> publicType, Class<T> implementationType, ComponentSpecIdentifier componentId, SourceDirectorySetFactory sourceDirectorySetFactory) { NEXT_SOURCE_SET_INFO.set(new SourceSetInfo(componentId, publicType, sourceDirectorySetFactory)); try { try { return DirectInstantiator.INSTANCE.newInstance(implementationType); } catch (ObjectInstantiationException e) { throw new ModelInstantiationException(String.format("Could not create LanguageSourceSet of type %s", publicType.getSimpleName()), e.getCause()); } } finally { NEXT_SOURCE_SET_INFO.set(null); } }
Example #6
Source File: DefaultPluginRegistry.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public <T extends Plugin> T loadPlugin(Class<T> pluginClass) { if (!Plugin.class.isAssignableFrom(pluginClass)) { throw new InvalidUserDataException(String.format( "Cannot create plugin of type '%s' as it does not implement the Plugin interface.", pluginClass.getSimpleName())); } try { return instantiator.newInstance(pluginClass); } catch (ObjectInstantiationException e) { throw new PluginInstantiationException(String.format("Could not create plugin of type '%s'.", pluginClass.getSimpleName()), e.getCause()); } }
Example #7
Source File: ServiceLocator.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public T newInstance(Object... params) { Instantiator instantiator = new DirectInstantiator(); try { return instantiator.newInstance(implementationClass, params); } catch (ObjectInstantiationException t) { throw new RuntimeException(String.format("Could not create an implementation of service '%s'.", serviceType.getName()), t); } }
Example #8
Source File: DefaultPluginRegistry.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public <T extends Plugin<?>> T loadPlugin(Class<T> pluginClass) { if (!Plugin.class.isAssignableFrom(pluginClass)) { throw new InvalidUserDataException(String.format( "Cannot create plugin of type '%s' as it does not implement the Plugin interface.", pluginClass.getSimpleName())); } try { return instantiator.newInstance(pluginClass); } catch (ObjectInstantiationException e) { throw new PluginInstantiationException(String.format("Could not create plugin of type '%s'.", pluginClass.getSimpleName()), e.getCause()); } }
Example #9
Source File: ServiceLocator.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public T newInstance(Object... params) { Instantiator instantiator = new DirectInstantiator(); try { return instantiator.newInstance(implementationClass, params); } catch (ObjectInstantiationException t) { throw new RuntimeException(String.format("Could not create an implementation of service '%s'.", serviceType.getName()), t); } }
Example #10
Source File: BaseComponentSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public static <T extends BaseComponentSpec> T create(Class<T> type, ComponentSpecIdentifier identifier, FunctionalSourceSet mainSourceSet, Instantiator instantiator) { if (type.equals(BaseComponentSpec.class)) { throw new ModelInstantiationException("Cannot create instance of abstract class BaseComponentSpec."); } nextComponentInfo.set(new ComponentInfo(identifier, type.getSimpleName(), mainSourceSet)); try { try { return instantiator.newInstance(type); } catch (ObjectInstantiationException e) { throw new ModelInstantiationException(String.format("Could not create component of type %s", type.getSimpleName()), e.getCause()); } } finally { nextComponentInfo.set(null); } }
Example #11
Source File: BaseBinarySpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public static <T extends BaseBinarySpec> T create(Class<T> type, BinaryNamingScheme namingScheme, Instantiator instantiator) { if (type.equals(BaseBinarySpec.class)) { throw new ModelInstantiationException("Cannot create instance of abstract class BaseBinarySpec."); } nextBinaryInfo.set(new BinaryInfo(namingScheme, type.getSimpleName())); try { try { return instantiator.newInstance(type); } catch (ObjectInstantiationException e) { throw new ModelInstantiationException(String.format("Could not create binary of type %s", type.getSimpleName()), e.getCause()); } } finally { nextBinaryInfo.set(null); } }
Example #12
Source File: BaseBinarySpec.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public static <T extends BaseBinarySpec> T create(Class<T> type, BinaryNamingScheme namingScheme, Instantiator instantiator) { if (type.equals(BaseBinarySpec.class)) { throw new ModelInstantiationException("Cannot create instance of abstract class BaseBinarySpec."); } nextBinaryInfo.set(new BinaryInfo(namingScheme, type.getSimpleName())); try { try { return instantiator.newInstance(type); } catch (ObjectInstantiationException e) { throw new ModelInstantiationException(String.format("Could not create binary of type %s", type.getSimpleName()), e.getCause()); } } finally { nextBinaryInfo.set(null); } }
Example #13
Source File: DefaultPluginRegistry.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public <T extends Plugin> T loadPlugin(Class<T> pluginClass) { if (!Plugin.class.isAssignableFrom(pluginClass)) { throw new InvalidUserDataException(String.format( "Cannot create plugin of type '%s' as it does not implement the Plugin interface.", pluginClass.getSimpleName())); } try { return instantiator.newInstance(pluginClass); } catch (ObjectInstantiationException e) { throw new PluginInstantiationException(String.format("Could not create plugin of type '%s'.", pluginClass.getSimpleName()), e.getCause()); } }
Example #14
Source File: ServiceLocator.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public T newInstance(Object... params) { Instantiator instantiator = new DirectInstantiator(); try { return instantiator.newInstance(implementationClass, params); } catch (ObjectInstantiationException t) { throw new RuntimeException(String.format("Could not create an implementation of service '%s'.", serviceType.getName()), t); } }
Example #15
Source File: DefaultPluginRegistry.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public <T extends Plugin<?>> T loadPlugin(Class<T> pluginClass) { if (!Plugin.class.isAssignableFrom(pluginClass)) { throw new InvalidUserDataException(String.format( "Cannot create plugin of type '%s' as it does not implement the Plugin interface.", pluginClass.getSimpleName())); } try { return instantiator.newInstance(pluginClass); } catch (ObjectInstantiationException e) { throw new PluginInstantiationException(String.format("Could not create plugin of type '%s'.", pluginClass.getSimpleName()), e.getCause()); } }
Example #16
Source File: ServiceLocator.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public T newInstance(Object... params) { Instantiator instantiator = new DirectInstantiator(); try { return instantiator.newInstance(implementationClass, params); } catch (ObjectInstantiationException t) { throw new RuntimeException(String.format("Could not create an implementation of service '%s'.", serviceType.getName()), t); } }
Example #17
Source File: BaseComponentSpec.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public static <T extends BaseComponentSpec> T create(Class<T> type, ComponentSpecIdentifier identifier, FunctionalSourceSet mainSourceSet, Instantiator instantiator) { if (type.equals(BaseComponentSpec.class)) { throw new ModelInstantiationException("Cannot create instance of abstract class BaseComponentSpec."); } nextComponentInfo.set(new ComponentInfo(identifier, type.getSimpleName(), mainSourceSet)); try { try { return instantiator.newInstance(type); } catch (ObjectInstantiationException e) { throw new ModelInstantiationException(String.format("Could not create component of type %s", type.getSimpleName()), e.getCause()); } } finally { nextComponentInfo.set(null); } }