本文整理汇总了Java中com.holonplatform.core.datastore.relational.Aliasable.AliasablePath类的典型用法代码示例。如果您正苦于以下问题:Java AliasablePath类的具体用法?Java AliasablePath怎么用?Java AliasablePath使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AliasablePath类属于com.holonplatform.core.datastore.relational.Aliasable包,在下文中一共展示了AliasablePath类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTargetAlias
import com.holonplatform.core.datastore.relational.Aliasable.AliasablePath; //导入依赖的package包/类
@Override
public Optional<String> getTargetAlias(Path<?> path) {
if (path == null) {
// root alias
return (target != null) ? Optional.ofNullable(pathAlias.get(target.getName())) : Optional.empty();
}
// check Aliasable
if (AliasablePath.class.isAssignableFrom(path.getClass())) {
final AliasablePath<?, ?> ap = (AliasablePath<?, ?>) path;
if (ap.getAlias().isPresent()) {
return ap.getAlias();
}
}
String alias = pathAlias.get(path.fullName());
// check parent
if (alias == null && getParent().isPresent()) {
JpaResolutionContext ctx = getParent().get();
while (ctx != null) {
if (ctx.getAliasMode() != AliasMode.UNSUPPORTED) {
Optional<String> parentAlias = ctx.getTargetAlias(path);
if (parentAlias.isPresent()) {
alias = parentAlias.get();
break;
}
}
ctx = ctx.getParent().orElse(null);
}
}
return Optional.ofNullable(alias);
}
示例2: getOrCreatePathAlias
import com.holonplatform.core.datastore.relational.Aliasable.AliasablePath; //导入依赖的package包/类
private Optional<String> getOrCreatePathAlias(AliasablePath<?, ?> path) {
if (AliasMode.UNSUPPORTED != getAliasMode()) {
if (path != null) {
if (path.getAlias().isPresent()) {
return path.getAlias();
}
if (AliasMode.AUTO == getAliasMode()) {
// generate alias
return Optional.of(generateTargetAlias(path.getName()));
}
}
}
return Optional.empty();
}
示例3: getTargetAlias
import com.holonplatform.core.datastore.relational.Aliasable.AliasablePath; //导入依赖的package包/类
@Override
public Optional<String> getTargetAlias(Path<?> path) {
if (path == null) {
// root alias
return (target != null) ? Optional.ofNullable(pathAlias.get(target.getName())) : Optional.empty();
}
// check Aliasable
if (AliasablePath.class.isAssignableFrom(path.getClass())) {
final AliasablePath<?, ?> ap = (AliasablePath<?, ?>) path;
if (ap.getAlias().isPresent()) {
return ap.getAlias();
}
}
String alias = pathAlias.get(path.fullName());
// check parent
if (alias == null && getParent().isPresent()) {
JdbcResolutionContext ctx = getParent().get();
while (ctx != null) {
if (ctx.getAliasMode() != AliasMode.UNSUPPORTED) {
Optional<String> parentAlias = ctx.getTargetAlias(path);
if (parentAlias.isPresent()) {
alias = parentAlias.get();
break;
}
}
ctx = ctx.getParent().orElse(null);
}
}
return Optional.ofNullable(alias);
}
示例4: getOrCreatePathAlias
import com.holonplatform.core.datastore.relational.Aliasable.AliasablePath; //导入依赖的package包/类
/**
* Get the alias for given path, generating an alias name if no alias is defined and alias mode is
* {@link AliasMode#AUTO}.
* @param path Path for which to obtain the alias
* @return Path alias
*/
private Optional<String> getOrCreatePathAlias(AliasablePath<?, ?> path) {
if (AliasMode.UNSUPPORTED != getAliasMode()) {
if (path != null) {
if (path.getAlias().isPresent()) {
return path.getAlias();
}
if (AliasMode.AUTO == getAliasMode()) {
// generate alias
return Optional.of(generateTargetAlias(path.getName()));
}
}
}
return Optional.empty();
}