org.gradle.api.internal.AbstractTask Java Examples
The following examples show how to use
org.gradle.api.internal.AbstractTask.
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 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 #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 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 #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: AnnotationProcessingTaskFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public void attachActions(PropertyInfo parent, Class<?> type) { Class<?> superclass = type.getSuperclass(); if (!(superclass == null // Avoid reflecting on classes we know we don't need to look at || superclass.equals(ConventionTask.class) || superclass.equals(DefaultTask.class) || superclass.equals(AbstractTask.class) || superclass.equals(Object.class) )) { attachActions(parent, superclass); } for (Method method : type.getDeclaredMethods()) { if (!isGetter(method)) { continue; } String name = method.getName(); int prefixLength = name.startsWith("is") ? 2 : 3; // it's 'get' if not 'is'. String fieldName = StringUtils.uncapitalize(name.substring(prefixLength)); String propertyName = fieldName; if (parent != null) { propertyName = parent.getName() + '.' + propertyName; } PropertyInfo propertyInfo = new PropertyInfo(type, this, parent, propertyName, method); attachValidationActions(propertyInfo, fieldName); if (propertyInfo.required) { properties.add(propertyInfo); } } }
Example #6
Source File: AnnotationProcessingTaskFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public void attachActions(PropertyInfo parent, Class<?> type) { Class<?> superclass = type.getSuperclass(); if (!(superclass == null // Avoid reflecting on classes we know we don't need to look at || superclass.equals(ConventionTask.class) || superclass.equals(DefaultTask.class) || superclass.equals(AbstractTask.class) || superclass.equals(Object.class) )) { attachActions(parent, superclass); } for (Method method : type.getDeclaredMethods()) { if (!isGetter(method)) { continue; } String name = method.getName(); int prefixLength = name.startsWith("is") ? 2 : 3; // it's 'get' if not 'is'. String fieldName = StringUtils.uncapitalize(name.substring(prefixLength)); String propertyName = fieldName; if (parent != null) { propertyName = parent.getName() + '.' + propertyName; } PropertyInfo propertyInfo = new PropertyInfo(type, this, parent, propertyName, method); attachValidationActions(propertyInfo, fieldName); if (propertyInfo.required) { properties.add(propertyInfo); } } }
Example #7
Source File: AnnotationProcessingTaskFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void attachActions(PropertyInfo parent, Class<?> type) { Class<?> superclass = type.getSuperclass(); if (!(superclass == null // Avoid reflecting on classes we know we don't need to look at || superclass.equals(ConventionTask.class) || superclass.equals(DefaultTask.class) || superclass.equals(AbstractTask.class) || superclass.equals(Object.class) )) { attachActions(parent, superclass); } for (Method method : type.getDeclaredMethods()) { if (!isGetter(method)) { continue; } String name = method.getName(); int prefixLength = name.startsWith("is") ? 2 : 3; // it's 'get' if not 'is'. String fieldName = StringUtils.uncapitalize(name.substring(prefixLength)); String propertyName = fieldName; if (parent != null) { propertyName = parent.getName() + '.' + propertyName; } PropertyInfo propertyInfo = new PropertyInfo(type, this, parent, propertyName, method); attachValidationActions(propertyInfo, fieldName); if (propertyInfo.required) { properties.add(propertyInfo); } } }
Example #8
Source File: AnnotationProcessingTaskFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void attachActions(PropertyInfo parent, Class<?> type) { Class<?> superclass = type.getSuperclass(); if (!(superclass == null // Avoid reflecting on classes we know we don't need to look at || superclass.equals(ConventionTask.class) || superclass.equals(DefaultTask.class) || superclass.equals(AbstractTask.class) || superclass.equals(Object.class) )) { attachActions(parent, superclass); } for (Method method : type.getDeclaredMethods()) { if (!isGetter(method)) { continue; } String name = method.getName(); int prefixLength = name.startsWith("is") ? 2 : 3; // it's 'get' if not 'is'. String fieldName = StringUtils.uncapitalize(name.substring(prefixLength)); String propertyName = fieldName; if (parent != null) { propertyName = parent.getName() + '.' + propertyName; } PropertyInfo propertyInfo = new PropertyInfo(type, this, parent, propertyName, method); attachValidationActions(propertyInfo, fieldName); if (propertyInfo.required) { properties.add(propertyInfo); } } }