Ejemplo n.º 1
0
 private FieldDescriptor getFieldDescriptor(Descriptor messageDescriptor, String attributePath) {
   FieldDescriptor fd = null;
   String[] split = attributePath.split("[.]");
   for (int i = 0; i < split.length; i++) {
     String name = split[i];
     fd = messageDescriptor.findFieldByName(name);
     if (fd == null) {
       throw log.unknownField(name, messageDescriptor.getFullName());
     }
     IndexingMetadata indexingMetadata =
         messageDescriptor.getProcessedAnnotation(IndexingMetadata.INDEXED_ANNOTATION);
     if (indexingMetadata != null && !indexingMetadata.isFieldIndexed(fd.getNumber())) {
       throw log.fieldIsNotIndexed(name, messageDescriptor.getFullName());
     }
     if (i < split.length - 1) {
       messageDescriptor = fd.getMessageType();
     }
   }
   return fd;
 }
Ejemplo n.º 2
0
 private FieldDescriptor getFieldDescriptor(Descriptor messageDescriptor, String attributePath) {
   FieldDescriptor fd = null;
   String[] split = attributePath.split("[.]");
   for (int i = 0; i < split.length; i++) {
     String name = split[i];
     fd = messageDescriptor.findFieldByName(name);
     if (fd == null) {
       throw new IllegalArgumentException(
           "Unknown field " + name + " in type " + messageDescriptor.getFullName());
     }
     IndexingMetadata indexingMetadata =
         messageDescriptor.getProcessedAnnotation(IndexingMetadata.INDEXED_ANNOTATION);
     if (indexingMetadata != null && !indexingMetadata.isFieldIndexed(fd.getNumber())) {
       throw new IllegalArgumentException(
           "Field " + name + " from type " + messageDescriptor.getFullName() + " is not indexed");
     }
     if (i < split.length - 1) {
       messageDescriptor = fd.getMessageType();
     }
   }
   return fd;
 }