Skip to content

Instantly share code, notes, and snippets.

@MrFincher
MrFincher / reflection-explode.java
Created May 2, 2019 15:37
automated explode() for sebi-daos mapper using reflection
@Override
public Object[] explode( E e ) {
List<Field> fields = Arrays.asList(entityType.getDeclaredFields());
Object[] parts = new Object[fields.size()];
for (int i = 0; i < parts.length; i++) {
try {
Field field = fields.get(i);
field.setAccessible(true);
parts[i] = field.get(e);
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE LambdaCase #-}
import Control.Monad.State
import Control.Monad.Extra
import Control.Lens
import Text.Read (readMaybe)
import Data.Char
import Data.Maybe
data Column v = Column String
data Table columnRow = Table {name :: String, columns :: Record columnRow}
data Select tableColumns selectedColumns = Select
(Record tableColumns -> Record selectedColumns)
(Table tableColumns)
data ToStr = ToStr
fun loadData() {
// this is the url where we want to get our data
// Note: 10.0.2.2 is for the Android -emulator, it redirects to your computers localhost!
val JSON_URL = "https://jsonplaceholder.typicode.com/todos/"
// Request a string response from the provided URL.
val stringRequest: StringRequest = object : StringRequest(
Request.Method.GET, JSON_URL,
Response.Listener { response ->