org.gradle.internal.component.local.model.DefaultProjectComponentIdentifier Java Examples

The following examples show how to use org.gradle.internal.component.local.model.DefaultProjectComponentIdentifier. 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 vote down vote up
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 Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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: ComponentIdentifierSerializer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ComponentIdentifier read(Decoder decoder) throws IOException {
    byte id = decoder.readByte();

    if(Implementation.BUILD.getId() == id) {
        return new DefaultProjectComponentIdentifier(decoder.readString());
    } else if(Implementation.MODULE.getId() == id) {
        return new DefaultModuleComponentIdentifier(decoder.readString(), decoder.readString(), decoder.readString());
    }

    throw new IllegalArgumentException("Unable to find component identifier with id: " + id);
}
 
Example #4
Source File: DefaultComponentIdentifierFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ComponentIdentifier createComponentIdentifier(ModuleInternal module) {
    String projectPath = module.getProjectPath();

    if(projectPath != null) {
        return new DefaultProjectComponentIdentifier(projectPath);
    }

    return new DefaultModuleComponentIdentifier(module.getGroup(), module.getName(), module.getVersion());
}
 
Example #5
Source File: ComponentIdentifierSerializer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ComponentIdentifier read(Decoder decoder) throws IOException {
    byte id = decoder.readByte();

    if(Implementation.BUILD.getId() == id) {
        return new DefaultProjectComponentIdentifier(decoder.readString());
    } else if(Implementation.MODULE.getId() == id) {
        return new DefaultModuleComponentIdentifier(decoder.readString(), decoder.readString(), decoder.readString());
    }

    throw new IllegalArgumentException("Unable to find component identifier with id: " + id);
}
 
Example #6
Source File: DefaultComponentIdentifierFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ComponentIdentifier createComponentIdentifier(ModuleInternal module) {
    String projectPath = module.getProjectPath();

    if(projectPath != null) {
        return new DefaultProjectComponentIdentifier(projectPath);
    }

    return new DefaultModuleComponentIdentifier(module.getGroup(), module.getName(), module.getVersion());
}