本文整理汇总了Java中org.hashids.Hashids类的典型用法代码示例。如果您正苦于以下问题:Java Hashids类的具体用法?Java Hashids怎么用?Java Hashids使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Hashids类属于org.hashids包,在下文中一共展示了Hashids类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDeploymentId
import org.hashids.Hashids; //导入依赖的package包/类
protected String createDeploymentId(AppDeploymentRequest request) {
String name = request.getDefinition().getName();
Hashids hashids = new Hashids(name, 0, "abcdefghijklmnopqrstuvwxyz1234567890");
String hashid = hashids.encode(System.currentTimeMillis());
String deploymentId = name + "-" + hashid;
// Kubernetes does not allow . in the name and does not allow uppercase in the name
return deploymentId.replace('.', '-').toLowerCase();
}
示例2: uniqueShortId
import org.hashids.Hashids; //导入依赖的package包/类
/**
* Generate a short unique ID.
*/
public static String uniqueShortId() {
Hashids hashids = new Hashids(randomUUID().toString());
return hashids.encode(System.currentTimeMillis());
}
示例3: getHashidFromId
import org.hashids.Hashids; //导入依赖的package包/类
@Transient
public static String getHashidFromId(Long id) {
Hashids hashids = new Hashids(SALT);
return hashids.encode(id);
}
示例4: getIdFromHashid
import org.hashids.Hashids; //导入依赖的package包/类
@Transient
public static Long getIdFromHashid(String hashid) {
Hashids hashids = new Hashids(SALT);
return hashids.decode(hashid)[0];
}
示例5: createDeploymentId
import org.hashids.Hashids; //导入依赖的package包/类
protected String createDeploymentId(AppDeploymentRequest request) {
String name = request.getDefinition().getName();
Hashids hashids = new Hashids(name);
String hashid = hashids.encode(System.currentTimeMillis());
return name + "-" + hashid;
}
示例6: HashIdObfuscator
import org.hashids.Hashids; //导入依赖的package包/类
public HashIdObfuscator(Hashids hashids) {
this.hashids = hashids;
}
示例7: setUpObfuscator
import org.hashids.Hashids; //导入依赖的package包/类
@Before
public void setUpObfuscator() {
sut = new HashIdObfuscator( new Hashids() );
}
示例8: invitationCodeHashIds
import org.hashids.Hashids; //导入依赖的package包/类
@Bean
@ConditionalOnProperty(name = "admin.signupInvitation", havingValue = "true")
public Hashids invitationCodeHashIds(AdminProperties adminProperties) {
Hashids hashids = new Hashids(adminProperties.getInvitationSeed(), 20);
return hashids;
}