本文整理汇总了Java中edu.umd.cs.findbugs.annotations.Nullable类的典型用法代码示例。如果您正苦于以下问题:Java Nullable类的具体用法?Java Nullable怎么用?Java Nullable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Nullable类属于edu.umd.cs.findbugs.annotations包,在下文中一共展示了Nullable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readFromProcess
import edu.umd.cs.findbugs.annotations.Nullable; //导入依赖的package包/类
/**
* Executes a command and reads the result to a string. It uses the launcher to run the command to make sure the
* launcher decorator is used ie. docker.image step
*
* @param args command arguments
* @return output from the command
* @throws InterruptedException if interrupted
*/
@Nullable
private String readFromProcess(String... args) throws InterruptedException {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
ProcStarter ps = launcher.launch();
Proc p = launcher.launch(ps.cmds(args).stdout(baos));
int exitCode = p.join();
if (exitCode == 0) {
return baos.toString(getComputer().getDefaultCharset().name()).replaceAll("[\t\r\n]+", " ").trim();
} else {
return null;
}
} catch (IOException e) {
e.printStackTrace(console.format("Error executing command '%s' : %s%n", Arrays.toString(args), e.getMessage()));
}
return null;
}
示例2: setupMavenLocalRepo
import edu.umd.cs.findbugs.annotations.Nullable; //导入依赖的package包/类
/**
* Sets the maven repo location according to the provided parameter on the agent
*
* @return path on the build agent to the repo or {@code null} if not defined
* @throws InterruptedException when processing remote calls
* @throws IOException when reading files
*/
@Nullable
private String setupMavenLocalRepo() throws IOException, InterruptedException {
String expandedMavenLocalRepo;
if (StringUtils.isEmpty(step.getMavenLocalRepo())) {
expandedMavenLocalRepo = null;
} else {
// resolve relative/absolute with workspace as base
String expandedPath = envOverride.expand(env.expand(step.getMavenLocalRepo()));
FilePath repoPath = new FilePath(ws, expandedPath);
repoPath.mkdirs();
expandedMavenLocalRepo = repoPath.getRemote();
}
LOGGER.log(Level.FINEST, "setupMavenLocalRepo({0}): {1}", new Object[]{step.getMavenLocalRepo(), expandedMavenLocalRepo});
return expandedMavenLocalRepo;
}
示例3: apply
import edu.umd.cs.findbugs.annotations.Nullable; //导入依赖的package包/类
@Override
public String apply(@javax.annotation.Nullable Credentials credentials) {
if (credentials == null)
return "null";
String result = ClassUtils.getShortName(credentials.getClass()) + "[";
if (credentials instanceof IdCredentials) {
IdCredentials idCredentials = (IdCredentials) credentials;
result += "id: " + idCredentials.getId() + ",";
}
if (credentials instanceof UsernameCredentials) {
UsernameCredentials usernameCredentials = (UsernameCredentials) credentials;
result += "username: " + usernameCredentials.getUsername() + "";
}
result += "]";
return result;
}
示例4: getStrokePaint
import edu.umd.cs.findbugs.annotations.Nullable; //导入依赖的package包/类
/**
* Gets the stroke paint for the specified figure based on the attributes
* STROKE_GRADIENT, STROKE_OPACITY, STROKE_PAINT and the bounds of the figure.
* Returns null if the figure is not filled.
*/
@Nullable
public static Paint getStrokePaint(Figure f) {
double opacity = f.get(STROKE_OPACITY);
if (f.get(STROKE_GRADIENT) != null) {
return f.get(STROKE_GRADIENT).getPaint(f, opacity);
}
Color color = f.get(STROKE_COLOR);
if (color != null) {
if (opacity != 1) {
color = new Color(
(color.getRGB() & 0xffffff) | (int) (opacity * 255) << 24,
true);
}
}
return color;
}
示例5: setEditor
import edu.umd.cs.findbugs.annotations.Nullable; //导入依赖的package包/类
public void setEditor(@Nullable DrawingEditor editor) {
if (this.editor != null) {
this.removePropertyChangeListener(getEventHandler());
for (Disposable d : disposables) {
d.dispose();
}
disposables.clear();
}
this.editor = editor;
if (editor != null) {
init();
clearDisclosedComponents();
setDisclosureState(Math.max(0, Math.min(getDisclosureStateCount(), prefs.getInt(getID() + ".disclosureState", getDefaultDisclosureState()))));
this.addPropertyChangeListener(getEventHandler());
}
}
示例6: addClipboardItems
import edu.umd.cs.findbugs.annotations.Nullable; //导入依赖的package包/类
/** Adds items for the following actions to the menu:
* <ul>
* <li>{@link CutAction}</li>
* <li>{@link CopyAction}</li>
* <li>{@link PasteAction}</li>
* <li>{@link DuplicateAction}</li>
* <li>{@link DeleteAction}</li>
* </ul>
*/
@Override
public void addClipboardItems(JMenu m, Application app, @Nullable View v) {
ActionMap am = app.getActionMap(v);
Action a;
if (null != (a = am.get(CutAction.ID))) {
add(m,a);
}
if (null != (a = am.get(CopyAction.ID))) {
add(m,a);
}
if (null != (a = am.get(PasteAction.ID))) {
add(m,a);
}
if (null != (a = am.get(DuplicateAction.ID))) {
add(m,a);
}
if (null != (a = am.get(DeleteAction.ID))) {
add(m,a);
}
}
示例7: DefaultAttributeAction
import edu.umd.cs.findbugs.annotations.Nullable; //导入依赖的package包/类
public DefaultAttributeAction(DrawingEditor editor,
AttributeKey[] keys, @Nullable String name, @Nullable Icon icon,
@Nullable Map<AttributeKey, Object> fixedAttributes) {
super(editor);
this.keys = keys.clone();
putValue(AbstractAction.NAME, name);
putValue(AbstractAction.SMALL_ICON, icon);
setEnabled(true);
editor.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals(DefaultAttributeAction.this.keys[0].getKey())) {
putValue("attribute_" + DefaultAttributeAction.this.keys[0].getKey(), evt.getNewValue());
}
}
});
this.fixedAttributes = fixedAttributes;
updateEnabledState();
}
示例8: createMenuBuilder
import edu.umd.cs.findbugs.annotations.Nullable; //导入依赖的package包/类
/** Creates the MenuBuilder. */
@Override
protected MenuBuilder createMenuBuilder() {
return new DefaultMenuBuilder() {
@Override
public void addOtherViewItems(JMenu m, Application app, @Nullable View v) {
ActionMap am = app.getActionMap(v);
JCheckBoxMenuItem cbmi;
cbmi = new JCheckBoxMenuItem(am.get("view.toggleGrid"));
ActionUtil.configureJCheckBoxMenuItem(cbmi, am.get("view.toggleGrid"));
m.add(cbmi);
JMenu m2 = new JMenu("Zoom");
for (double sf : scaleFactors) {
String id = (int) (sf * 100) + "%";
cbmi = new JCheckBoxMenuItem(am.get(id));
ActionUtil.configureJCheckBoxMenuItem(cbmi, am.get(id));
m2.add(cbmi);
}
m.add(m2);
}
};
}
示例9: createEditMenu
import edu.umd.cs.findbugs.annotations.Nullable; //导入依赖的package包/类
@Override
@Nullable
public JMenu createEditMenu(View view) {
JMenu m;
JMenuItem mi;
Action a;
m = new JMenu();
labels.configureMenu(m, "edit");
MenuBuilder mb = model.getMenuBuilder();
mb.addUndoItems(m, this, view);
maybeAddSeparator(m);
mb.addClipboardItems(m, this, view);
maybeAddSeparator(m);
mb.addSelectionItems(m, this, view);
maybeAddSeparator(m);
mb.addFindItems(m, this, view);
maybeAddSeparator(m);
mb.addOtherEditItems(m, this, view);
maybeAddSeparator(m);
mb.addPreferencesItems(m, this, view);
removeTrailingSeparators(m);
return (m.getItemCount() == 0) ? null : m;
}
示例10: parseIconHref
import edu.umd.cs.findbugs.annotations.Nullable; //导入依赖的package包/类
/**
* Get the href property from the Icon element.
*
* @param qname the qualified name of this event
* @return the href, <code>null</code> if not found.
* @throws XMLStreamException if there is an error with the underlying XML.
*/
@Nullable
private String parseIconHref(QName qname) throws XMLStreamException {
String href = null;
while (true) {
XMLEvent e = stream.nextEvent();
if (foundEndTag(e, qname)) { // also checks e == null
return href;
}
if (e.getEventType() == XMLStreamConstants.START_ELEMENT) {
StartElement se = e.asStartElement();
String name = se.getName().getLocalPart();
if (name.equals(HREF)) {
href = getNonEmptyElementText();
}
}
}
}
示例11: FocusWindowAction
import edu.umd.cs.findbugs.annotations.Nullable; //导入依赖的package包/类
/** Creates a new instance. */
public FocusWindowAction(@Nullable View view) {
this.view = view;
ResourceBundleUtil labels = ResourceBundleUtil.getBundle("org.jhotdraw.app.Labels");
labels.configureAction(this, ID);
//setEnabled(false);
setEnabled(view != null);
ppc = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
String name = evt.getPropertyName();
if (name.equals(View.TITLE_PROPERTY)) {
putValue(Action.NAME, evt.getNewValue());
}
}
};
if (view != null) {
view.addPropertyChangeListener(ppc);
}
}
示例12: KvantumPlayer
import edu.umd.cs.findbugs.annotations.Nullable; //导入依赖的package包/类
/**
* Kvantum constructor
*
* @param username nullable player username
* @param uuid nullable player uuid
* @param world nullable player world
*/
@KvantumConstructor
public KvantumPlayer(@Nullable @KvantumInsert( "username" ) final String username,
@Nullable @KvantumInsert( "uuid") final String uuid,
@Nullable @KvantumInsert( "world" ) final String world)
{
this.username = username;
this.uuid = uuid;
this.world = world;
this.complete = false;
}
示例13: AwsBucketCredentialsBinding
import edu.umd.cs.findbugs.annotations.Nullable; //导入依赖的package包/类
/**
* For use with {@link DataBoundConstructor}.
*
* @param credentialsId
*/
@DataBoundConstructor
public AwsBucketCredentialsBinding(@Nullable String usernameVariable, @Nullable String passwordVariable,
String credentialsId) {
super(credentialsId);
this.usernameVariable = StringUtils.defaultIfBlank(usernameVariable, DEFAULT_USERNAME_VARIABLE);
this.passwordVariable = StringUtils.defaultIfBlank(passwordVariable, DEFAULT_PASSWORD_VARIABLE);
}
示例14: saveSequenceFileSequences
import edu.umd.cs.findbugs.annotations.Nullable; //导入依赖的package包/类
/**
* Save a {@code JavaRDD<List<List<Writable>>>} to a Hadoop {@link org.apache.hadoop.io.SequenceFile}. Each record
* is given a unique (but noncontiguous) {@link LongWritable} key, and values are stored as {@link SequenceRecordWritable} instances.
* <p>
* Use {@link #restoreSequenceFileSequences(String, JavaSparkContext)} to restore values saved with this method.
*
* @param path Path to save the sequence file
* @param rdd RDD to save
* @param maxOutputFiles Nullable. If non-null: first coalesce the RDD to the specified size (number of partitions)
* to limit the maximum number of output sequence files
* @see #saveSequenceFile(String, JavaRDD)
* @see #saveMapFileSequences(String, JavaRDD)
*/
public static void saveSequenceFileSequences(String path, JavaRDD<List<List<Writable>>> rdd,
@Nullable Integer maxOutputFiles) {
path = FilenameUtils.normalize(path, true);
if (maxOutputFiles != null) {
rdd = rdd.coalesce(maxOutputFiles);
}
JavaPairRDD<List<List<Writable>>, Long> dataIndexPairs = rdd.zipWithUniqueId(); //Note: Long values are unique + NOT contiguous; more efficient than zipWithIndex
JavaPairRDD<LongWritable, SequenceRecordWritable> keyedByIndex =
dataIndexPairs.mapToPair(new SequenceRecordSavePrepPairFunction());
keyedByIndex.saveAsNewAPIHadoopFile(path, LongWritable.class, SequenceRecordWritable.class,
SequenceFileOutputFormat.class);
}
示例15: rotateScheme
import edu.umd.cs.findbugs.annotations.Nullable; //导入依赖的package包/类
public static final RotateScheme.Enum rotateScheme(@Nullable String name) {
if (name == null)
return null;
switch (name) {
case "date":
return RotateScheme.Enum.DATE;
case "sequence":
return RotateScheme.Enum.SEQUENCE;
default:
throw new IllegalArgumentException("Invalid rotation scheme " + name);
}
}