private static HollowSetSchema parseSetSchema(String typeName, StreamTokenizer tokenizer) throws IOException { int tok = tokenizer.nextToken(); if(tokenizer.ttype != '<') throw new IOException("Invalid Syntax: Expected '<' after 'Set' for type " + typeName); tok = tokenizer.nextToken(); if(tok != StreamTokenizer.TT_WORD) { log.warning("Invalid Syntax: Expected element type declaration: " + typeName); } String elementType = tokenizer.sval; tok = tokenizer.nextToken(); if(tokenizer.ttype != '>') throw new IOException("Invalid Syntax: Expected '>' element type declaration: " + typeName); tok = tokenizer.nextToken(); String hashKeyPaths[] = parseHashKey(tokenizer); if(tokenizer.ttype != ';') throw new IOException("Invalid Syntax: Expected semicolon after Set schema declaration: " + typeName); return new HollowSetSchema(typeName, elementType, hashKeyPaths); }
private static HollowMapSchema parseMapSchema(String typeName, StreamTokenizer tokenizer) throws IOException { int tok = tokenizer.nextToken(); if(tokenizer.ttype != '<') throw new IOException("Invalid Syntax: Expected '<' after 'Map' for type " + typeName); tok = tokenizer.nextToken(); if(tok != StreamTokenizer.TT_WORD) { log.warning("Invalid Syntax: Expected element type declaration: " + typeName); } String keyType = tokenizer.sval; tok = tokenizer.nextToken(); if(tokenizer.ttype != ',') throw new IOException("Invalid Syntax: Expected ',' after key type declaration: " + typeName); tok = tokenizer.nextToken(); if(tok != StreamTokenizer.TT_WORD) { log.warning("Invalid Syntax: Expected value type declaration: " + typeName); } String valueType = tokenizer.sval; tok = tokenizer.nextToken(); if(tokenizer.ttype != '>') throw new IOException("Invalid Syntax: Expected '>' after value type declaration: " + typeName); tok = tokenizer.nextToken(); String hashKeyPaths[] = parseHashKey(tokenizer); if(tokenizer.ttype != ';') throw new IOException("Invalid Syntax: Expected semicolon after Map schema declaration: " + typeName); return new HollowMapSchema(typeName, keyType, valueType, hashKeyPaths); }