本文整理了Java中org.teiid.language.Function.setName()
方法的一些代码示例,展示了Function.setName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Function.setName()
方法的具体详情如下:
包路径:org.teiid.language.Function
类名称:Function
方法名:setName
[英]Set name of the function
[中]设置函数的名称
代码示例来源:origin: org.teiid.connectors/translator-jdbc
protected void modify(Function function) {
function.setName(alias);
}
代码示例来源:origin: org.teiid.connectors/translator-jdbc
@Override
public List<?> translate(Function function) {
function.setName("||"); //$NON-NLS-1$
return super.translate(function);
}
});
代码示例来源:origin: org.teiid.connectors/translator-jdbc
@Override
public List<?> translate(Function function) {
if (this.name != null) {
function.setName(this.name);
}
return Arrays.asList(function.getName());
}
}
代码示例来源:origin: org.teiid.connectors/translator-jdbc
@Override
public List<?> translate(Function function) {
function.setName("+"); //$NON-NLS-1$
return super.translate(function);
}
});
代码示例来源:origin: org.teiid.connectors/translator-google
@Override
public void visit(Function function) {
if (function.getName().equalsIgnoreCase(SourceSystemFunctions.DAYOFMONTH)) {
function.setName("day"); //$NON-NLS-1$
} else if (function.getName().equalsIgnoreCase(SourceSystemFunctions.UCASE)) {
function.setName("upper"); //$NON-NLS-1$
} else if (function.getName().equalsIgnoreCase(SourceSystemFunctions.LCASE)) {
function.setName("lower"); //$NON-NLS-1$
} else if (function.getName().equalsIgnoreCase(SourceSystemFunctions.DAYOFWEEK)) {
function.setName("weekday"); //$NON-NLS-1$
}
super.visit(function);
}
代码示例来源:origin: org.teiid.connectors/translator-jdbc
@Override
public List<?> translate(Function function) {
function.setName("log"); //$NON-NLS-1$
List<Expression> args = function.getParameters();
args.add(args.get(0));
args.set(0, languageFactory.createLiteral(new Integer(10), TypeFacility.RUNTIME_TYPES.INTEGER));
return null;
}
代码示例来源:origin: org.teiid.connectors/translator-jdbc
@Override
public List<?> translate(Function function) {
function.setName("log"); //$NON-NLS-1$
List<Expression> args = function.getParameters();
args.add(args.get(0));
args.set(0, languageFactory.createLiteral(new Integer(10), TypeFacility.RUNTIME_TYPES.INTEGER));
return null;
}
代码示例来源:origin: org.teiid.connectors/translator-jdbc
@Override
public List<?> translate(Function function) {
function.setName(SourceSystemFunctions.TAN);
return Arrays.asList(getLanguageFactory().createFunction(SourceSystemFunctions.DIVIDE_OP, new Expression[] {new Literal(1, TypeFacility.RUNTIME_TYPES.INTEGER), function}, TypeFacility.RUNTIME_TYPES.DOUBLE));
}
});
代码示例来源:origin: org.teiid.connectors/translator-jdbc
@Override
public List<?> translate(Function function) {
function.setName(SourceSystemFunctions.TAN);
return Arrays.asList(getLanguageFactory().createFunction(SourceSystemFunctions.DIVIDE_OP, new Expression[] {new Literal(1, TypeFacility.RUNTIME_TYPES.INTEGER), function}, TypeFacility.RUNTIME_TYPES.DOUBLE));
}
});
代码示例来源:origin: org.teiid.connectors/translator-jdbc
@Override
public List<?> translate(Function function) {
function.setName(SourceSystemFunctions.TAN);
return Arrays.asList(getLanguageFactory().createFunction(SourceSystemFunctions.DIVIDE_OP, new Expression[] {new Literal(1, TypeFacility.RUNTIME_TYPES.INTEGER), function}, TypeFacility.RUNTIME_TYPES.DOUBLE));
}
});
代码示例来源:origin: org.teiid.connectors/translator-mongodb
@Override
public List<?> translate(Function function) {
function.setName("$substr"); //$NON-NLS-1$
ArrayList<Expression> params = new ArrayList<Expression>();
params.add(function.getParameters().get(0));
// MongoDB is zero base index; Teiid is 1 based;
params.add(LanguageFactory.INSTANCE.createFunction("-", new Expression[] { function.getParameters().get(1),
LanguageFactory.INSTANCE.createLiteral(1, TypeFacility.RUNTIME_TYPES.INTEGER) },
TypeFacility.RUNTIME_TYPES.INTEGER));
if (function.getParameters().size() == 2) {
function.getParameters().add(LanguageFactory.INSTANCE.createLiteral(DataTypeManager.MAX_STRING_LENGTH,
TypeFacility.RUNTIME_TYPES.INTEGER));
}
params.add(function.getParameters().get(2));
function.getParameters().clear();
function.getParameters().addAll(params);
return null;
}
});
代码示例来源:origin: org.teiid.connectors/translator-odata
@Override
public List<?> translate(Function function) {
function.setName(SourceSystemFunctions.ADD_OP);
Expression param1 = function.getParameters().get(0);
Expression param2 = function.getParameters().get(1);
Function indexOf = new Function("indexof", Arrays.asList(param2, param1), TypeFacility.RUNTIME_TYPES.INTEGER); //$NON-NLS-1$
indexOf.setMetadataObject(function.getMetadataObject());
function.getParameters().set(0, indexOf);
function.getParameters().set(1, new Literal(1, TypeFacility.RUNTIME_TYPES.INTEGER));
return null;
}
});
代码示例来源:origin: org.teiid.connectors/translator-odata4
@Override
public List<?> translate(Function function) {
function.setName(SourceSystemFunctions.ADD_OP);
Expression param1 = function.getParameters().get(0);
Expression param2 = function.getParameters().get(1);
Function indexOf = new Function("indexof", Arrays.asList(param2, param1), TypeFacility.RUNTIME_TYPES.INTEGER); //$NON-NLS-1$
indexOf.setMetadataObject(function.getMetadataObject());
function.getParameters().set(0, indexOf);
function.getParameters().set(1, new Literal(1, TypeFacility.RUNTIME_TYPES.INTEGER));
return null;
}
});
代码示例来源:origin: org.teiid.connectors/translator-jdbc
@Override
public List<?> translate(Function function) {
function.setName("cast"); //$NON-NLS-1$
int targetCode = getCode(function.getType());
List<Expression> args = function.getParameters();
代码示例来源:origin: org.teiid.connectors/translator-jdbc
@Override
public List<?> translate(Function function) {
if (function.getParameters().get(0) instanceof ColumnReference) {
ColumnReference cr = (ColumnReference)function.getParameters().get(0);
String nativeType = cr.getMetadataObject().getNativeType();
if (nativeType != null
&& StringUtil.indexOfIgnoreCase(nativeType, "char") == -1) { //$NON-NLS-1$
Function cast = ConvertModifier.createConvertFunction(getLanguageFactory(), cr,
(StringUtil.startsWithIgnoreCase(nativeType.trim(), "n")?"n":"")+"varchar(max)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
cast.setName("cast"); //$NON-NLS-1$
function.getParameters().set(0, cast);
}
}
return super.translate(function);
}
}
代码示例来源:origin: org.teiid.connectors/translator-jdbc
private void addCast(String nativeType, DerivedColumn dc) {
if (nativeType != null) {
Function cast = ConvertModifier.createConvertFunction(getLanguageFactory(), dc.getExpression(), nativeType);
cast.setName("cast"); //$NON-NLS-1$
dc.setExpression(cast);
} else {
dc.setExpression(ConvertModifier.createConvertFunction(getLanguageFactory(), dc.getExpression(), TypeFacility.getDataTypeName(dc.getExpression().getType())));
}
}
内容来源于网络,如有侵权,请联系作者删除!