Tabnine Logo
ThriftFieldMetadata.getConstructorInjection
Code IndexAdd Tabnine to your IDE (free)

How to use
getConstructorInjection
method
in
com.facebook.swift.codec.metadata.ThriftFieldMetadata

Best Java code snippets using com.facebook.swift.codec.metadata.ThriftFieldMetadata.getConstructorInjection (Showing top 5 results out of 315)

origin: com.facebook.swift/swift-codec

fieldMetadata = metadataMap.get(data.getKey());
if (fieldMetadata != null && fieldMetadata.getConstructorInjection().isPresent()) {
    ThriftConstructorInjection constructor = fieldMetadata.getConstructorInjection().get();
origin: com.gitee.l0km/common-thrift

public DecoratorThriftFieldMetadata(ThriftFieldMetadata input){
  super(
      input.getId(),
      input.getRequiredness(),
      input.getThriftType(),
      input.getName(),
      input.getType(),
      input.getInjections(),
      input.getConstructorInjection(),
      input.getMethodInjection(),
      input.getExtraction(),
      input.getCoercion());
  // 获取field的类型
  List<ThriftInjection> injections = getInjections();
  checkState(injections.size()>0,"invalid size of injections");
  ThriftInjection injection = injections.get(0);		
  if(injection instanceof ThriftParameterInjection){
    javaType = ((ThriftParameterInjection)injection).getJavaType();
  }else if(injection instanceof ThriftFieldInjection){
    javaType = ((ThriftFieldInjection)injection).getField().getType();
  }else{
    javaType = null;
    // 对于不支持的数据类型无法获取field类型,输出警告
    logger.warning(
        String.format("UNSUPPORED TYPE %s,can't get Java Type. "
            + "(不识别的ThriftInjection实例类型,无法实现requiredness转义)",
        null == injection? null : injection.getClass().getName()));
  }
}
/** 重载方法,实现 requiredness 转义 */
origin: com.gitee.l0km/common-thrifty

DecoratorThriftFieldMetadata(ThriftFieldMetadata input){
  super(
      input.getId(),
      input.getRequiredness(),
      input.getThriftType(),
      input.getName(),
      input.getType(),
      input.getInjections(),
      input.getConstructorInjection(),
      input.getMethodInjection(),
      input.getExtraction(),
      input.getCoercion());
  // 获取field的类型
  List<ThriftInjection> injections = getInjections();
  checkState(injections.size()>0,"invalid size of injections");
  ThriftInjection injection = injections.get(0);		
  if(injection instanceof ThriftParameterInjection){
    javaType = ((ThriftParameterInjection)injection).getJavaType();
  }else if(injection instanceof ThriftFieldInjection){
    javaType = ((ThriftFieldInjection)injection).getField().getType();
  }else{
    javaType = null;
    // 对于不支持的数据类型无法获取field类型,输出警告
    logger.warning(
        String.format("UNSUPPORED TYPE %s,can't get Java Type. "
            + "(不识别的ThriftInjection实例类型,无法实现requiredness转义)",
        null == injection? null : injection.getClass().getName()));
  }
}
/** 重载方法,实现 requiredness 转义 */
origin: com.facebook.swift/swift-codec

private ThriftStructMetadata testMetadataBuild(Class<?> structClass, int expectedConstructorParameters, int expectedMethodInjections)
{
  ThriftCatalog catalog = new ThriftCatalog();
  ThriftUnionMetadataBuilder builder = new ThriftUnionMetadataBuilder(catalog, structClass);
  assertNotNull(builder);
  assertNotNull(builder.getMetadataErrors());
  builder.getMetadataErrors().throwIfHasErrors();
  assertEquals(builder.getMetadataErrors().getWarnings().size(), 0);
  ThriftStructMetadata metadata = builder.build();
  assertNotNull(metadata);
  assertEquals(MetadataType.UNION, metadata.getMetadataType());
  verifyField(metadata, 1, "stringValue");
  verifyField(metadata, 2, "longValue");
  verifyField(metadata, 3, "fruitValue");
  if (expectedConstructorParameters == 0) {
    assertTrue(metadata.getConstructorInjection().isPresent());
    ThriftConstructorInjection constructorInjection = metadata.getConstructorInjection().get();
    assertEquals(constructorInjection.getParameters().size(), 0);
  }
  else {
    for (ThriftFieldMetadata fieldMetadata : metadata.getFields(FieldKind.THRIFT_FIELD)) {
      assertTrue(fieldMetadata.getConstructorInjection().isPresent());
      assertEquals(fieldMetadata.getConstructorInjection().get().getParameters().size(), expectedConstructorParameters);
    }
  }
  assertEquals(metadata.getMethodInjections().size(), expectedMethodInjections);
  return metadata;
}
origin: com.facebook.swift/swift-codec

if (field.getConstructorInjection().isPresent()) {
  cases.add(caseStatement(field.getId(), field.getName() + "-id-field"));
if (field.getConstructorInjection().isPresent()) {
  read.invokeConstructor(field.getConstructorInjection().get().getConstructor())
      .storeVariable(instance)
      .gotoLabel("instance-ok");
com.facebook.swift.codec.metadataThriftFieldMetadatagetConstructorInjection

Popular methods of ThriftFieldMetadata

  • getId
  • getName
  • getRequiredness
  • getThriftType
  • getExtraction
  • getInjections
  • getType
  • isWriteOnly
  • getCoercion
  • getMethodInjection
  • <init>
  • isReadOnly
  • <init>,
  • isReadOnly,
  • isTypePredicate,
  • getIdGetter,
  • getIdlAnnotations,
  • isRecursiveReference,
  • isTypeReferenceRecursive

Popular in Java

  • Reading from database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • getSharedPreferences (Context)
  • getSystemService (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now