List of usage examples for com.google.common.base Optional absent
public static <T> Optional<T> absent()
From source file:org.impressivecode.depress.matcher.syntacticanalysis.Configuration.java
public Configuration(final SettingsModelString regExpKeywords, final SettingsModelString keywords, final SettingsModelString onlyIds) { if (emptyToNull(regExpKeywords.getStringValue()) != null) { this.keywordsRegexp = Optional.of(Pattern.compile(regExpKeywords.getStringValue())); } else {/*from w ww. j a v a2 s. c o m*/ this.keywordsRegexp = Optional.absent(); } if (emptyToNull(keywords.getStringValue()) != null) { Set<String> set = Sets.newHashSet(keywords.getStringValue().split(",")); this.keywords = Optional.of(set); } else { this.keywords = Optional.absent(); } if (emptyToNull(onlyIds.getStringValue()) != null) { this.onlyNumbers = Optional.of(Pattern.compile(onlyIds.getStringValue(), Pattern.MULTILINE)); } else { this.onlyNumbers = Optional.absent(); } }
From source file:org.opendaylight.controller.cluster.datastore.persisted.DeletedDataTreeCandidateNode.java
@Override public final Optional<NormalizedNode<?, ?>> getDataAfter() { return Optional.absent(); }
From source file:org.opendaylight.yangtools.yang.data.operations.LeafNodeModification.java
@Override public Optional<LeafNode<?>> modify(LeafSchemaNode schema, Optional<LeafNode<?>> actualNode, Optional<LeafNode<?>> modificationNode, OperationStack operationStack) throws DataModificationException { operationStack.enteringNode(modificationNode); Optional<LeafNode<?>> result; // Returns either actual node, modification node or empty in case of removal switch (operationStack.getCurrentOperation()) { case MERGE: { result = modificationNode.isPresent() ? modificationNode : actualNode; break;/* w w w . j a v a 2 s . c o m*/ } case CREATE: { DataModificationException.DataExistsException.check(schema.getQName(), actualNode, null); } case REPLACE: { result = modificationNode; break; } case DELETE: { DataModificationException.DataMissingException.check(schema.getQName(), actualNode); } case REMOVE: { result = Optional.absent(); break; } case NONE: { result = actualNode; break; } default: throw new UnsupportedOperationException(String.format("Unable to perform operation: %s on: %s, unknown", operationStack.getCurrentOperation(), schema)); } operationStack.exitingNode(modificationNode); return result; }
From source file:io.crate.sql.tree.CreateSnapshot.java
public CreateSnapshot(QualifiedName name, @Nullable GenericProperties genericProperties) { this.name = name; this.properties = Optional.fromNullable(genericProperties); this.tableList = Optional.absent(); }
From source file:org.eclipse.buildship.ui.view.task.TaskNodeSelectionUtils.java
/** * Tries to map the given selection to a Gradle run configuration. * * @param selection the selection to map * @return the mapped run configuration, if possible *//*from ww w .j av a2 s . c o m*/ public static Optional<GradleRunConfigurationAttributes> tryGetRunConfigurationAttributes( NodeSelection selection) { if (isValidRunConfiguration(selection)) { return Optional.of(getRunConfigurationAttributes(selection)); } else { return Optional.absent(); } }
From source file:io.crate.sql.tree.RestoreSnapshot.java
public RestoreSnapshot(QualifiedName name, @Nullable GenericProperties genericProperties) { this.name = name; this.properties = Optional.fromNullable(genericProperties); this.tableList = Optional.absent(); }
From source file:com.facebook.buck.apple.xcode.xcodeproj.PBXBuildFile.java
public PBXBuildFile(PBXReference fileRef) { this.fileRef = Preconditions.checkNotNull(fileRef); this.settings = Optional.absent(); }
From source file:com.tinspx.util.base.Base.java
/** * Attempts to parse the integer if is an Integer, Number, or CharSequence *///from w w w.j av a 2 s . c o m public static Optional<Integer> parseInt(@Nullable Object o) { if (o instanceof Integer) { return Optional.of((Integer) o); } else if (o instanceof Number) { return Optional.of(((Number) o).intValue()); } else if (o instanceof CharSequence) { return Optional.fromNullable(Ints.tryParse(o.toString())); } else { return Optional.absent(); } }
From source file:se.sics.ktoolbox.croupier.behaviour.CroupierObserver.java
@Override public Optional<View> getView() { return Optional.absent(); }
From source file:com.dowdandassociates.gentoo.bootstrap.JSchProvider.java
public Optional<JSch> get() { log.info("Get JSch"); try {//from w w w . j a va2 s . c o m JSch jsch = new JSch(); jsch.addIdentity(keyPair.getFilename()); return Optional.of(jsch); } catch (JSchException jse) { log.error(jse.getMessage(), jse); return Optional.absent(); } }