[noop] push by aeagle22206 - Fill in more details in the AST proto on 2009-12-15 18:01 GMT

3 views
Skip to first unread message

no...@googlecode.com

unread,
Dec 15, 2009, 1:01:34 PM12/15/09
to noop-c...@googlegroups.com
Revision: 09cdd2646f
Author: Alex Eagle <alex...@google.com>
Date: Tue Dec 15 10:01:16 2009
Log: Fill in more details in the AST proto
http://code.google.com/p/noop/source/detail?r=09cdd2646f

Modified:
/core/src/main/java/noop/model/proto/Noop.java
/core/src/main/proto/noop.proto
/core/src/test/java/noop/model/proto/ProtoBufferSpike.java

=======================================
--- /core/src/main/java/noop/model/proto/Noop.java Mon Dec 14 22:38:11 2009
+++ /core/src/main/java/noop/model/proto/Noop.java Tue Dec 15 10:01:16 2009
@@ -7,8 +7,7 @@
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
- public enum Modifier
- implements com.google.protobuf.ProtocolMessageEnum {
+ public static enum Modifier {
MUTABLE(0, 1),
NATIVE(1, 2),
;
@@ -23,18 +22,6 @@
default: return null;
}
}
-
- public static com.google.protobuf.Internal.EnumLiteMap<Modifier>
- internalGetValueMap() {
- return internalValueMap;
- }
- private static com.google.protobuf.Internal.EnumLiteMap<Modifier>
- internalValueMap =
- new com.google.protobuf.Internal.EnumLiteMap<Modifier>() {
- public Modifier findValueByNumber(int number) {
- return Modifier.valueOf(number)
- ; }
- };

