Examples of ThriftType


Examples of com.facebook.swift.codec.metadata.ThriftType

    @Test
    public void testFieldsManual()
            throws Exception
    {
        ThriftCatalog catalog = new ThriftCatalog();
        ThriftType bonkFieldType = catalog.getThriftType(BonkField.class);
        BonkFieldThriftCodec bonkFieldCodec = new BonkFieldThriftCodec(bonkFieldType);

        BonkField bonkField = new BonkField("message", 42);
        testRoundTripSerialize(bonkFieldCodec, bonkField);
    }
View Full Code Here

Examples of com.facebook.swift.codec.metadata.ThriftType

    @Test
    public void testMatchByJavaNameWithThriftNameOverride()
        throws Exception
    {
        ThriftCatalog catalog = codecManager.getCatalog();
        ThriftType thriftType = catalog.getThriftType(BonkConstructorNameOverride.class);
        ThriftStructMetadata<?> structMetadata = thriftType.getStructMetadata();
        assertEquals(structMetadata.getField(1).getName(), "myMessage");
        assertEquals(structMetadata.getField(2).getName(), "myType");

        BonkConstructorNameOverride bonk = new BonkConstructorNameOverride("message", 42);
        testRoundTripSerialize(bonk);
View Full Code Here

Examples of com.facebook.swift.codec.metadata.ThriftType

    @Test
    public void testOneOfEverythingFieldManual()
            throws Exception
    {
        ThriftCatalog catalog = codecManager.getCatalog();
        ThriftType bonkFieldType = catalog.getThriftType(BonkField.class);
        BonkFieldThriftCodec bonkFieldCodec = new BonkFieldThriftCodec(bonkFieldType);

        ThriftType oneOfEverythingType = catalog.getThriftType(OneOfEverything.class);
        OneOfEverythingThriftCodec codec = new OneOfEverythingThriftCodec(
                oneOfEverythingType,
                bonkFieldCodec,
                new SetThriftCodec<>(ThriftType.BOOL, new BooleanThriftCodec()));
View Full Code Here

Examples of com.facebook.swift.codec.metadata.ThriftType

                        thriftCodecBinder(binder).bindThriftCodec(new ThriftCodec<ValueClass>()
                        {
                            @Override
                            public ThriftType getType()
                            {
                                return new ThriftType(ThriftType.STRING, ValueClass.class);
                            }

                            @Override
                            public ValueClass read(TProtocol protocol)
                                    throws Exception
View Full Code Here

Examples of com.facebook.swift.codec.metadata.ThriftType

                parameterName = parameterNames[index];
            }

            Type parameterType = parameterTypes[index];

            ThriftType thriftType = catalog.getThriftType(parameterType);

            ThriftInjection parameterInjection = new ThriftParameterInjection(parameterId, parameterName, index, parameterType);
            ThriftFieldMetadata fieldMetadata = new ThriftFieldMetadata(
                    parameterId,
                    parameterRequiredness,
View Full Code Here

Examples of com.facebook.swift.codec.metadata.ThriftType

                parameterName = parameterNames[index];
            }

            Type parameterType = parameterTypes[index];

            ThriftType thriftType = catalog.getThriftType(parameterType);

            ThriftInjection parameterInjection = new ThriftParameterInjection(parameterId, parameterName, index, parameterType);
            ThriftFieldMetadata fieldMetadata = new ThriftFieldMetadata(
                    parameterId,
                    thriftType,
View Full Code Here

Examples of com.facebook.swift.codec.metadata.ThriftType

                LOG.info("Found thrift service: {}", cls.getSimpleName());
            }
            return serviceMetadata;
        } else {
            // it's a type (will throw if it's not)
            ThriftType thriftType = codecManager.getCatalog().getThriftType(cls);
            if (verbose) {
                LOG.info("Found thrift type: {}", thriftTypeRenderer.toString(thriftType));
            }
            return thriftType;
        }
View Full Code Here

Examples of com.facebook.swift.parser.model.ThriftType

                thriftName = names.get(1);
                thriftNamespace = names.get(0);
            }

            final String javatypeName = thriftNamespace + "." + TemplateContextGenerator.mangleJavatypeName(thriftName);
            final ThriftType thriftType = typedefRegistry.findType(javatypeName);
            if (thriftType == null) {
                final SwiftJavaType javaType = typeRegistry.findType(javatypeName);
                return (javaType == null) ? null : javaType.getSimpleName();
            }
            else {
View Full Code Here

Examples of com.facebook.swift.parser.model.ThriftType

                thriftName = names.get(1);
                thriftNamespace = names.get(0);
            }

            final String javatypeName = thriftNamespace + "." + TemplateContextGenerator.mangleJavatypeName(thriftName);
            final ThriftType thriftType = typedefRegistry.findType(javatypeName);
            if (thriftType == null) {
                final SwiftJavaType javaType = typeRegistry.findType(javatypeName);
                return (javaType == null) ? null : shortenClassName(javaType.getClassName());
            }
            else {
View Full Code Here

Examples of com.facebook.swift.parser.model.ThriftType

                thriftName = names.get(1);
                thriftNamespace = names.get(0);
            }

            final String javatypeName = thriftNamespace + "." + TemplateContextGenerator.mangleJavatypeName(thriftName);
            final ThriftType thriftType = typedefRegistry.findType(javatypeName);
            if (thriftType == null) {
                final SwiftJavaType javaType = typeRegistry.findType(javatypeName);
                return (javaType == null) ? null : shortenClassName(javaType.getClassName());
            }
            else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.