Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
Java codegen: new settings class
Browse files Browse the repository at this point in the history
Corresponding PR in gax-java:
googleapis/gax-java#21

Change-Id: I21f902118c48eed94e086d09b7bdbfb0ffa4a791
  • Loading branch information
garrettjonesgoogle committed Mar 8, 2016
1 parent 623b35d commit f7b9b39
Show file tree
Hide file tree
Showing 8 changed files with 1,040 additions and 695 deletions.
14 changes: 0 additions & 14 deletions vgen/src/main/java/io/gapi/vgen/java/JavaLanguageProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,20 +229,6 @@ public String getGrpcName(Interface service) {
return getTypeName(fullName);
}

/**
* Gets the name of the class which is the blocking client for this service interface.
*/
public String getBlockingClientName(Interface service) {
return getGrpcName(service) + "." + service.getSimpleName() + "BlockingClient";
}

/**
* Gets the name of the class which contains request building helpers.
*/
public String getRequestFactoryName(Interface service) {
return service.getSimpleName() + "Requests";
}

/**
* Given a TypeRef, returns the return statement for that type. Specifically, this will
* return an empty string for the empty type (we don't want a return statement for void).
Expand Down
116 changes: 116 additions & 0 deletions vgen/src/main/resources/io/gapi/vgen/java/common.snip
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
@snippet fileHeader(service)
/*
* Copyright 2015 Google Inc. All Rights Reserved.
*
* 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.
*/

/*
* EDITING INSTRUCTIONS
* This file was generated from the file
* https://github.com/google/googleapis/blob/master/{@service.getFile().getSimpleName()}
* and updates to that file get reflected here through a refresh process.
* For the short term, the refresh process will only be runnable by Google engineers.
* Manual additions are allowed because the refresh process performs
* a 3-way merge in order to preserve those manual additions. In order to not
* break the refresh process, only certain types of modifications are
* allowed.
*
* Allowed modifications - currently these are the only types allowed:
* 1. New methods (these should be added to the end of the class)
* 2. New imports
* 3. Additional documentation between "manual edit" demarcations
*
* Happy editing!
*/

@end

@snippet autoGenClassWarning()
// AUTO-GENERATED DOCUMENTATION AND CLASS - see instructions at the top of the file for editing.
@end

@snippet autoGenServiceWarning()
// AUTO-GENERATED DOCUMENTATION AND SERVICE - see instructions at the top of the file for editing.
@end

@snippet autoGenMethodWarning()
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
@end

@snippet settingsClassName(service)
{@service.getSimpleName}Settings
@end

@snippet javaDoc(protoElement)
{@javaDocStart()}
{@javaDocLines(protoElement)}
{@javaDocEmptyLine()}
{@javaDocManualEdit()}
{@javaDocEnd()}
@end

@snippet javaDocStart()
/**
@end

@snippet javaDocLines(protoElement)
@join commentLine : context.getJavaDocLines(getDoc(protoElement))
{@commentLine}
@end
@end

@snippet javaDocEmptyLine()
@let lineBarrier = ""
{@lineBarrier} *
@end
@end

@snippet javaDocManualEdit()
@let lineBarrier = ""
{@lineBarrier} * <!-- manual edit -->
{@lineBarrier} * <!-- end manual edit -->
@end
@end

@snippet javaDocEnd()
@let lineBarrier = ""
{@lineBarrier} */
@end
@end

@snippet getDoc(protoElement)
{@context.getDescription(protoElement)}
@end

@snippet setCallName(field)
@let paramNameInCamel = context.lowerUnderscoreToUpperCamel(field.getSimpleName)
@if field.getType.isMap
putAll{@paramNameInCamel}
@else
@if field.isRepeated
addAll{@paramNameInCamel}
@else
set{@paramNameInCamel}
@end
@end
@end
@end

@snippet getCallName(field)
@let paramNameInCamel = context.lowerUnderscoreToUpperCamel(field.getSimpleName)
@if field.isRepeated
get{@paramNameInCamel}List
@else
get{@paramNameInCamel}
@end
@end
@end
1 change: 1 addition & 0 deletions vgen/src/main/resources/io/gapi/vgen/java/java_veneer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ language: java
language_provider: io.gapi.vgen.java.JavaLanguageProvider
snippet_files:
- main.snip
- settings.snip
archive: false
Loading

0 comments on commit f7b9b39

Please sign in to comment.