public final com.google.protobuf.Descriptors.EnumValueDescriptor
getValueDescriptor() {
@@ -66,6 +53,342 @@
this.index = index;
this.value = value;
}
+
+ static {
+ noop.model.proto.Noop.getDescriptor();
+ }
+ }
+
+ public static final class Documentation extends
+ com.google.protobuf.GeneratedMessage {
+ // Use Documentation.newBuilder() to construct.
+ private Documentation() {}
+
+ private static final Documentation defaultInstance = new
Documentation();
+ public static Documentation getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public Documentation getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return
noop.model.proto.Noop.internal_static_Documentation_descriptor;
+ }
+
+ @Override
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return
noop.model.proto.Noop.internal_static_Documentation_fieldAccessorTable;
+ }
+
+ // required string summary = 1;
+ private boolean hasSummary;
+ private java.lang.String summary_ = "";
+ public boolean hasSummary() { return hasSummary; }
+ public java.lang.String getSummary() { return summary_; }
+
+ // repeated string author = 2;
+ private java.util.List<java.lang.String> author_ =
+ java.util.Collections.emptyList();
+ public java.util.List<java.lang.String> getAuthorList() {
+ return author_;
+ }
+ public int getAuthorCount() { return author_.size(); }
+ public java.lang.String getAuthor(int index) {
+ return author_.get(index);
+ }
+
+ // repeated string parameter = 3;
+ private java.util.List<java.lang.String> parameter_ =
+ java.util.Collections.emptyList();
+ public java.util.List<java.lang.String> getParameterList() {
+ return parameter_;
+ }
+ public int getParameterCount() { return parameter_.size(); }
+ public java.lang.String getParameter(int index) {
+ return parameter_.get(index);
+ }
+
+ // repeated string return = 4;
+ private java.util.List<java.lang.String> return_ =
+ java.util.Collections.emptyList();
+ public java.util.List<java.lang.String> getReturnList() {
+ return return_;
+ }
+ public int getReturnCount() { return return_.size(); }
+ public java.lang.String getReturn(int index) {
+ return return_.get(index);
+ }
+
+ // optional string details = 5;
+ private boolean hasDetails;
+ private java.lang.String details_ = "";
+ public boolean hasDetails() { return hasDetails; }
+ public java.lang.String getDetails() { return details_; }
+
+ public static noop.model.proto.Noop.Documentation parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data).buildParsed();
+ }
+ public static noop.model.proto.Noop.Documentation parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistry extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data, extensionRegistry)
+ .buildParsed();
+ }
+ public static noop.model.proto.Noop.Documentation parseFrom(byte[]
data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data).buildParsed();
+ }
+ public static noop.model.proto.Noop.Documentation parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistry extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data, extensionRegistry)
+ .buildParsed();
+ }
+ public static noop.model.proto.Noop.Documentation
parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input).buildParsed();
+ }
+ public static noop.model.proto.Noop.Documentation parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistry extensionRegistry)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input, extensionRegistry)
+ .buildParsed();
+ }
+ public static noop.model.proto.Noop.Documentation parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input).buildParsed();
+ }
+ public static noop.model.proto.Noop.Documentation parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistry extensionRegistry)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input, extensionRegistry)
+ .buildParsed();
+ }
+
+ public static Builder newBuilder() { return new Builder(); }
+ public Builder newBuilderForType() { return new Builder(); }
+ public static Builder newBuilder(noop.model.proto.Noop.Documentation
prototype) {
+ return new Builder().mergeFrom(prototype);
+ }
+
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder> {
+ // Construct using noop.model.proto.Noop.Documentation.newBuilder()
+ private Builder() {}
+
+ noop.model.proto.Noop.Documentation result = new
noop.model.proto.Noop.Documentation();
+
+ @Override
+ protected noop.model.proto.Noop.Documentation internalGetResult() {
+ return result;
+ }
+
+ @Override
+ public Builder clear() {
+ result = new noop.model.proto.Noop.Documentation();
+ return this;
+ }
+
+ @Override
+ public Builder clone() {
+ return new Builder().mergeFrom(result);
+ }
+
+ @Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return noop.model.proto.Noop.Documentation.getDescriptor();
+ }
+
+ public noop.model.proto.Noop.Documentation
getDefaultInstanceForType() {
+ return noop.model.proto.Noop.Documentation.getDefaultInstance();
+ }
+
+ public noop.model.proto.Noop.Documentation build() {
+ if (!isInitialized()) {
+ throw new com.google.protobuf.UninitializedMessageException(
+ result);
+ }
+ return buildPartial();
+ }
+
+ private noop.model.proto.Noop.Documentation buildParsed()
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ if (!isInitialized()) {
+ throw new com.google.protobuf.UninitializedMessageException(
+ result).asInvalidProtocolBufferException();
+ }
+ return buildPartial();
+ }
+
+ public noop.model.proto.Noop.Documentation buildPartial() {
+ if (result.author_ != java.util.Collections.EMPTY_LIST) {
+ result.author_ =
+ java.util.Collections.unmodifiableList(result.author_);
+ }
+ if (result.parameter_ != java.util.Collections.EMPTY_LIST) {
+ result.parameter_ =
+ java.util.Collections.unmodifiableList(result.parameter_);
+ }
+ if (result.return_ != java.util.Collections.EMPTY_LIST) {
+ result.return_ =
+ java.util.Collections.unmodifiableList(result.return_);
+ }
+ noop.model.proto.Noop.Documentation returnMe = result;
+ result = null;
+ return returnMe;
+ }
+
+
+ // required string summary = 1;
+ public boolean hasSummary() {
+ return result.hasSummary();
+ }
+ public java.lang.String getSummary() {
+ return result.getSummary();
+ }
+ public Builder setSummary(java.lang.String value) {
+ result.hasSummary = true;
+ result.summary_ = value;
+ return this;
+ }
+ public Builder clearSummary() {
+ result.hasSummary = false;
+ result.summary_ = "";
+ return this;
+ }
+
+ // repeated string author = 2;
+ public java.util.List<java.lang.String> getAuthorList() {
+ return java.util.Collections.unmodifiableList(result.author_);
+ }
+ public int getAuthorCount() {
+ return result.getAuthorCount();
+ }
+ public java.lang.String getAuthor(int index) {
+ return result.getAuthor(index);
+ }
+ public Builder setAuthor(int index, java.lang.String value) {
+ result.author_.set(index, value);
+ return this;
+ }
+ public Builder addAuthor(java.lang.String value) {
+ if (result.author_.isEmpty()) {
+ result.author_ = new java.util.ArrayList<java.lang.String>();
+ }
+ result.author_.add(value);
+ return this;
+ }
+ public Builder addAllAuthor(
+ java.lang.Iterable<? extends java.lang.String> values) {
+ if (result.author_.isEmpty()) {
+ result.author_ = new java.util.ArrayList<java.lang.String>();
+ }
+ super.addAll(values, result.author_);
+ return this;
+ }
+ public Builder clearAuthor() {
+ result.author_ = java.util.Collections.emptyList();
+ return this;
+ }
+
+ // repeated string parameter = 3;
+ public java.util.List<java.lang.String> getParameterList() {
+ return java.util.Collections.unmodifiableList(result.parameter_);
+ }
+ public int getParameterCount() {
+ return result.getParameterCount();
+ }
+ public java.lang.String getParameter(int index) {
+ return result.getParameter(index);
+ }
+ public Builder setParameter(int index, java.lang.String value) {
+ result.parameter_.set(index, value);
+ return this;
+ }
+ public Builder addParameter(java.lang.String value) {
+ if (result.parameter_.isEmpty()) {
+ result.parameter_ = new java.util.ArrayList<java.lang.String>();
+ }
+ result.parameter_.add(value);
+ return this;
+ }
+ public Builder addAllParameter(
+ java.lang.Iterable<? extends java.lang.String> values) {
+ if (result.parameter_.isEmpty()) {
+ result.parameter_ = new java.util.ArrayList<java.lang.String>();
+ }
+ super.addAll(values, result.parameter_);
+ return this;
+ }
+ public Builder clearParameter() {
+ result.parameter_ = java.util.Collections.emptyList();
+ return this;
+ }
+
+ // repeated string return = 4;
+ public java.util.List<java.lang.String> getReturnList() {
+ return java.util.Collections.unmodifiableList(result.return_);
+ }
+ public int getReturnCount() {
+ return result.getReturnCount();
+ }
+ public java.lang.String getReturn(int index) {
+ return result.getReturn(index);
+ }
+ public Builder setReturn(int index, java.lang.String value) {
+ result.return_.set(index, value);
+ return this;
+ }
+ public Builder addReturn(java.lang.String value) {
+ if (result.return_.isEmpty()) {
+ result.return_ = new java.util.ArrayList<java.lang.String>();
+ }
+ result.return_.add(value);
+ return this;
+ }
+ public Builder addAllReturn(
+ java.lang.Iterable<? extends java.lang.String> values) {
+ if (result.return_.isEmpty()) {
+ result.return_ = new java.util.ArrayList<java.lang.String>();
+ }
+ super.addAll(values, result.return_);
+ return this;
+ }
+ public Builder clearReturn() {
+ result.return_ = java.util.Collections.emptyList();
+ return this;
+ }
+
+ // optional string details = 5;
+ public boolean hasDetails() {
+ return result.hasDetails();
+ }
+ public java.lang.String getDetails() {
+ return result.getDetails();
+ }
+ public Builder setDetails(java.lang.String value) {
+ result.hasDetails = true;
+ result.details_ = value;
+ return this;
+ }
+ public Builder clearDetails() {
+ result.hasDetails = false;
+ result.details_ = "";
+ return this;
+ }
+ }

