public Optional<String> getName() { return getFieldName().map(RowFieldName::getName); }
public static TypeParameter of(TypeSignatureParameter parameter, TypeManager typeManager) { switch (parameter.getKind()) { case TYPE: { Type type = typeManager.getType(parameter.getTypeSignature()); return of(type); } case LONG: return of(parameter.getLongLiteral()); case NAMED_TYPE: { Type type = typeManager.getType(parameter.getNamedTypeSignature().getTypeSignature()); return of(new NamedType( parameter.getNamedTypeSignature().getFieldName(), type)); } case VARIABLE: return of(parameter.getVariable()); default: throw new UnsupportedOperationException(format("Unsupported parameter [%s]", parameter)); } }
private static TypeSignatureParameter applyBoundVariables(TypeSignatureParameter parameter, BoundVariables boundVariables) { ParameterKind parameterKind = parameter.getKind(); switch (parameterKind) { case TYPE: { TypeSignature typeSignature = parameter.getTypeSignature(); return TypeSignatureParameter.of(applyBoundVariables(typeSignature, boundVariables)); } case NAMED_TYPE: { NamedTypeSignature namedTypeSignature = parameter.getNamedTypeSignature(); TypeSignature typeSignature = namedTypeSignature.getTypeSignature(); return TypeSignatureParameter.of(new NamedTypeSignature( namedTypeSignature.getFieldName(), applyBoundVariables(typeSignature, boundVariables))); } case VARIABLE: { String variableName = parameter.getVariable(); checkState(boundVariables.containsLongVariable(variableName), "Variable is not bound: %s", variableName); Long variableValue = boundVariables.getLongVariable(variableName); return TypeSignatureParameter.of(variableValue); } case LONG: { return parameter; } default: throw new IllegalStateException("Unknown parameter kind: " + parameter.getKind()); } }
public Optional<String> getName() { return getFieldName().map(RowFieldName::getName); }
public static TypeParameter of(TypeSignatureParameter parameter, TypeManager typeManager) { switch (parameter.getKind()) { case TYPE: { Type type = typeManager.getType(parameter.getTypeSignature()); return of(type); } case LONG: return of(parameter.getLongLiteral()); case NAMED_TYPE: { Type type = typeManager.getType(parameter.getNamedTypeSignature().getTypeSignature()); return of(new NamedType( parameter.getNamedTypeSignature().getFieldName(), type)); } case VARIABLE: return of(parameter.getVariable()); default: throw new UnsupportedOperationException(format("Unsupported parameter [%s]", parameter)); } }