Java Code Examples for org.immutables.value.Value#Derived

The following examples show how to use org.immutables.value.Value#Derived . 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: CellImpl.java    From buck with Apache License 2.0 6 votes vote down vote up
@Override
@Value.Auxiliary
@Value.Derived
public ProjectFilesystemView getFilesystemViewForSourceFiles() {
  ProjectFilesystem filesystem = getFilesystem();
  ImmutableSet.Builder<PathMatcher> ignores =
      ImmutableSet.builderWithExpectedSize(filesystem.getBlacklistedPaths().size() + 1);
  ignores.addAll(filesystem.getBlacklistedPaths());
  ignores.add(RecursiveFileMatcher.of(RelPath.of(filesystem.getBuckPaths().getBuckOut())));
  for (AbsPath subCellRoots : getKnownRootsOfAllCells()) {
    if (!subCellRoots.equals(getRoot())) {
      ignores.add(
          RecursiveFileMatcher.of(RelPath.of(filesystem.relativize(subCellRoots).getPath())));
    }
  }
  return filesystem.asView().withView(filesystem.getPath(""), ignores.build());
}
 
Example 2
Source File: Proto.java    From immutables with Apache License 2.0 5 votes vote down vote up
@Value.Derived
StyleInfo defaultStyles() {
  @Nullable TypeElement element = findElement(StyleMirror.qualifiedName());
  if (element == null) {
    processing().getMessager()
        .printMessage(Diagnostic.Kind.MANDATORY_WARNING,
            "Could not found annotations on the compile classpath. It looks like annotation processor is running"
                + " in a separate annotation-processing classpath and unable to get to annotation definitions."
                + " To fix this, please add annotation-only artifact 'org.immutables:value:(version):annotations'"
                + " to 'compile' 'compileOnly' or 'provided' dependency scope.");

    element = findElement(StyleMirror.mirrorQualifiedName());
    verify(element != null, "Classpath should contain at least mirror annotation, otherwise library is corrupted");
  }
  try {
    return ToStyleInfo.FUNCTION.apply(StyleMirror.from(element));
  } catch (Exception ex) {
    processing().getMessager()
        .printMessage(Diagnostic.Kind.MANDATORY_WARNING,
            "The version of the Immutables annotation on the classpath has incompatible differences"
                + " from the Immutables annotation processor used. Various problems might occur,"
                + " like this one: "
                + ex);

    element = findElement(StyleMirror.mirrorQualifiedName());
    verify(element != null,
        "classpath should contain at least the mirror annotation, otherwise library is corrupted");
    return ToStyleInfo.FUNCTION.apply(StyleMirror.from(element));
  }
}
 
Example 3
Source File: TreatmentData.java    From hmftools with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
@Value.Derived
default String treatmentName() {
    List<CuratedDrug> drugs = sortedDrugs();

    String concatenatedTreatmentName = drugs.stream().map(CuratedDrug::name).collect(Collectors.joining(SEPARATOR));
    return Strings.emptyToNull(concatenatedTreatmentName);
}
 
Example 4
Source File: ErrorLogRecord.java    From buck with Apache License 2.0 5 votes vote down vote up
@Value.Derived
public Optional<Boolean> getIsDaemon() {
  String buildUuid = MAPPER.threadIdToCommandId(getRecord().getThreadID());
  if (buildUuid == null) {
    return Optional.empty();
  }
  return Optional.ofNullable(IS_DAEMON_MAPPER.commandIdToIsRunningAsDaemon(buildUuid));
}
 
Example 5
Source File: ErrorLogRecord.java    From buck with Apache License 2.0 5 votes vote down vote up
@Value.Derived
public Optional<Boolean> getIsRemoteExecution() {
  String buildUuid = MAPPER.threadIdToCommandId(getRecord().getThreadID());
  if (buildUuid == null) {
    return Optional.empty();
  }
  return Optional.ofNullable(
      IS_REMOTE_EXECUTION_MAPPER.commandIdToIsRunningAsRemoteExecution(buildUuid));
}
 
Example 6
Source File: TreatmentData.java    From hmftools with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
@Value.Derived
default String concatenatedMechanism() {
    List<CuratedDrug> drugs = sortedDrugs();

    String value = drugs.stream().map(CuratedDrug::mechanism).collect(Collectors.joining(SEPARATOR));
    return Strings.emptyToNull(value);
}
 
Example 7
Source File: SampleReport.java    From hmftools with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
@Value.Derived
public String earliestArrivalDate() {
    LocalDate refDate = refArrivalDate();
    LocalDate sampleDate = tumorArrivalDate();

    if (sampleDate == null) {
        return null;
    } else if (refDate == null || sampleDate.isBefore(refDate)) {
        return DataUtil.formatDate(sampleDate);
    } else {
        return DataUtil.formatDate(refDate);
    }
}
 
Example 8
Source File: AndroidGraphEnhancementResult.java    From buck with Apache License 2.0 4 votes vote down vote up
@Value.Derived
default ImmutableList<SourcePath> getAdditionalRedexInputs() {
  return getNonPreDexedDex()
      .map(NonPreDexedDexBuildable::getAdditionalRedexInputs)
      .orElse(ImmutableList.of());
}
 
Example 9
Source File: CentralStorageConfig.java    From glowroot with Apache License 2.0 4 votes vote down vote up
@Value.Derived
@JsonIgnore
public int getMaxRollupTTL() {
    return Ints.saturatedCast(HOURS.toSeconds(getMaxRollupHours()));
}
 
Example 10
Source File: BuckRunSpec.java    From buck with Apache License 2.0 4 votes vote down vote up
/** The path to the binary to invoke */
@JsonProperty
@Value.Derived
public Path getPath() {
  return Paths.get(getArgv().get(0));
}
 
Example 11
Source File: DefaultClassInfoTest.java    From buck with Apache License 2.0 4 votes vote down vote up
@AddToRuleKey
@Value.Derived
default SourcePath getLazyPath() {
  return getPath();
}
 
Example 12
Source File: ConversationsMultiSelectMenuIF.java    From slack-client with Apache License 2.0 4 votes vote down vote up
@Override
@Value.Derived
default String getType() {
  return TYPE;
}
 
Example 13
Source File: PagerDutyConfig.java    From glowroot with Apache License 2.0 4 votes vote down vote up
@Value.Derived
@JsonIgnore
public String version() {
    return Versions.getJsonVersion(this);
}
 
Example 14
Source File: ExternalSelectMenuIF.java    From slack-client with Apache License 2.0 4 votes vote down vote up
@Override
@Value.Derived
default String getType() {
  return TYPE;
}
 
Example 15
Source File: _Response.java    From tac-kbp-eal with MIT License 4 votes vote down vote up
/**
 * Returns a unique ID for this response used for the 2016.
 */
@Value.Derived
public String uniqueIdentifier() {
  return computeSHA1Hash().toString();
}
 
Example 16
Source File: UserSelectMenuIF.java    From slack-client with Apache License 2.0 4 votes vote down vote up
@Override
@Value.Derived
default String getType() {
  return TYPE;
}
 
Example 17
Source File: ExternallyBuiltApplePackage.java    From buck with Apache License 2.0 4 votes vote down vote up
/** Returns the Apple SDK path. */
@Value.Derived
public Path getSdkPath() {
  return getPlatform().getAppleSdkPaths().getSdkPath();
}
 
Example 18
Source File: ContextIF.java    From slack-client with Apache License 2.0 4 votes vote down vote up
@Override
@Value.Derived
default String getType() {
  return TYPE;
}
 
Example 19
Source File: _Response.java    From tac-kbp-eal with MIT License 2 votes vote down vote up
/**
 * Returns a 'unique-ish' ID for this response used for the 2014 evaluation. In the Java
 * implementation, the response's {@code hashCode} is always returned.  Note that if you read
 * input files from another source into {@code Response} objects, the original IDs will be lost.
 */
@Value.Derived
public int old2014ResponseID() {
  return hashCode();
}
 
Example 20
Source File: ExternallyBuiltApplePackage.java    From buck with Apache License 2.0 2 votes vote down vote up
/**
 * The sdk version of the platform.
 *
 * <p>This is used as a proxy for the version of the external packager.
 */
@Value.Derived
public String getSdkVersion() {
  return getPlatform().getAppleSdk().getVersion();
}