本文整理汇总了Java中org.gradle.internal.typeconversion.NotationParser类的典型用法代码示例。如果您正苦于以下问题:Java NotationParser类的具体用法?Java NotationParser怎么用?Java NotationParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NotationParser类属于org.gradle.internal.typeconversion包,在下文中一共展示了NotationParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: module
import org.gradle.internal.typeconversion.NotationParser; //导入依赖的package包/类
public ComponentModuleMetadataDetails module(final Object sourceModule) {
final NotationParser<Object, ModuleIdentifier> parser = parser();
final ModuleIdentifier source = parser.parseNotation(sourceModule);
return new ComponentModuleMetadataDetails() {
public void replacedBy(final Object targetModule) {
ModuleIdentifier target = parser.parseNotation(targetModule);
detectCycles(replacements, source, target);
replacements.put(source, target);
}
public ModuleIdentifier getId() {
return source;
}
public ModuleIdentifier getReplacedBy() {
return replacements.get(source);
}
};
}
示例2: adaptToEnum
import org.gradle.internal.typeconversion.NotationParser; //导入依赖的package包/类
private static <T, S> T adaptToEnum(Class<T> targetType, S sourceObject) {
try {
String literal;
if (sourceObject instanceof Enum) {
literal = ((Enum<?>) sourceObject).name();
} else if (sourceObject instanceof String) {
literal = (String) sourceObject;
} else {
literal = sourceObject.toString();
}
NotationParser<String, T> parser = new NotationConverterToNotationParserAdapter<String, T>(new EnumFromCharSequenceNotationParser(targetType));
T parsedLiteral = parser.parseNotation(literal);
return targetType.cast(parsedLiteral);
} catch (TypeConversionException e) {
throw new IllegalArgumentException(String.format("Can't convert '%s' to enum type '%s'", sourceObject, targetType.getSimpleName()), e);
}
}
示例3: create
import org.gradle.internal.typeconversion.NotationParser; //导入依赖的package包/类
public NotationParser<Object, MavenArtifact> create() {
FileNotationParser fileNotationParser = new FileNotationParser(fileResolver);
ArchiveTaskNotationParser archiveTaskNotationParser = new ArchiveTaskNotationParser();
PublishArtifactNotationParser publishArtifactNotationParser = new PublishArtifactNotationParser();
NotationParser<Object, MavenArtifact> sourceNotationParser = new NotationParserBuilder<MavenArtifact>()
.resultingType(MavenArtifact.class)
.parser(archiveTaskNotationParser)
.parser(publishArtifactNotationParser)
.parser(fileNotationParser)
.toComposite();
MavenArtifactMapNotationParser mavenArtifactMapNotationParser = new MavenArtifactMapNotationParser(sourceNotationParser);
NotationParserBuilder<MavenArtifact> parserBuilder = new NotationParserBuilder<MavenArtifact>()
.resultingType(MavenArtifact.class)
.parser(archiveTaskNotationParser)
.parser(publishArtifactNotationParser)
.parser(mavenArtifactMapNotationParser)
.parser(fileNotationParser);
return parserBuilder.toComposite();
}
示例4: create
import org.gradle.internal.typeconversion.NotationParser; //导入依赖的package包/类
public NotationParser<Object, IvyArtifact> create() {
FileNotationParser fileNotationParser = new FileNotationParser(fileResolver);
ArchiveTaskNotationParser archiveTaskNotationParser = new ArchiveTaskNotationParser();
PublishArtifactNotationParser publishArtifactNotationParser = new PublishArtifactNotationParser();
NotationParser<Object, IvyArtifact> sourceNotationParser = new NotationParserBuilder<IvyArtifact>()
.resultingType(IvyArtifact.class)
.parser(archiveTaskNotationParser)
.parser(publishArtifactNotationParser)
.parser(fileNotationParser)
.toComposite();
IvyArtifactMapNotationParser ivyArtifactMapNotationParser = new IvyArtifactMapNotationParser(sourceNotationParser);
NotationParserBuilder<IvyArtifact> parserBuilder = new NotationParserBuilder<IvyArtifact>()
.resultingType(IvyArtifact.class)
.parser(archiveTaskNotationParser)
.parser(publishArtifactNotationParser)
.parser(ivyArtifactMapNotationParser)
.parser(fileNotationParser);
return parserBuilder.toComposite();
}
示例5: DefaultMavenPublication
import org.gradle.internal.typeconversion.NotationParser; //导入依赖的package包/类
public DefaultMavenPublication(
String name, MavenProjectIdentity projectIdentity, NotationParser<Object, MavenArtifact> mavenArtifactParser, Instantiator instantiator,
ProjectDependencyPublicationResolver projectDependencyResolver, FileCollectionFactory fileCollectionFactory
) {
this.name = name;
this.projectDependencyResolver = projectDependencyResolver;
this.projectIdentity = new DefaultMavenProjectIdentity(projectIdentity.getGroupId(), projectIdentity.getArtifactId(), projectIdentity.getVersion());
mavenArtifacts = instantiator.newInstance(DefaultMavenArtifactSet.class, name, mavenArtifactParser, fileCollectionFactory);
pom = instantiator.newInstance(DefaultMavenPom.class, this);
}
示例6: create
import org.gradle.internal.typeconversion.NotationParser; //导入依赖的package包/类
public MavenPublication create(final String name) {
Module module = dependencyMetaDataProvider.getModule();
MavenProjectIdentity projectIdentity = new DefaultMavenProjectIdentity(module.getGroup(), module.getName(), module.getVersion());
NotationParser<Object, MavenArtifact> artifactNotationParser = new MavenArtifactNotationParserFactory(instantiator, fileResolver).create();
return instantiator.newInstance(
DefaultMavenPublication.class,
name, projectIdentity, artifactNotationParser, instantiator, projectDependencyResolver, fileCollectionFactory
);
}
示例7: forResolutionStrategy
import org.gradle.internal.typeconversion.NotationParser; //导入依赖的package包/类
public static DefaultDependencySubstitutions forResolutionStrategy(ComponentIdentifierFactory componentIdentifierFactory) {
NotationParser<Object, ComponentSelector> projectSelectorNotationParser = NotationParserBuilder
.toType(ComponentSelector.class)
.fromCharSequence(new ProjectPathConverter(componentIdentifierFactory))
.toComposite();
return new DefaultDependencySubstitutions(VersionSelectionReasons.SELECTED_BY_RULE, projectSelectorNotationParser);
}
示例8: forIncludedBuild
import org.gradle.internal.typeconversion.NotationParser; //导入依赖的package包/类
public static DefaultDependencySubstitutions forIncludedBuild(IncludedBuild build) {
NotationParser<Object, ComponentSelector> projectSelectorNotationParser = NotationParserBuilder
.toType(ComponentSelector.class)
.fromCharSequence(new CompositeProjectPathConverter(build))
.toComposite();
return new DefaultDependencySubstitutions(VersionSelectionReasons.COMPOSITE_BUILD, projectSelectorNotationParser);
}
示例9: DefaultDependencySubstitutions
import org.gradle.internal.typeconversion.NotationParser; //导入依赖的package包/类
private DefaultDependencySubstitutions(ComponentSelectionReason reason,
Set<Action<? super DependencySubstitution>> substitutionRules,
NotationParser<Object, ComponentSelector> moduleSelectorNotationParser,
NotationParser<Object, ComponentSelector> projectSelectorNotationParser) {
this.reason = reason;
this.substitutionRules = substitutionRules;
this.moduleSelectorNotationParser = moduleSelectorNotationParser;
this.projectSelectorNotationParser = projectSelectorNotationParser;
}
示例10: create
import org.gradle.internal.typeconversion.NotationParser; //导入依赖的package包/类
public NotationParser<Object, ConfigurablePublishArtifact> create() {
FileNotationConverter fileConverter = new FileNotationConverter();
return NotationParserBuilder
.toType(ConfigurablePublishArtifact.class)
.converter(new DecoratingConverter())
.converter(new ArchiveTaskNotationConverter())
.converter(new FileMapNotationConverter(fileConverter))
.converter(fileConverter)
.toComposite();
}
示例11: DefaultConfigurationPublications
import org.gradle.internal.typeconversion.NotationParser; //导入依赖的package包/类
public DefaultConfigurationPublications(PublishArtifactSet artifacts, final AttributeContainerInternal parentAttributes, final Instantiator instantiator, final NotationParser<Object, ConfigurablePublishArtifact> artifactNotationParser, final FileCollectionFactory fileCollectionFactory) {
this.artifacts = artifacts;
this.parentAttributes = parentAttributes;
this.instantiator = instantiator;
this.artifactNotationParser = artifactNotationParser;
this.fileCollectionFactory = fileCollectionFactory;
}
示例12: DefaultDependencyFactory
import org.gradle.internal.typeconversion.NotationParser; //导入依赖的package包/类
public DefaultDependencyFactory(NotationParser<Object, Dependency> dependencyNotationParser,
NotationParser<Object, ClientModule> clientModuleNotationParser,
ProjectDependencyFactory projectDependencyFactory) {
this.dependencyNotationParser = dependencyNotationParser;
this.clientModuleNotationParser = clientModuleNotationParser;
this.projectDependencyFactory = projectDependencyFactory;
}
示例13: create
import org.gradle.internal.typeconversion.NotationParser; //导入依赖的package包/类
public NotationParser<Object, ClientModule> create() {
return NotationParserBuilder.toType(ClientModule.class)
.fromCharSequence(new DependencyStringNotationConverter<DefaultClientModule>(instantiator, DefaultClientModule.class))
.converter(new DependencyMapNotationConverter<DefaultClientModule>(instantiator, DefaultClientModule.class))
.toComposite();
}
示例14: parser
import org.gradle.internal.typeconversion.NotationParser; //导入依赖的package包/类
public static NotationParser<Object, Dependency> parser(Instantiator instantiator, DefaultProjectDependencyFactory dependencyFactory, ClassPathRegistry classPathRegistry, FileLookup fileLookup, RuntimeShadedJarFactory runtimeShadedJarFactory, CurrentGradleInstallation currentGradleInstallation) {
return NotationParserBuilder
.toType(Dependency.class)
.fromCharSequence(new DependencyStringNotationConverter<DefaultExternalModuleDependency>(instantiator, DefaultExternalModuleDependency.class))
.converter(new DependencyMapNotationConverter<DefaultExternalModuleDependency>(instantiator, DefaultExternalModuleDependency.class))
.fromType(FileCollection.class, new DependencyFilesNotationConverter(instantiator))
.fromType(Project.class, new DependencyProjectNotationConverter(dependencyFactory))
.fromType(DependencyFactory.ClassPathNotation.class, new DependencyClassPathNotationConverter(instantiator, classPathRegistry, fileLookup.getFileResolver(), runtimeShadedJarFactory, currentGradleInstallation))
.invalidNotationMessage("Comprehensive documentation on dependency notations is available in DSL reference for DependencyHandler type.")
.toComposite();
}
示例15: DefaultIvyPublication
import org.gradle.internal.typeconversion.NotationParser; //导入依赖的package包/类
public DefaultIvyPublication(
String name, Instantiator instantiator, IvyPublicationIdentity publicationIdentity, NotationParser<Object, IvyArtifact> ivyArtifactNotationParser,
ProjectDependencyPublicationResolver projectDependencyResolver, FileCollectionFactory fileCollectionFactory
) {
this.name = name;
this.publicationIdentity = publicationIdentity;
this.projectDependencyResolver = projectDependencyResolver;
configurations = instantiator.newInstance(DefaultIvyConfigurationContainer.class, instantiator);
ivyArtifacts = instantiator.newInstance(DefaultIvyArtifactSet.class, name, ivyArtifactNotationParser, fileCollectionFactory);
ivyDependencies = instantiator.newInstance(DefaultIvyDependencySet.class);
descriptor = instantiator.newInstance(DefaultIvyModuleDescriptorSpec.class, this);
}