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

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

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

origin: com.facebook.swift/swift-codec

@Override
public void write(T instance, TProtocol protocol)
    throws Exception
{
  TProtocolWriter writer = new TProtocolWriter(protocol);
  Short idValue = (Short) getFieldValue(instance, idField.getKey());
  writer.writeStructBegin(metadata.getStructName());
  if (metadataMap.containsKey(idValue)) {
    ThriftFieldMetadata fieldMetadata = metadataMap.get(idValue);
    if (fieldMetadata.isReadOnly() || fieldMetadata.getType() != THRIFT_FIELD) {
      throw new IllegalStateException(format("Field %s is not readable", fieldMetadata.getName()));
    }
    Object fieldValue = getFieldValue(instance, fieldMetadata);
    // write the field
    if (fieldValue != null) {
      @SuppressWarnings("unchecked")
      ThriftCodec<Object> codec = (ThriftCodec<Object>) fields.get(fieldMetadata.getId());
      writer.writeField(fieldMetadata.getName(), fieldMetadata.getId(), codec, fieldValue);
    }
  }
  writer.writeStructEnd();
}
origin: com.facebook.swift/swift-codec

  private <T> void verifyField(ThriftStructMetadata metadata, int id, String name)
  {
    ThriftFieldMetadata messageField = metadata.getField(id);
    assertNotNull(messageField, "field '" + name + "' is null");
    assertEquals(messageField.getId(), id);
    assertEquals(messageField.getName(), name);
    assertFalse(messageField.isReadOnly());
    assertFalse(messageField.isWriteOnly());

    assertTrue(messageField.getExtraction().isPresent());
    ThriftExtraction extraction = messageField.getExtraction().get();
    assertEquals(extraction.getId(), id);
    assertEquals(extraction.getName(), name);

    assertNotNull(messageField.getInjections());
    assertEquals(messageField.getInjections().size(), 1);
    ThriftInjection injection = messageField.getInjections().get(0);
    assertEquals(injection.getId(), id);
    assertEquals(injection.getName(), name);
  }
}
origin: com.facebook.swift/swift-codec

  private <T> void verifyField(ThriftStructMetadata metadata, int id, String name)
  {
    ThriftFieldMetadata metadataField = metadata.getField(id);
    assertNotNull(metadataField, "metadataField is null");
    assertEquals(metadataField.getId(), id);
    assertEquals(metadataField.getName(), name);
    assertFalse(metadataField.isReadOnly());
    assertFalse(metadataField.isWriteOnly());

    assertTrue(metadataField.getExtraction().isPresent());
    ThriftExtraction extraction = metadataField.getExtraction().get();
    assertEquals(extraction.getId(), id);
    assertEquals(extraction.getName(), name);

    assertNotNull(metadataField.getInjections());
    assertEquals(metadataField.getInjections().size(), 1);
    ThriftInjection injection = metadataField.getInjections().get(0);
    assertEquals(injection.getId(), id);
    assertEquals(injection.getName(), name);
  }
}
origin: com.facebook.swift/swift-codec

if (field.isReadOnly() || field.getType() != THRIFT_FIELD) {
  reader.skipFieldData();
  continue;
com.facebook.swift.codec.metadataThriftFieldMetadataisReadOnly

Popular methods of ThriftFieldMetadata

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

Popular in Java

  • Start an intent from android
  • getResourceAsStream (ClassLoader)
  • compareTo (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • JComboBox (javax.swing)
  • Github Copilot alternatives
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