Java Code Examples for hudson.model.Descriptor#getDisplayName()
The following examples show how to use
hudson.model.Descriptor#getDisplayName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiBinding.java From credentials-binding-plugin with MIT License | 6 votes |
/** * Looks up the actual credentials. * @param build the build. * @return the credentials * @throws FileNotFoundException if the credentials could not be found (for convenience, rather than returning null) */ protected final @Nonnull C getCredentials(@Nonnull Run<?,?> build) throws IOException { IdCredentials cred = CredentialsProvider.findCredentialById(credentialsId, IdCredentials.class, build); if (cred==null) throw new CredentialNotFoundException("Could not find credentials entry with ID '" + credentialsId + "'"); if (type().isInstance(cred)) { CredentialsProvider.track(build, cred); return type().cast(cred); } Descriptor expected = Jenkins.getActiveInstance().getDescriptor(type()); throw new CredentialNotFoundException("Credentials '"+credentialsId+"' is of type '"+ cred.getDescriptor().getDisplayName()+"' where '"+ (expected!=null ? expected.getDisplayName() : type().getName())+ "' was expected"); }
Example 2
Source File: MacroTest.java From office-365-connector-plugin with Apache License 2.0 | 5 votes |
@Test public void getDisplayName_ReturnsName() { // given Descriptor<Macro> descriptor = new Macro.DescriptorImpl(); // when String name = descriptor.getDisplayName(); // then assertThat(name).isEqualTo("Macro"); }
Example 3
Source File: DataBoundConfigurator.java From configuration-as-code-plugin with MIT License | 4 votes |
public String getDisplayName() { final Descriptor descriptor = getDescriptor(); return descriptor != null ? descriptor.getDisplayName() : getName(); }