code: public <T> ThriftStructMetadata getThriftStructMetadata(Type structType)
      {
          ThriftStructMetadata structMetadata = structs.get(structType);
          Class<?> structClass = TypeToken.of(structType).getRawType();
          if (structMetadata == null) {
              if (structClass.isAnnotationPresent(ThriftStruct.class)) {
                  structMetadata = extractThriftStructMetadata(structType);
              }
              else if (structClass.isAnnotationPresent(ThriftUnion.class)) {
                  structMetadata = extractThriftUnionMetadata(structType);
              }
              else {
                  throw new IllegalStateException("getThriftStructMetadata called on a class that has no @ThriftStruct or @ThriftUnion annotation");
              }
  
              ThriftStructMetadata current = structs.putIfAbsent(structType, structMetadata);
              if (current != null) {
                  structMetadata = current;
              }
          }
          return structMetadata;
      }
docs: Gets the ThriftStructMetadata for the specified struct class.  The struct class must be
  annotated with @ThriftStruct or @ThriftUnion.