List of usage examples for com.google.common.base Optional fromNullable
public static <T> Optional<T> fromNullable(@Nullable T nullableReference)
From source file:com.github.autermann.wps.commons.description.ows.OwsCodeType.java
public Optional<String> getCodeSpace() { return Optional.fromNullable(this.codeSpace); }
From source file:org.dswarm.graph.rdf.nx.utils.NodeTypeUtils.java
public static Optional<NodeType> getNodeType(final Optional<Node> optionalNode, final Optional<Boolean> optionalIsType) { if (!optionalNode.isPresent()) { return Optional.absent(); }//from w ww . j av a 2 s .co m final NodeType nodeType; final Node node = optionalNode.get(); if (node instanceof BNode) { if (optionalIsType.isPresent()) { if (Boolean.FALSE.equals(optionalIsType.get())) { nodeType = NodeType.BNode; } else { nodeType = NodeType.TypeBNode; } } else { nodeType = NodeType.BNode; } } else if (node instanceof Literal) { nodeType = NodeType.Literal; } else if (node instanceof Resource) { if (optionalIsType.isPresent()) { if (Boolean.FALSE.equals(optionalIsType.get())) { nodeType = NodeType.Resource; } else { nodeType = NodeType.TypeResource; } } else { nodeType = NodeType.Resource; } } else { nodeType = null; } return Optional.fromNullable(nodeType); }
From source file:com.github.autermann.wps.commons.description.ows.OwsLanguageString.java
public Optional<String> getLang() { return Optional.fromNullable(this.lang); }
From source file:org.auraframework.impl.css.flavor.FlavorMappingImpl.java
@Override public Optional<DefDescriptor<FlavoredStyleDef>> getLocation(DefDescriptor<ComponentDef> component, String flavorName) {/*from w w w.j av a2 s.co m*/ return Optional.fromNullable(table.get(component, flavorName)); }
From source file:com.arpnetworking.clusteraggregator.partitioning.InMemoryPartitionSet.java
/** * {@inheritDoc}/* ww w . j a v a2 s .c o m*/ */ @Override public Optional<Integer> getExistingPartition(final String key) { return Optional.fromNullable(_mappings.get(key)); }
From source file:org.n52.shetland.aqd.EReportingChange.java
public void setDescription(String description) { this.description = Optional.fromNullable(description); }
From source file:io.crate.sql.tree.CopyFrom.java
public CopyFrom(Table table, Expression path, @Nullable GenericProperties genericProperties) { this.table = table; this.path = path; this.genericProperties = Optional.fromNullable(genericProperties); }
From source file:im.dadoo.teak.biz.bo.impl.DefaultCategoryBO.java
@Override public Optional<CategoryPO> insert(String name, String description) { CategoryPO categoryPO = this.categoryDAO.findByName(name); //????/*from w ww . jav a 2 s. c om*/ if (categoryPO == null) { logger.info(String.format("name{%s} unused", name)); categoryPO = new CategoryPO(); categoryPO.setName(name); categoryPO.setDescription(description); return Optional.fromNullable(this.categoryDAO.insert(categoryPO)); } else { logger.info(String.format("name{%s} used by category{%d}", name, categoryPO.getId())); return Optional.absent(); } }
From source file:io.crate.sql.tree.CreateBlobTable.java
public CreateBlobTable(Table name, @Nullable ClusteredBy clusteredBy, @Nullable GenericProperties properties) { this.name = name; this.clusteredBy = Optional.fromNullable(clusteredBy); this.genericProperties = Optional.fromNullable(properties); }
From source file:org.jclouds.azure.management.options.CreateHostedServiceOptions.java
/** * @see CreateHostedServiceOptions#getDescription() *///from w ww . j a v a 2 s. co m public CreateHostedServiceOptions description(String description) { this.description = Optional.fromNullable(description); return this; }