當前位置: 首頁>>代碼示例>>Java>>正文


Java Value類代碼示例

本文整理匯總了Java中org.immutables.value.Value的典型用法代碼示例。如果您正苦於以下問題:Java Value類的具體用法?Java Value怎麽用?Java Value使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Value類屬於org.immutables.value包,在下文中一共展示了Value類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: namedParentPackage

import org.immutables.value.Value; //導入依賴的package包/類
@Value.Lazy
Optional<DeclaringPackage> namedParentPackage() {
  String parentPackageName = SourceNames.parentPackageName(element());
  if (!parentPackageName.isEmpty()) {
    @Nullable PackageElement parentPackage =
        environment().processing()
            .getElementUtils()
            .getPackageElement(parentPackageName);

    if (parentPackage != null) {
      return Optional.of(interner().forPackage(
          ImmutableProto.DeclaringPackage.builder()
              .environment(environment())
              .interner(interner())
              .element(parentPackage)
              .build()));
    }
  }
  return Optional.absent();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:Proto.java

示例2: isJacksonSerialized

import org.immutables.value.Value; //導入依賴的package包/類
@Value.Lazy
public boolean isJacksonSerialized() {
  if (!styles().style().jacksonIntegration()) {
    return false;
  }
  if (declaringType().isPresent()) {
    DeclaringType t = declaringType().get();
    if (t.isJacksonSerialized()) {
      return true;
    }
    if (t.enclosingTopLevel().isPresent()) {
      if (t.enclosingTopLevel().get().isJacksonSerialized()) {
        return true;
      }
    }
  }
  return packageOf().isJacksonSerialized();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:Proto.java

示例3: typeWith

import org.immutables.value.Value; //導入依賴的package包/類
@Value.Lazy
public NameForms typeWith() {
  String simple, relative;

  if (protoclass().kind().isNested()) {
    String enclosingSimpleName = typeImmutableEnclosingSimpleName();
    simple = names().typeWith();
    relative = inPackage(enclosingSimpleName, simple);
  } else if (hasImmutableInBuilder()) {
    simple = names().typeWith();
    relative = inPackage(typeBuilderSimpleName(), simple);
  } else {
    simple = names().typeWith();
    relative = inPackage(simple);
  }

  return ImmutableConstitution.NameForms.builder()
      .simple(simple)
      .relativeRaw(relative)
      .genericArgs(generics().args())
      .packageOf(implementationPackage())
      .visibility(implementationVisibility())
      .build();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:25,代碼來源:Constitution.java

示例4: check

import org.immutables.value.Value; //導入依賴的package包/類
@Value.Check
protected void check() {
  checkArgument(!docID().asString().isEmpty(), "Doc ID may not be empty");
  checkArgument(!docID().asString().contains("\t"), "Doc ID may not contain a tab");
  checkArgument(!hopperID().asString().isEmpty(), "Hopper ID may not be empty");
  checkArgument(!hopperID().asString().contains("\t"), "Hopper ID may not contain a tab");
  checkArgument(!role().asString().isEmpty(), "Role may not be empty");
  checkArgument(!role().asString().contains("\t"), "Role may not contain a tab");
  checkArgument(!entity().asString().isEmpty(), "Entity may not be empty");
  checkArgument(!entity().asString().contains("\t"), "Entity may not contain a tab");
}
 
開發者ID:isi-nlp,項目名稱:tac-kbp-eal,代碼行數:12,代碼來源:_CorpusQueryEntryPoint.java

示例5: check

import org.immutables.value.Value; //導入依賴的package包/類
@Value.Check
protected void check() {
    Preconditions.checkState(isNull(keystorePath()) == isNull(keystorePassword()),
            "Keystore path (%s) and password (%s) for '%s' should be either both specified or none at all",
            keystorePath(),
            keystorePassword(),
            id()
    );
}
 
開發者ID:salesforce,項目名稱:pyplyn,代碼行數:10,代碼來源:EndpointConnector.java

示例6: isJacksonJsonTypeInfo

import org.immutables.value.Value; //導入依賴的package包/類
@Value.Lazy
public boolean isJacksonJsonTypeInfo() {
  if (isJacksonJsonTypeInfoAnnotated(element())) {
    // while DeclaringPackage cannot have those annotations
    // directly, just checking them as a general computation path
    // will not hurt much.
    return true;
  }
  for (MetaAnnotated metaAnnotated : metaAnnotated()) {
    if (metaAnnotated.isJacksonJsonTypeInfo()) {
      return true;
    }
  }
  return false;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:16,代碼來源:Proto.java

示例7: check

import org.immutables.value.Value; //導入依賴的package包/類
@Value.Check
protected void check() {
  checkArgument(!docID().asString().isEmpty(), "Document ID may not be empty for a response");
  checkArgument(!type().asString().isEmpty(), "Event type may not be empty for a response");
  checkArgument(!role().asString().isEmpty(), "Argument role may not be empty for a response");
  checkPredicateJustificationsContainsBaseFiller();
  checkArgument(!predicateJustifications().isEmpty(), "Predicate justifications may not be empty");
}
 
開發者ID:isi-nlp,項目名稱:tac-kbp-eal,代碼行數:9,代碼來源:_Response.java

示例8: typeModifiable

import org.immutables.value.Value; //導入依賴的package包/類
@Value.Lazy
public NameForms typeModifiable() {
  checkState(protoclass().kind().isModifiable());
  String simple = names().typeModifiable();
  return ImmutableConstitution.NameForms.builder()
      .simple(simple)
      .relativeRaw(inPackage(simple))
      .genericArgs(generics().args())
      .packageOf(implementationPackage())
      .visibility(implementationVisibility())
      .build();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:Constitution.java

示例9: validate

import org.immutables.value.Value; //導入依賴的package包/類
/**
 * Some validations, not exhaustive.
 */
@Value.Check
protected void validate() {
  if (include().isPresent() && !isTopLevel()) {
    report()
        .annotationNamed(IncludeMirror.simpleName())
        .error("@%s could not be used on nested types.", IncludeMirror.simpleName());
  }
  if (builderInclude().isPresent() && !isTopLevel()) {
    report()
        .annotationNamed(FIncludeMirror.simpleName())
        .error("@%s could not be used on nested types.", FIncludeMirror.simpleName());
  }
  if (isEnclosing() && !isTopLevel()) {
    report()
        .annotationNamed(EnclosingMirror.simpleName())
        .error("@%s should only be used on a top-level types.", EnclosingMirror.simpleName());
  }
  if (isImmutable() && element().getKind() == ElementKind.ENUM) {
    report()
        .annotationNamed(ImmutableMirror.simpleName())
        .error("@%s is not supported on enums", ImmutableMirror.simpleName());
  }
  if (isModifiable() && (isEnclosed() || isEnclosing())) {
    report()
        .annotationNamed(ModifiableMirror.simpleName())
        .error("@%s could not be used with or within @%s",
            ModifiableMirror.simpleName(),
            EnclosingMirror.simpleName());
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:34,代碼來源:Proto.java

示例10: defaultStyles

import org.immutables.value.Value; //導入依賴的package包/類
@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));
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:31,代碼來源:Proto.java

示例11: sourceImports

import org.immutables.value.Value; //導入依賴的package包/類
@Value.Lazy
public SourceExtraction.Imports sourceImports() {
  if (!isTopLevel()) {
    return associatedTopLevel().sourceImports();
  }
  return SourceExtraction.importsFrom(sourceCode());
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:Proto.java

示例12: getPath

import org.immutables.value.Value; //導入依賴的package包/類
/**
 * geth path.
 * @return String
 */
@Value.Default
@SerializedName("path")
public String getPath() {
    return "\\\\.\\pipe\\geth.ipc";
}
 
開發者ID:enjin,項目名稱:Enjin-Coin-Java-SDK,代碼行數:10,代碼來源:Ethereum.java

示例13: defaultAsDefault

import org.immutables.value.Value; //導入依賴的package包/類
@Value.Parameter
@Override
public abstract boolean defaultAsDefault();
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:4,代碼來源:StyleInfo.java

示例14: type

import org.immutables.value.Value; //導入依賴的package包/類
@Nullable
@Value.Auxiliary
public abstract ThresholdType type();
 
開發者ID:salesforce,項目名稱:pyplyn,代碼行數:4,代碼來源:PollingTransform.java

示例15: lenient

import org.immutables.value.Value; //導入依賴的package包/類
/**
 * if {@code true} - enables non strict parsing and serialization.
 * @return true, if successful
 */
@Value.Default
public boolean lenient() {
  return false;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:GsonMessageBodyProvider.java


注:本文中的org.immutables.value.Value類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。