Java Code Examples for org.gradle.api.artifacts.component.ComponentIdentifier#getClass()
The following examples show how to use
org.gradle.api.artifacts.component.ComponentIdentifier#getClass() .
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: ComponentIdentifierSerializer.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public void write(Encoder encoder, ComponentIdentifier value) throws IOException { if(value == null) { throw new IllegalArgumentException("Provided component identifier may not be null"); } if(value instanceof DefaultModuleComponentIdentifier) { ModuleComponentIdentifier moduleComponentIdentifier = (ModuleComponentIdentifier)value; encoder.writeByte(Implementation.MODULE.getId()); encoder.writeString(moduleComponentIdentifier.getGroup()); encoder.writeString(moduleComponentIdentifier.getModule()); encoder.writeString(moduleComponentIdentifier.getVersion()); } else if(value instanceof DefaultProjectComponentIdentifier) { ProjectComponentIdentifier projectComponentIdentifier = (ProjectComponentIdentifier)value; encoder.writeByte(Implementation.BUILD.getId()); encoder.writeString(projectComponentIdentifier.getProjectPath()); } else { throw new IllegalArgumentException("Unsupported component identifier class: " + value.getClass()); } }
Example 2
Source File: ComponentIdentifierSerializer.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public void write(Encoder encoder, ComponentIdentifier value) throws IOException { if(value == null) { throw new IllegalArgumentException("Provided component identifier may not be null"); } if(value instanceof DefaultModuleComponentIdentifier) { ModuleComponentIdentifier moduleComponentIdentifier = (ModuleComponentIdentifier)value; encoder.writeByte(Implementation.MODULE.getId()); encoder.writeString(moduleComponentIdentifier.getGroup()); encoder.writeString(moduleComponentIdentifier.getModule()); encoder.writeString(moduleComponentIdentifier.getVersion()); } else if(value instanceof DefaultProjectComponentIdentifier) { ProjectComponentIdentifier projectComponentIdentifier = (ProjectComponentIdentifier)value; encoder.writeByte(Implementation.BUILD.getId()); encoder.writeString(projectComponentIdentifier.getProjectPath()); } else { throw new IllegalArgumentException("Unsupported component identifier class: " + value.getClass()); } }
Example 3
Source File: AtlasDependencyGraph.java From atlas with Apache License 2.0 | 6 votes |
@NonNull public static String computeAddress(@NonNull AtlasDependencyGraph.HashableResolvedArtifactResult artifact) { ComponentIdentifier id = artifact.getId().getComponentIdentifier(); if (id instanceof ProjectComponentIdentifier) { String variant = getVariant(artifact); if (variant == null) { return ((ProjectComponentIdentifier) id).getProjectPath().intern(); } else { return (((ProjectComponentIdentifier) id).getProjectPath() + "::" + variant) .intern(); } } else if (id instanceof ModuleComponentIdentifier || id instanceof OpaqueComponentArtifactIdentifier) { MavenCoordinates coordinates = sMavenCoordinatesCache.get(artifact); Optional.of(coordinates); return coordinates.toString().intern(); } else { throw new RuntimeException( "Don't know how to handle ComponentIdentifier '" + id.getDisplayName() + "'of type " + id.getClass()); } }
Example 4
Source File: ComponentIdentifierSerializer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public void write(Encoder encoder, ComponentIdentifier value) throws IOException { if(value == null) { throw new IllegalArgumentException("Provided component identifier may not be null"); } if(value instanceof DefaultModuleComponentIdentifier) { ModuleComponentIdentifier moduleComponentIdentifier = (ModuleComponentIdentifier)value; encoder.writeByte(Implementation.MODULE.getId()); encoder.writeString(moduleComponentIdentifier.getGroup()); encoder.writeString(moduleComponentIdentifier.getModule()); encoder.writeString(moduleComponentIdentifier.getVersion()); } else if(value instanceof DefaultProjectComponentIdentifier) { ProjectComponentIdentifier projectComponentIdentifier = (ProjectComponentIdentifier)value; encoder.writeByte(Implementation.BUILD.getId()); encoder.writeString(projectComponentIdentifier.getProjectPath()); } else { throw new IllegalArgumentException("Unsupported component identifier class: " + value.getClass()); } }
Example 5
Source File: ComponentIdentifierSerializer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public void write(Encoder encoder, ComponentIdentifier value) throws IOException { if(value == null) { throw new IllegalArgumentException("Provided component identifier may not be null"); } if(value instanceof DefaultModuleComponentIdentifier) { ModuleComponentIdentifier moduleComponentIdentifier = (ModuleComponentIdentifier)value; encoder.writeByte(Implementation.MODULE.getId()); encoder.writeString(moduleComponentIdentifier.getGroup()); encoder.writeString(moduleComponentIdentifier.getModule()); encoder.writeString(moduleComponentIdentifier.getVersion()); } else if(value instanceof DefaultProjectComponentIdentifier) { ProjectComponentIdentifier projectComponentIdentifier = (ProjectComponentIdentifier)value; encoder.writeByte(Implementation.BUILD.getId()); encoder.writeString(projectComponentIdentifier.getProjectPath()); } else { throw new IllegalArgumentException("Unsupported component identifier class: " + value.getClass()); } }