@Test public void testFromJsonResource_pretty() throws IOException { Operation op = net.morimekta.providence.util.ProvidenceHelper.fromJsonResource("/json/calculator/pretty.json", Operation.kDescriptor); Operation expected = Operation.builder() .setOperator(Operator.MULTIPLY) .addToOperands(Operand.builder() .setOperation(Operation.builder() .setOperator(Operator.ADD) .addToOperands(Operand.builder() .setNumber(1234) .build()) .addToOperands(Operand.builder() .setNumber( 4.321) .build()) .build()) .build()) .addToOperands(Operand.builder() .setImaginary(Imaginary.builder() .setV(1.7) .setI(-2.0) .build()) .build()) .build(); assertEquals(op, expected); }
@Nonnull public static <Message extends PMessage<Message, Field>, Field extends PField> Message fromJsonResource(String path, PMessageDescriptor<Message, Field> descriptor) throws IOException { return fromResource(path, descriptor, new JsonSerializer(true)); }
ProvidenceHelper { @Nonnull public static <Message extends PMessage<Message, Field>, Field extends PField> Message fromJsonResource(String path, PMessageDescriptor<Message, Field> descriptor) throws IOException { return fromResource(path, descriptor, new JsonSerializer(true)); } }
ProvidenceHelper { @Nonnull public static <Message extends PMessage<Message, Field>, Field extends PField> Message fromJsonResource(String path, PMessageDescriptor<Message, Field> descriptor) throws IOException { return fromResource(path, descriptor, new JsonSerializer(true)); } private  ProvidenceHelper(); }
ProvidenceHelper { @Nonnull public static <Message extends PMessage<Message, Field>, Field extends PField> Message fromJsonResource(String path, PMessageDescriptor<Message, Field> descriptor) throws IOException { return fromResource(path, descriptor, new JsonSerializer(true)); } private  ProvidenceHelper(); @SuppressWarnings("unchecked") static B getTargetModifications(M source, M target); @Nonnull static Message fromJsonResource(String path,
                             PMessageDescriptor<Message, Field> descriptor); @Nonnull static ArrayList<Message> arrayListFromJsonResource(String path,
                                                 PMessageDescriptor<Message, Field> descriptor); @Nonnull static Message fromResource(String resource,
                         PMessageDescriptor<Message, Field> descriptor,
                         Serializer serializer); @Nonnull static ArrayList<Message> arrayListFromResource(String path,
                                             PMessageDescriptor<Message, Field> descriptor,
                                             Serializer serializer); @Nonnull static String debugString(Message message); @Nonnull static Message parseDebugString(String string, PMessageDescriptor<Message, Field> descriptor); @SuppressWarnings("unchecked") @Nonnull static Optional<T> optionalInMessage(PMessage message, PField... fields); }
ProvidenceHelper { @Nonnull public static <Message extends PMessage<Message, Field>, Field extends PField> Message fromJsonResource(String path, PMessageDescriptor<Message, Field> descriptor) throws IOException { return fromResource(path, descriptor, new JsonSerializer(true)); } private  ProvidenceHelper(); @SuppressWarnings("unchecked") static B getTargetModifications(M source, M target); @Nonnull static Message fromJsonResource(String path,
                             PMessageDescriptor<Message, Field> descriptor); @Nonnull static ArrayList<Message> arrayListFromJsonResource(String path,
                                                 PMessageDescriptor<Message, Field> descriptor); @Nonnull static Message fromResource(String resource,
                         PMessageDescriptor<Message, Field> descriptor,
                         Serializer serializer); @Nonnull static ArrayList<Message> arrayListFromResource(String path,
                                             PMessageDescriptor<Message, Field> descriptor,
                                             Serializer serializer); @Nonnull static String debugString(Message message); @Nonnull static Message parseDebugString(String string, PMessageDescriptor<Message, Field> descriptor); @SuppressWarnings("unchecked") @Nonnull static Optional<T> optionalInMessage(PMessage message, PField... fields);  }