static {
noop.model.proto.Noop.getDescriptor();
@@ -91,27 +414,31 @@
return noop.model.proto.Noop.internal_static_Module_descriptor;
}

+ @Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return
noop.model.proto.Noop.internal_static_Module_fieldAccessorTable;
}

// required string name = 1;
- public static final int NAME_FIELD_NUMBER = 1;
private boolean hasName;
private java.lang.String name_ = "";
public boolean hasName() { return hasName; }
public java.lang.String getName() { return name_; }

- // optional string documentation = 2;
- public static final int DOCUMENTATION_FIELD_NUMBER = 2;
+ // optional .Documentation documentation = 2;
private boolean hasDocumentation;
- private java.lang.String documentation_ = "";
+ private noop.model.proto.Noop.Documentation documentation_ =
noop.model.proto.Noop.Documentation.getDefaultInstance();
public boolean hasDocumentation() { return hasDocumentation; }
- public java.lang.String getDocumentation() { return documentation_; }
-
- // repeated .Binding binding = 3;
- public static final int BINDING_FIELD_NUMBER = 3;
+ public noop.model.proto.Noop.Documentation getDocumentation() { return
documentation_; }
+
+ // optional string copyright = 3;
+ private boolean hasCopyright;
+ private java.lang.String copyright_ = "";
+ public boolean hasCopyright() { return hasCopyright; }
+ public java.lang.String getCopyright() { return copyright_; }
+
+ // repeated .Binding binding = 4;
private java.util.List<noop.model.proto.Noop.Binding> binding_ =
java.util.Collections.emptyList();
public java.util.List<noop.model.proto.Noop.Binding> getBindingList() {
@@ -122,8 +449,7 @@
return binding_.get(index);
}

- // repeated .Alias alias = 4;
- public static final int ALIAS_FIELD_NUMBER = 4;
+ // repeated .Alias alias = 5;
private java.util.List<noop.model.proto.Noop.Alias> alias_ =
java.util.Collections.emptyList();
public java.util.List<noop.model.proto.Noop.Alias> getAliasList() {
@@ -134,8 +460,7 @@
return alias_.get(index);
}

- // repeated .Interface interface = 5;
- public static final int INTERFACE_FIELD_NUMBER = 5;
+ // repeated .Interface interface = 6;
private java.util.List<noop.model.proto.Noop.Interface> interface_ =
java.util.Collections.emptyList();
public java.util.List<noop.model.proto.Noop.Interface>
getInterfaceList() {
@@ -146,8 +471,7 @@
return interface_.get(index);
}

- // repeated .ConcreteClass concrete_class = 6;
- public static final int CONCRETE_CLASS_FIELD_NUMBER = 6;
+ // repeated .ConcreteClass concrete_class = 7;
private java.util.List<noop.model.proto.Noop.ConcreteClass>
concreteClass_ =
java.util.Collections.emptyList();
public java.util.List<noop.model.proto.Noop.ConcreteClass>
getConcreteClassList() {
@@ -158,79 +482,15 @@
return concreteClass_.get(index);
}

- public final boolean isInitialized() {
- if (!hasName) return false;
- for (noop.model.proto.Noop.Binding element : getBindingList()) {
- if (!element.isInitialized()) return false;
- }
- for (noop.model.proto.Noop.Alias element : getAliasList()) {
- if (!element.isInitialized()) return false;
- }
- for (noop.model.proto.Noop.Interface element : getInterfaceList()) {
- if (!element.isInitialized()) return false;
- }
- for (noop.model.proto.Noop.ConcreteClass element :
getConcreteClassList()) {
- if (!element.isInitialized()) return false;
- }
- return true;
- }
-
- public void writeTo(com.google.protobuf.CodedOutputStream output)
- throws java.io.IOException {
- if (hasName()) {
- output.writeString(1, getName());
- }
- if (hasDocumentation()) {
- output.writeString(2, getDocumentation());
- }
- for (noop.model.proto.Noop.Binding element : getBindingList()) {
- output.writeMessage(3, element);
- }
- for (noop.model.proto.Noop.Alias element : getAliasList()) {
- output.writeMessage(4, element);
- }
- for (noop.model.proto.Noop.Interface element : getInterfaceList()) {
- output.writeMessage(5, element);
- }
- for (noop.model.proto.Noop.ConcreteClass element :
getConcreteClassList()) {
- output.writeMessage(6, element);
- }
- getUnknownFields().writeTo(output);
- }
-
- private int memoizedSerializedSize = -1;
- public int getSerializedSize() {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
-
- size = 0;
- if (hasName()) {
- size += com.google.protobuf.CodedOutputStream
- .computeStringSize(1, getName());
- }
- if (hasDocumentation()) {
- size += com.google.protobuf.CodedOutputStream
- .computeStringSize(2, getDocumentation());
- }
- for (noop.model.proto.Noop.Binding element : getBindingList()) {
- size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(3, element);
- }
- for (noop.model.proto.Noop.Alias element : getAliasList()) {
- size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(4, element);
- }
- for (noop.model.proto.Noop.Interface element : getInterfaceList()) {
- size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(5, element);
- }
- for (noop.model.proto.Noop.ConcreteClass element :
getConcreteClassList()) {
- size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(6, element);
- }
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
- return size;
+ // repeated .Test test = 8;
+ private java.util.List<noop.model.proto.Noop.Test> test_ =
+ java.util.Collections.emptyList();
+ public java.util.List<noop.model.proto.Noop.Test> getTestList() {
+ return test_;
+ }
+ public int getTestCount() { return test_.size(); }
+ public noop.model.proto.Noop.Test getTest(int index) {
+ return test_.get(index);
}

public static noop.model.proto.Noop.Module parseFrom(
@@ -240,7 +500,7 @@
}
public static noop.model.proto.Noop.Module parseFrom(
com.google.protobuf.ByteString data,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ com.google.protobuf.ExtensionRegistry extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data, extensionRegistry)
.buildParsed();
@@ -251,7 +511,7 @@
}
public static noop.model.proto.Noop.Module parseFrom(
byte[] data,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ com.google.protobuf.ExtensionRegistry extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data, extensionRegistry)
.buildParsed();
@@ -262,22 +522,11 @@
}
public static noop.model.proto.Noop.Module parseFrom(
java.io.InputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ com.google.protobuf.ExtensionRegistry extensionRegistry)
throws java.io.IOException {
return newBuilder().mergeFrom(input, extensionRegistry)
.buildParsed();
}
- public static noop.model.proto.Noop.Module
parseDelimitedFrom(java.io.InputStream input)
- throws java.io.IOException {
- return newBuilder().mergeDelimitedFrom(input).buildParsed();
- }
- public static noop.model.proto.Noop.Module parseDelimitedFrom(
- java.io.InputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return newBuilder().mergeDelimitedFrom(input, extensionRegistry)
- .buildParsed();
- }
public static noop.model.proto.Noop.Module parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
@@ -285,49 +534,42 @@
}
public static noop.model.proto.Noop.Module parseFrom(
com.google.protobuf.CodedInputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ com.google.protobuf.ExtensionRegistry extensionRegistry)
throws java.io.IOException {
return newBuilder().mergeFrom(input, extensionRegistry)
.buildParsed();
}

- public static Builder newBuilder() { return Builder.create(); }
- public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() { return new Builder(); }
+ public Builder newBuilderForType() { return new Builder(); }
public static Builder newBuilder(noop.model.proto.Noop.Module
prototype) {
- return newBuilder().mergeFrom(prototype);
- }
- public Builder toBuilder() { return newBuilder(this); }
+ return new Builder().mergeFrom(prototype);
+ }

public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> {
- private noop.model.proto.Noop.Module result;
-
// Construct using noop.model.proto.Noop.Module.newBuilder()
private Builder() {}

- private static Builder create() {
- Builder builder = new Builder();
- builder.result = new noop.model.proto.Noop.Module();
- return builder;
- }
-
+ noop.model.proto.Noop.Module result = new
noop.model.proto.Noop.Module();
+
+ @Override
protected noop.model.proto.Noop.Module internalGetResult() {
return result;
}

+ @Override
public Builder clear() {
- if (result == null) {
- throw new IllegalStateException(
- "Cannot call clear() after build().");
- }
result = new noop.model.proto.Noop.Module();
return this;
}

+ @Override
public Builder clone() {
- return create().mergeFrom(result);
+ return new Builder().mergeFrom(result);
}

+ @Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return noop.model.proto.Noop.Module.getDescriptor();
@@ -337,12 +579,10 @@
return noop.model.proto.Noop.Module.getDefaultInstance();
}

- public boolean isInitialized() {
- return result.isInitialized();
- }
public noop.model.proto.Noop.Module build() {
- if (result != null && !isInitialized()) {
- throw newUninitializedMessageException(result);
+ if (!isInitialized()) {
+ throw new com.google.protobuf.UninitializedMessageException(
+ result);
}
return buildPartial();
}
@@ -350,17 +590,13 @@
private noop.model.proto.Noop.Module buildParsed()
throws com.google.protobuf.InvalidProtocolBufferException {
if (!isInitialized()) {
- throw newUninitializedMessageException(
+ throw new com.google.protobuf.UninitializedMessageException(
result).asInvalidProtocolBufferException();
}
return buildPartial();
}

public noop.model.proto.Noop.Module buildPartial() {
- if (result == null) {
- throw new IllegalStateException(
- "build() has already been called on this Builder.");
- }
if (result.binding_ != java.util.Collections.EMPTY_LIST) {
result.binding_ =
java.util.Collections.unmodifiableList(result.binding_);
@@ -377,113 +613,15 @@
result.concreteClass_ =
java.util.Collections.unmodifiableList(result.concreteClass_);
}
+ if (result.test_ != java.util.Collections.EMPTY_LIST) {
+ result.test_ =
+ java.util.Collections.unmodifiableList(result.test_);
+ }
noop.model.proto.Noop.Module returnMe = result;
result = null;
return returnMe;
}

- public Builder mergeFrom(com.google.protobuf.Message other) {
- if (other instanceof noop.model.proto.Noop.Module) {
- return mergeFrom((noop.model.proto.Noop.Module)other);
- } else {
- super.mergeFrom(other);
- return this;
- }
- }
-
- public Builder mergeFrom(noop.model.proto.Noop.Module other) {
- if (other == noop.model.proto.Noop.Module.getDefaultInstance())
return this;
- if (other.hasName()) {
- setName(other.getName());
- }
- if (other.hasDocumentation()) {
- setDocumentation(other.getDocumentation());
- }
- if (!other.binding_.isEmpty()) {
- if (result.binding_.isEmpty()) {
- result.binding_ = new
java.util.ArrayList<noop.model.proto.Noop.Binding>();
- }
- result.binding_.addAll(other.binding_);
- }
- if (!other.alias_.isEmpty()) {
- if (result.alias_.isEmpty()) {
- result.alias_ = new
java.util.ArrayList<noop.model.proto.Noop.Alias>();
- }
- result.alias_.addAll(other.alias_);
- }
- if (!other.interface_.isEmpty()) {
- if (result.interface_.isEmpty()) {
- result.interface_ = new
java.util.ArrayList<noop.model.proto.Noop.Interface>();
- }
- result.interface_.addAll(other.interface_);
- }
- if (!other.concreteClass_.isEmpty()) {
- if (result.concreteClass_.isEmpty()) {
- result.concreteClass_ = new
java.util.ArrayList<noop.model.proto.Noop.ConcreteClass>();
- }
- result.concreteClass_.addAll(other.concreteClass_);
- }
- this.mergeUnknownFields(other.getUnknownFields());
- return this;
- }
-
- public Builder mergeFrom(
- com.google.protobuf.CodedInputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- com.google.protobuf.UnknownFieldSet.Builder unknownFields =
- com.google.protobuf.UnknownFieldSet.newBuilder(
- this.getUnknownFields());
- while (true) {
- int tag = input.readTag();
- switch (tag) {
- case 0:
- this.setUnknownFields(unknownFields.build());
- return this;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- this.setUnknownFields(unknownFields.build());
- return this;
- }
- break;
- }
- case 10: {
- setName(input.readString());
- break;
- }
- case 18: {
- setDocumentation(input.readString());
- break;
- }
- case 26: {
- noop.model.proto.Noop.Binding.Builder subBuilder =
noop.model.proto.Noop.Binding.newBuilder();
- input.readMessage(subBuilder, extensionRegistry);
- addBinding(subBuilder.buildPartial());
- break;
- }
- case 34: {
- noop.model.proto.Noop.Alias.Builder subBuilder =
noop.model.proto.Noop.Alias.newBuilder();
- input.readMessage(subBuilder, extensionRegistry);
- addAlias(subBuilder.buildPartial());
- break;
- }
- case 42: {
- noop.model.proto.Noop.Interface.Builder subBuilder =
noop.model.proto.Noop.Interface.newBuilder();
- input.readMessage(subBuilder, extensionRegistry);
- addInterface(subBuilder.buildPartial());
- break;
- }
- case 50: {
- noop.model.proto.Noop.ConcreteClass.Builder subBuilder =
noop.model.proto.Noop.ConcreteClass.newBuilder();
- input.readMessage(subBuilder, extensionRegistry);
- addConcreteClass(subBuilder.buildPartial());
- break;
- }
- }
- }
- }
-

// required string name = 1;
public boolean hasName() {
@@ -493,41 +631,69 @@
return result.getName();
}
public Builder setName(java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- result.hasName = true;
+ result.hasName = true;
result.name_ = value;
return this;
}
public Builder clearName() {
result.hasName = false;
- result.name_ = getDefaultInstance().getName();
+ result.name_ = "";
return this;
}

- // optional string documentation = 2;
+ // optional .Documentation documentation = 2;
public boolean hasDocumentation() {
return result.hasDocumentation();
}
- public java.lang.String getDocumentation() {
+ public noop.model.proto.Noop.Documentation getDocumentation() {
return result.getDocumentation();
}
- public Builder setDocumentation(java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- result.hasDocumentation = true;
+ public Builder setDocumentation(noop.model.proto.Noop.Documentation
value) {
+ result.hasDocumentation = true;
result.documentation_ = value;
return this;
}
+ public Builder
setDocumentation(noop.model.proto.Noop.Documentation.Builder
builderForValue) {
+ result.hasDocumentation = true;
+ result.documentation_ = builderForValue.build();
+ return this;
+ }
+ public Builder
mergeDocumentation(noop.model.proto.Noop.Documentation value) {
+ if (result.hasDocumentation() &&
+ result.documentation_ !=
noop.model.proto.Noop.Documentation.getDefaultInstance()) {
+ result.documentation_ =
+
noop.model.proto.Noop.Documentation.newBuilder(result.documentation_).mergeFrom(value).buildPartial();
+ } else {
+ result.documentation_ = value;
+ }
+ result.hasDocumentation = true;
+ return this;
+ }
public Builder clearDocumentation() {
result.hasDocumentation = false;
- result.documentation_ = getDefaultInstance().getDocumentation();
+ result.documentation_ =
noop.model.proto.Noop.Documentation.getDefaultInstance();
return this;
}

- // repeated .Binding binding = 3;
+ // optional string copyright = 3;
+ public boolean hasCopyright() {
+ return result.hasCopyright();
+ }
+ public java.lang.String getCopyright() {
+ return result.getCopyright();
+ }
+ public Builder setCopyright(java.lang.String value) {
+ result.hasCopyright = true;
+ result.copyright_ = value;
+ return this;
+ }
+ public Builder clearCopyright() {
+ result.hasCopyright = false;
+ result.copyright_ = "";
+ return this;
+ }
+
+ // repeated .Binding binding = 4;
public java.util.List<noop.model.proto.Noop.Binding>
getBindingList() {
return java.util.Collections.unmodifiableList(result.binding_);
}
@@ -538,9 +704,6 @@
return result.getBinding(index);
}
public Builder setBinding(int index, noop.model.proto.Noop.Binding
value) {
- if (value == null) {
- throw new NullPointerException();
- }
result.binding_.set(index, value);
return this;
}
@@ -549,9 +712,6 @@
return this;
}
public Builder addBinding(noop.model.proto.Noop.Binding value) {
- if (value == null) {
- throw new NullPointerException();
- }
if (result.binding_.isEmpty()) {
result.binding_ = new
java.util.ArrayList<noop.model.proto.Noop.Binding>();
}
@@ -578,7 +738,7 @@
return this;
}

