Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
259e5fee
Commit
259e5fee
authored
5 years ago
by
Benedict Wong
Committed by
android-build-merger
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Add message template support for checkStringNotEmpty" am:
0d0bfc92
am:
1c28a1aa
am:
270dc6ab
Change-Id: I210058d65ed329265bb5b2bb5371f0b8098eb4b3
parents
f2ddf99c
270dc6ab
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/java/com/android/internal/util/Preconditions.java
+18
-0
18 additions, 0 deletions
core/java/com/android/internal/util/Preconditions.java
with
18 additions
and
0 deletions
core/java/com/android/internal/util/Preconditions.java
+
18
−
0
View file @
259e5fee
...
...
@@ -101,6 +101,24 @@ public class Preconditions {
return
string
;
}
/**
* Ensures that an string reference passed as a parameter to the calling method is not empty.
*
* @param string an string reference
* @param messageTemplate a printf-style message template to use if the check fails; will be
* converted to a string using {@link String#format(String, Object...)}
* @param messageArgs arguments for {@code messageTemplate}
* @return the string reference that was validated
* @throws IllegalArgumentException if {@code string} is empty
*/
public
static
@NonNull
<
T
extends
CharSequence
>
T
checkStringNotEmpty
(
final
T
string
,
final
String
messageTemplate
,
final
Object
...
messageArgs
)
{
if
(
TextUtils
.
isEmpty
(
string
))
{
throw
new
IllegalArgumentException
(
String
.
format
(
messageTemplate
,
messageArgs
));
}
return
string
;
}
/**
* Ensures that an object reference passed as a parameter to the calling
* method is not null.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment