/** * If the next token is a 64-bit signed integer, consume it and return its * value. Otherwise, throw a {@link ParseException}. */ public long consumeInt64() throws ParseException { try { long result = parseInt64(currentToken); nextToken(); return result; } catch (NumberFormatException e) { throw integerParseException(e); } }
/** * If the next token is a 32-bit unsigned integer, consume it and return its * value. Otherwise, throw a {@link ParseException}. */ public int consumeUInt32() throws ParseException { try { int result = parseUInt32(currentToken); nextToken(); return result; } catch (NumberFormatException e) { throw integerParseException(e); } }
/** * If the next token is a 64-bit unsigned integer, consume it and return its * value. Otherwise, throw a {@link ParseException}. */ public long consumeUInt64() throws ParseException { try { long result = parseUInt64(currentToken); nextToken(); return result; } catch (NumberFormatException e) { throw integerParseException(e); } }
private String javaClassName(ProtoDescriptor proto) { return getOption(proto.getOptions(), "java_outer_classname", uCamel(removeFileExtension(proto.getName()))); }
private String javaType(TypeDescriptor descriptor) { ProtoDescriptor p = descriptor.getProtoDescriptor(); if( p != proto ) { // Try to keep it short.. String othePackage = javaPackage(p); if( equals(othePackage,javaPackage(proto) ) ) { return javaClassName(p)+"."+descriptor.getQName(); } // Use the fully qualified class name. return othePackage+"."+javaClassName(p)+"."+descriptor.getQName(); } return descriptor.getQName(); }
private String javaClassName(ProtoDescriptor proto) { return getOption(proto.getOptions(), "java_outer_classname", uCamel(removeFileExtension(proto.getName()))); }
/** * If the next token is a 32-bit signed integer, consume it and return its * value. Otherwise, throw a {@link ParseException}. */ public int consumeInt32() throws ParseException { try { int result = parseInt32(currentToken); nextToken(); return result; } catch (NumberFormatException e) { throw integerParseException(e); } }
/** * Parse a 32-bit unsigned integer from the text. Unlike the Java standard * {@code Integer.parseInt()}, this function recognizes the prefixes "0x" * and "0" to signify hexidecimal and octal numbers, respectively. The * result is coerced to a (signed) {@code int} when returned since Java has * no unsigned integer type. */ static int parseUInt32(String text) throws NumberFormatException { return (int) parseInteger(text, false, false); }
public String getQName() { if( parent==null ) { return name; } else { return parent.getQName()+"."+name; } }
private String javaClassName(ProtoDescriptor proto) { return getOption(proto.getOptions(), "java_outer_classname", uCamel(removeFileExtension(proto.getName()))); }
private String javaType(TypeDescriptor descriptor) { ProtoDescriptor p = descriptor.getProtoDescriptor(); if( p != proto ) { // Try to keep it short.. String othePackage = javaPackage(p); if( equals(othePackage,javaPackage(proto) ) ) { return javaClassName(p)+"."+descriptor.getQName(); } // Use the fully qualified class name. return othePackage+"."+javaClassName(p)+"."+descriptor.getQName(); } return descriptor.getQName(); }
/** * If the next token is a 32-bit unsigned integer, consume it and return its * value. Otherwise, throw a {@link ParseException}. */ public int consumeUInt32() throws ParseException { try { int result = parseUInt32(currentToken); nextToken(); return result; } catch (NumberFormatException e) { throw integerParseException(e); } }
/** * If the next token is a 64-bit unsigned integer, consume it and return its * value. Otherwise, throw a {@link ParseException}. */ public long consumeUInt64() throws ParseException { try { long result = parseUInt64(currentToken); nextToken(); return result; } catch (NumberFormatException e) { throw integerParseException(e); } }
/** * If the next token is a 32-bit signed integer, consume it and return its * value. Otherwise, throw a {@link ParseException}. */ public int consumeInt32() throws ParseException { try { int result = parseInt32(currentToken); nextToken(); return result; } catch (NumberFormatException e) { throw integerParseException(e); } }
/** * If the next token is a 64-bit signed integer, consume it and return its * value. Otherwise, throw a {@link ParseException}. */ public long consumeInt64() throws ParseException { try { long result = parseInt64(currentToken); nextToken(); return result; } catch (NumberFormatException e) { throw integerParseException(e); } }
private String javaClassName(ProtoDescriptor proto) { return getOption(proto.getOptions(), "java_outer_classname", uCamel(removeFileExtension(proto.getName()))); }
/** * If the next token is a 32-bit unsigned integer, consume it and return its * value. Otherwise, throw a {@link ParseException}. */ public int consumeUInt32() throws ParseException { try { int result = parseUInt32(currentToken); nextToken(); return result; } catch (NumberFormatException e) { throw integerParseException(e); } }
/** * If the next token is a 64-bit unsigned integer, consume it and return its * value. Otherwise, throw a {@link ParseException}. */ public long consumeUInt64() throws ParseException { try { long result = parseUInt64(currentToken); nextToken(); return result; } catch (NumberFormatException e) { throw integerParseException(e); } }
/** * If the next token is a 32-bit signed integer, consume it and return its * value. Otherwise, throw a {@link ParseException}. */ public int consumeInt32() throws ParseException { try { int result = parseInt32(currentToken); nextToken(); return result; } catch (NumberFormatException e) { throw integerParseException(e); } }