- // repeated .Alias alias = 4;
+ // repeated .Alias alias = 5;
public java.util.List<noop.model.proto.Noop.Alias> getAliasList() {
return java.util.Collections.unmodifiableList(result.alias_);
}
@@ -589,9 +749,6 @@
return result.getAlias(index);
}
public Builder setAlias(int index, noop.model.proto.Noop.Alias
value) {
- if (value == null) {
- throw new NullPointerException();
- }
result.alias_.set(index, value);
return this;
}
@@ -600,9 +757,6 @@
return this;
}
public Builder addAlias(noop.model.proto.Noop.Alias value) {
- if (value == null) {
- throw new NullPointerException();
- }
if (result.alias_.isEmpty()) {
result.alias_ = new
java.util.ArrayList<noop.model.proto.Noop.Alias>();
}
@@ -629,7 +783,7 @@
return this;
}

- // repeated .Interface interface = 5;
+ // repeated .Interface interface = 6;
public java.util.List<noop.model.proto.Noop.Interface>
getInterfaceList() {
return java.util.Collections.unmodifiableList(result.interface_);
}
@@ -640,9 +794,6 @@
return result.getInterface(index);
}
public Builder setInterface(int index,
noop.model.proto.Noop.Interface value) {
- if (value == null) {
- throw new NullPointerException();
- }
result.interface_.set(index, value);
return this;
}
@@ -651,9 +802,6 @@
return this;
}
public Builder addInterface(noop.model.proto.Noop.Interface value) {
- if (value == null) {
- throw new NullPointerException();
- }
if (result.interface_.isEmpty()) {
result.interface_ = new
java.util.ArrayList<noop.model.proto.Noop.Interface>();
}
@@ -680,7 +828,7 @@
return this;
}

