Added methods to Entities to get a name from a profile
This commit is contained in:
parent
1864e69c6b
commit
ac7eba9e06
1 changed files with 11 additions and 0 deletions
|
@ -1,5 +1,8 @@
|
||||||
package com.moandjiezana.tent.essayist.tent;
|
package com.moandjiezana.tent.essayist.tent;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import com.moandjiezana.tent.client.users.Profile;
|
||||||
|
|
||||||
public class Entities {
|
public class Entities {
|
||||||
|
|
||||||
public static String getForUrl(String entity) {
|
public static String getForUrl(String entity) {
|
||||||
|
@ -26,4 +29,12 @@ public class Entities {
|
||||||
|
|
||||||
return expandedEntity;
|
return expandedEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getName(Profile profile) {
|
||||||
|
return getName(profile, profile.getCore().getEntity());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getName(Profile profile, String fallback) {
|
||||||
|
return profile.getBasic() != null && !Strings.isNullOrEmpty(profile.getBasic().getName()) ? profile.getBasic().getName() : fallback;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue