Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.

Commit 95db26f

Browse files
committed
moved converter to subpackage
1 parent 7bb226a commit 95db26f

7 files changed

Lines changed: 19 additions & 12 deletions

File tree

src/main/java/com/sybit/airtable/Airtable.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99

1010
import com.mashape.unirest.http.Unirest;
11+
import com.sybit.airtable.converter.ListConverter;
12+
import com.sybit.airtable.converter.MapConverter;
1113
import com.sybit.airtable.exception.AirtableException;
1214
import com.sybit.airtable.vo.Attachment;
1315
import com.sybit.airtable.vo.Thumbnail;

src/main/java/com/sybit/airtable/Base.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public Base(String base, Airtable airtable) {
5353
* Set Airtable object as parent.
5454
* @param parent the base Airtable object.
5555
*/
56-
protected void setParent(Airtable parent) {
56+
void setParent(Airtable parent) {
5757
this.parent = parent;
5858
}
5959

src/main/java/com/sybit/airtable/GsonObjectMapper.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* @author fzr
1717
*/
18-
class GsonObjectMapper implements ObjectMapper{
18+
class GsonObjectMapper implements ObjectMapper {
1919
private static final Logger LOG = Logger.getLogger( GsonObjectMapper.class.getName() );
2020
private final Gson gson;
2121

@@ -25,11 +25,12 @@ public GsonObjectMapper() {
2525
}
2626

2727
public <T> T readValue(String value, Class<T> valueType) {
28-
LOG.log(Level.INFO, "readValue: \n" + value);
28+
LOG.log(Level.FINE, "readValue: \n" + value);
2929
return gson.fromJson(value, valueType);
3030
}
3131

3232
public String writeValue(Object value) {
33+
LOG.log(Level.FINE, "writeValue: \n" + value);
3334
return gson.toJson(value);
3435
}
3536

src/main/java/com/sybit/airtable/Query.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ public interface Query {
2929
List<Sort> getSort();
3030

3131
/**
32+
* Define a filter formula.
3233
*
33-
* @return
34+
* @see https://support.airtable.com/hc/en-us/articles/203255215-Formula-Field-Reference
35+
* @return get the filter formula.
3436
*/
3537
String filterByFormula();
3638
}

src/main/java/com/sybit/airtable/Table.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public String filterByFormula() {
110110
* @throws HttpResponseException
111111
*/
112112
@SuppressWarnings("WeakerAccess")
113-
public List<T> select(Query query) throws AirtableException, HttpResponseException {
113+
public List<T> select(Query query) throws AirtableException {
114114
HttpResponse<Records> response;
115115
try {
116116
GetRequest request = Unirest.get(getTableEndpointUrl())
@@ -272,7 +272,7 @@ private List<T> getList(HttpResponse<Records> response) {
272272
* @return searched record.
273273
* @throws AirtableException
274274
*/
275-
public T find(String id) throws AirtableException, HttpResponseException {
275+
public T find(String id) throws AirtableException {
276276

277277
RecordItem body = null;
278278

@@ -423,7 +423,7 @@ private void setProperty(T retval, String key, Object value) throws IllegalAcces
423423
private String key2property(String key) {
424424

425425
if(key.contains(" ") || key.contains("-") ) {
426-
LOG.warn( "Annotate special characters using @SerializedName for property: [" + key + "]");
426+
LOG.warn( "Annotate columns having special characters by using @SerializedName for property: [" + key + "]");
427427
}
428428
String property = key.trim();
429429
property = property.substring(0,1).toLowerCase() + property.substring(1, property.length());

src/main/java/com/sybit/airtable/ListConverter.java renamed to src/main/java/com/sybit/airtable/converter/ListConverter.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
* To change this template file, choose Tools | Templates
44
* and open the template in the editor.
55
*/
6-
package com.sybit.airtable;
6+
package com.sybit.airtable.converter;
77

88
import com.google.gson.internal.LinkedTreeMap;
9+
import org.apache.commons.beanutils.BeanUtils;
10+
import org.apache.commons.beanutils.converters.AbstractConverter;
11+
912
import java.lang.reflect.InvocationTargetException;
1013
import java.util.ArrayList;
1114
import java.util.List;
12-
import org.apache.commons.beanutils.BeanUtils;
13-
import org.apache.commons.beanutils.converters.AbstractConverter;
1415

1516
/**
1617
*
@@ -99,7 +100,8 @@ protected <T> T convertToType(final Class<T> type, Object value) throws Instanti
99100
* @return A List
100101
*/
101102
private List toStringList(final Class type, final String value,List returnList) {
102-
103+
104+
//FIXME why this if?
103105
if (type.equals(String.class)) {
104106
returnList.add(String.valueOf(value));
105107
return returnList;

src/main/java/com/sybit/airtable/MapConverter.java renamed to src/main/java/com/sybit/airtable/converter/MapConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* To change this template file, choose Tools | Templates
44
* and open the template in the editor.
55
*/
6-
package com.sybit.airtable;
6+
package com.sybit.airtable.converter;
77

88
import com.google.gson.internal.LinkedTreeMap;
99
import com.sybit.airtable.vo.Thumbnail;

0 commit comments

Comments
 (0)