- // repeated .ConcreteClass concrete_class = 6;
+ // repeated .ConcreteClass concrete_class = 7;
public java.util.List<noop.model.proto.Noop.ConcreteClass>
getConcreteClassList() {
return
java.util.Collections.unmodifiableList(result.concreteClass_);
}
@@ -691,9 +839,6 @@
return result.getConcreteClass(index);
}
public Builder setConcreteClass(int index,
noop.model.proto.Noop.ConcreteClass value) {
- if (value == null) {
- throw new NullPointerException();
- }
result.concreteClass_.set(index, value);
return this;
}
@@ -702,9 +847,6 @@
return this;
}
public Builder addConcreteClass(noop.model.proto.Noop.ConcreteClass
value) {
- if (value == null) {
- throw new NullPointerException();
- }
if (result.concreteClass_.isEmpty()) {
result.concreteClass_ = new
java.util.ArrayList<noop.model.proto.Noop.ConcreteClass>();
}
@@ -730,15 +872,56 @@
result.concreteClass_ = java.util.Collections.emptyList();
return this;
}
+
+ // repeated .Test test = 8;
+ public java.util.List<noop.model.proto.Noop.Test> getTestList() {
+ return java.util.Collections.unmodifiableList(result.test_);
+ }
+ public int getTestCount() {
+ return result.getTestCount();
+ }
+ public noop.model.proto.Noop.Test getTest(int index) {
+ return result.getTest(index);
+ }
+ public Builder setTest(int index, noop.model.proto.Noop.Test value) {
+ result.test_.set(index, value);
+ return this;
+ }
+ public Builder setTest(int index, noop.model.proto.Noop.Test.Builder
builderForValue) {
***The diff for this file has been truncated for email.***
=======================================
--- /core/src/main/proto/noop.proto Mon Dec 14 22:38:11 2009
+++ /core/src/main/proto/noop.proto Tue Dec 15 10:01:16 2009
@@ -1,26 +1,49 @@
+// Copyright 2009 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Defines the data model which stores Noop programs.
+
// Generate the java file with:
// protoc core/src/main/proto/noop.proto --java_out=core/src/main/java
// TODO(alexeagle): have buildr run the proto compiler

option java_package = "noop.model.proto";

-enum Modifier {
- MUTABLE = 1;
- NATIVE = 2;
+message Documentation {
+ required string summary = 1;
+ repeated string author = 2;
+ // The order and number of the parameters should match the documentation
+ repeated string parameter = 3;
+ // Similarly for the return types
+ repeated string return = 4;
+ optional string details = 5;
}

message Module {
required string name = 1;
- optional string documentation = 2;
- repeated Binding binding = 3;
- repeated Alias alias = 4;
- repeated Interface interface = 5;
- repeated ConcreteClass concrete_class = 6;
+ optional Documentation documentation = 2;
+ optional string copyright = 3;
+ repeated Binding binding = 4;
+ repeated Alias alias = 5;
+ repeated Interface interface = 6;
+ repeated ConcreteClass concrete_class = 7;
+ repeated Test test = 8;
}

message ConcreteClass {
required string name = 1;
- optional string documentation = 2;
+ optional Documentation documentation = 2;
repeated string super_type = 3;
repeated Property property = 4;
repeated Method method = 5;
@@ -31,31 +54,36 @@
required string name = 1;
required string type = 2;
repeated Modifier modifier = 3;
- optional string documentation = 4;
+ optional Documentation documentation = 4;
}

message Binding {
required string name = 1;
- optional string documentation = 2;
+ optional Documentation documentation = 2;
repeated Modifier modifier = 3;
required BindingBlock block = 4;
}

message Interface {
required string name = 1;
- optional string documentation = 2;
+ optional Documentation documentation = 2;
repeated MethodSignature method = 3;
}

message Alias {
required string name = 1;
- optional string documentation = 2;
+ optional Documentation documentation = 2;
required string of = 3;
}
+
+enum Modifier {
+ MUTABLE = 1;
+ NATIVE = 2;
+}

message MethodSignature {
required string name = 1;
- optional string documentation = 2;
+ optional Documentation documentation = 2;
repeated Modifier modifier = 3;
repeated string return_type = 4;
repeated Property argument = 5;
@@ -112,5 +140,14 @@

message Unittest {
required string description = 1;
- optional string documentation = 2;
-}
+ optional Documentation documentation = 2;
+ optional BindingBlock local_binding = 3;
+ required Block block = 4;
+}
+
+message Test {
+ required string description = 1;
+ optional Documentation documentation = 2;
+ repeated string tag = 3;
+ required Block block = 4;
+}
=======================================
--- /core/src/test/java/noop/model/proto/ProtoBufferSpike.java Mon Dec 14
22:38:11 2009
+++ /core/src/test/java/noop/model/proto/ProtoBufferSpike.java Tue Dec 15
10:01:16 2009
@@ -18,34 +18,38 @@
public static void main(String[] args) throws
InvalidProtocolBufferException, ParseException {
Module myModule = Module.newBuilder()
.setName("CmdLineExample")
- .setDocumentation("used to read cmd line args")
+ .setDocumentation(Documentation.newBuilder()
+ .setSummary("used to read cmd line args"))
.addBinding(Binding.newBuilder()
.setName("example.AppBinding")
- .setDocumentation("Contains bindings")
+ .setDocumentation(Documentation.newBuilder()
+ .setSummary("Contains bindings"))
.setBlock(BindingBlock.newBuilder()
.addBind(BindOperator.newBuilder()
.setType("noop.Application")
.setBoundTo(Expression.newBuilder().setType(IDENTIFIER).setStringVal("example.CmdLineArgs")))))
.addConcreteClass(ConcreteClass.newBuilder()
.setName("example.CmdLineArgs")
- .setDocumentation("Demonstrates reading command line arguments
in Noop.")
+ .setDocumentation(Documentation.newBuilder()
+ .setSummary("Demonstrates reading command line arguments
in Noop."))
.addSuperType("noop.Application")
.addProperty(Property.newBuilder().setName("console").setType("noop.system.Console"))
.addProperty(Property.newBuilder().setName("args").setType("noop.system.RawCommandLineArgs"))
.addMethod(Method.newBuilder()
- .setSignature(MethodSignature.newBuilder()
- .setName("main")
- .setDocumentation("the entry point of the application")
- .addReturnType("noop.Int"))
- .setBlock(Block.newBuilder()
- .addExpression(Expression.newBuilder()
- .setMethodInvocation(MethodInvocation.newBuilder()
- .setLhs(Expression.newBuilder().setType(IDENTIFIER).setStringVal("console"))
- .setMethod("println")
- .addArgument(Expression.newBuilder().setType(STRING_LITERAL).setStringVal("hello"))))
- .addExpression(Expression.newBuilder()
- .setType(RETURN)
- .setRhs(Expression.newBuilder().setNumberVal(0)))))
+ .setSignature(MethodSignature.newBuilder()
+ .setName("main")
+ .setDocumentation(Documentation.newBuilder()
+ .setSummary("the entry point of the application"))
+ .addReturnType("noop.Int"))
+ .setBlock(Block.newBuilder()
+ .addExpression(Expression.newBuilder()
+ .setMethodInvocation(MethodInvocation.newBuilder()
+ .setLhs(Expression.newBuilder().setType(IDENTIFIER).setStringVal("console"))
+ .setMethod("println")
+ .addArgument(Expression.newBuilder().setType(STRING_LITERAL).setStringVal("hello"))))
+ .addExpression(Expression.newBuilder()
+ .setType(RETURN)
+ .setRhs(Expression.newBuilder().setNumberVal(0)))))
.addUnittest(Unittest.newBuilder().setDescription("should
print the first argument"))
.addUnittest(Unittest.newBuilder().setDescription("should
return zero"))
).build();
Reply all
Reply to author
Forward
0 new messages