public void validate()

in activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/MessageDescriptor.java [46:80]


    public void validate(List<String> errors) {
        String baseName = getOption(getOptions(), "base_type", null);
        if( baseName!=null ) {
            if( baseType==null ) {
                baseType = (MessageDescriptor) getType(baseName);
            }
            if( baseType == null ) {
                baseType = (MessageDescriptor) getProtoDescriptor().getType(baseName);
            }
            if( baseType == null ) {
                errors.add("base_type option not valid, type not found: "+baseName);
            }
            
            // Assert that all the fields in the base type are defined in this message defintion too.
            HashSet<String> baseFieldNames = new HashSet<String>(baseType.getFields().keySet());
            baseFieldNames.removeAll(getFields().keySet());
            
            // Some fields were not defined in the sub class..
            if( !baseFieldNames.isEmpty() ) {
            	for (String fieldName : baseFieldNames) {
                    errors.add("base_type "+baseName+" field "+fieldName+" not defined in "+getName());
				}
            }
        }

        for (FieldDescriptor field : fields.values()) {
            field.validate(errors);
        }
        for (EnumDescriptor o : enums.values()) {
            o.validate(errors);
        }
        for (MessageDescriptor o : messages.values()) {
            o.validate(errors);
        }
    }