org.gradle.platform.base.ModelInstantiationException Java Examples

The following examples show how to use org.gradle.platform.base.ModelInstantiationException. 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: BaseBinarySpec.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #2
Source File: BaseBinarySpec.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private BaseBinarySpec(BinaryInfo info) {
    if (info == null) {
        throw new ModelInstantiationException("Direct instantiation of a BaseBinarySpec is not permitted. Use a BinaryTypeBuilder instead.");
    }
    this.typeName = info.typeName;
    this.namingScheme = info.namingScheme;
}
 
Example #3
Source File: BaseComponentSpec.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #4
Source File: BaseComponentSpec.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private BaseComponentSpec(ComponentInfo info) {
    if (info == null) {
        throw new ModelInstantiationException("Direct instantiation of a BaseComponentSpec is not permitted. Use a ComponentTypeBuilder instead.");
    }

    this.identifier = info.componentIdentifier;
    this.typeName = info.typeName;
    this.mainSourceSet = info.sourceSets;
    sourceSets.addMainSources(this.mainSourceSet);
}
 
Example #5
Source File: BaseLanguageSourceSet.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
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: BaseBinarySpec.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #7
Source File: BaseBinarySpec.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private BaseBinarySpec(BinaryInfo info) {
    if (info == null) {
        throw new ModelInstantiationException("Direct instantiation of a BaseBinarySpec is not permitted. Use a BinaryTypeBuilder instead.");
    }
    this.typeName = info.typeName;
    this.namingScheme = info.namingScheme;
}
 
Example #8
Source File: BaseComponentSpec.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #9
Source File: BaseComponentSpec.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private BaseComponentSpec(ComponentInfo info) {
    if (info == null) {
        throw new ModelInstantiationException("Direct instantiation of a BaseComponentSpec is not permitted. Use a ComponentTypeBuilder instead.");
    }

    this.identifier = info.componentIdentifier;
    this.typeName = info.typeName;
    this.mainSourceSet = info.sourceSets;
    sourceSets.addMainSources(this.mainSourceSet);
}
 
Example #10
Source File: BaseLanguageSourceSet.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
private static SourceSetInfo validate(SourceSetInfo info) {
    if (info == null) {
        throw new ModelInstantiationException("Direct instantiation of a BaseLanguageSourceSet is not permitted. Use a @ComponentType rule instead.");
    }
    return info;
}