Optionally get an {@link Entity} from a {@link DatastoreReader}.

@param datastore  The reader to get from
@param key              The key to get
@return an optional containing the entity if it existed, empty otherwise.
167119
static Optional<Entity> getOpt(CheckedDatastoreReaderWriter datastore, Key key) throws IOException {
    return Optional.ofNullable(datastore.get(key));
  }
849043
private static org.hibernate.engine.spi.EntityKey getOptionalObjectKey(QueryParameters queryParameters, SharedSessionContractImplementor session) {
		final Object optionalObject = queryParameters.getOptionalObject();
		final Serializable optionalId = queryParameters.getOptionalId();
		final String optionalEntityName = queryParameters.getOptionalEntityName();

		if ( optionalObject != null && optionalEntityName != null ) {
			return session.generateEntityKey( optionalId, session.getEntityPersister( optionalEntityName, optionalObject ) );
		}
		else {
			return null;
		}
	}
234963
public DataStore getDataStore(final Collection<String> columns) {
        for (DataStore ds : dataBatches) {
            if (ds.hasColumns(columns)) {
                return ds;
            }
        }
        return null;
    }
1245548
@Override
	public Object retrieve(int handle) throws DataStoreException
    {
        if (SAFE_MODE) checkHandle(handle);
        return data[handle];
    }
1346759
@SuppressWarnings({ "unchecked", "rawtypes" })
    public Option<Adapter<V>> get(final K key) {
        return Option.ofNullable((Adapter) registered.get(key));
    }
775704
public Optional<DataDirEntry> maybeGetDataDirEntry(DataDirectoryKey key) {
		return Optional.fromNullable(dataDirectory.get(key));
	}
1112258
def get(self, key):
    '''
    '''
    value = self.cache_datastore.get(key)
    return value if value is not None else self.child_datastore.get(key)
941547
static List<DatastoreKey> toDatastoreKeys(List<Key> nativeKeys) {
    if (nativeKeys == null || nativeKeys.isEmpty()) {
      return new ArrayList<>(0);
    }
    List<DatastoreKey> datastoreKeys = new ArrayList<>(nativeKeys.size());
    for (Key nativeKey : nativeKeys) {
      datastoreKeys.add(new DefaultDatastoreKey(nativeKey));
    }
    return datastoreKeys;
  }
411936
public T getObject(String key) {
        if (this.objects.containsKey(key)) {
            return this.objects.get(key);
        }
        return null;
    }
380379
public Element toElement(final SalesforceDatastore datastore) {
        final Element ds = getDocument().createElement("salesforce-datastore");
        ds.setAttribute("name", datastore.getName());
        if (!Strings.isNullOrEmpty(datastore.getDescription())) {
            ds.setAttribute("description", datastore.getDescription());
        }

        appendElement(ds, "username", datastore.getUsername());
        appendElement(ds, "password", encodePassword(datastore.getPassword()));
        appendElement(ds, "security-token", datastore.getSecurityToken());

        final String endpointUrl = datastore.getEndpointUrl();
        if (!Strings.isNullOrEmpty(endpointUrl)) {
            appendElement(ds, "endpoint-url", endpointUrl);
        }

        return ds;
    }
615718
public Optional<Object> getData(Object key) {
        if (key == null) {
            throw new IllegalArgumentException("key cannot be null");
        }
        for (ContextData c = this; c != null; c = c.parent) {
            if (key.equals(c.key)) {
                return Optional.of(c.value);
            }
        }
        return Optional.empty();
    }
378658
public V get (int key)
    {
        Record<V> rec = getImpl(key);
        return (rec == null) ? null : rec.value;
    }
748688
@Override
    public synchronized void dropEntity(String entity) throws DatabaseEngineException {
        if (!containsEntity(entity)) {
            return;
        }

        dropEntity(entities.get(entity).getEntity());
    }
270648
public Element toElement(final DynamoDbDatastore datastore) {
        final Element ds = getDocument().createElement("dynamodb-datastore");
        ds.setAttribute("name", datastore.getName());
        if (!Strings.isNullOrEmpty(datastore.getDescription())) {
            ds.setAttribute("description", datastore.getDescription());
        }

        appendElement(ds, "region", datastore.getRegion());
        appendElement(ds, "accessKeyId", datastore.getAccessKeyId());
        appendElement(ds, "secretAccessKey", encodePassword(datastore.getSecretAccessKey()));
        return ds;
    }
660067
@Override
    public V get(Object key) {
        // Keys can not be null
        if (key == null) {
            throw new NullPointerException("Key can not be null");
        }
        if (!(key instanceof String)) {
            throw new ClassCastException("Only String keys are supported -- got " + key.getClass());
        }
        // Empty keys are stored in the root
        if (key.equals("")) {
            if (root.getRight() == null) {
                return null;
            } else {
                return root.getRight().getValue();
            }
        }

        // Find nearest node
        PatriciaNode<V> nearest = findNearestNode((String) key);

        // If the nearest node matches key, we have a match
        if (key.equals(nearest.getKey())) {
            return nearest.getValue();
        } else {
            return null;
        }
    }
459002
@SuppressWarnings("unchecked")
  public <Metadata> Optional<Metadata> get(MetadataKey<Metadata> key) {
    return Optional.ofNullable((Metadata) metadataMap.get(key));
  }
742181
public Entity javaToDatastore(Key parentKey, Object javaObject) {
		Key key = keyProperty.getValue(javaObject);
		Entity entity = key == null? new Entity(kind, parentKey) : new Entity(key); 
		for (Entry<String, PropertyMetadata<?, ?>> entry : properties.entrySet()) {
			PropertyMetadata property = entry.getValue();
			Object javaValue = property.getValue(javaObject);
			property.setEntityValue(entity, javaValue);
		}
		return entity;
	}