Author: gk Date: Tue Mar 10 11:55:47 2015 New Revision: 1665488 URL: http://svn.apache.org/r1665488 Log: Javadoc Updates and Fixes.
Modified: turbine/fulcrum/trunk/json/api/src/java/org/apache/fulcrum/json/JsonService.java turbine/fulcrum/trunk/json/jackson2/src/java/org/apache/fulcrum/json/jackson/Jackson2MapperService.java turbine/fulcrum/trunk/json/jackson2/src/java/org/apache/fulcrum/json/jackson/SimpleNameIntrospector.java turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/DefaultServiceTest.java Modified: turbine/fulcrum/trunk/json/api/src/java/org/apache/fulcrum/json/JsonService.java URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/api/src/java/org/apache/fulcrum/json/JsonService.java?rev=1665488&r1=1665487&r2=1665488&view=diff ============================================================================== --- turbine/fulcrum/trunk/json/api/src/java/org/apache/fulcrum/json/JsonService.java (original) +++ turbine/fulcrum/trunk/json/api/src/java/org/apache/fulcrum/json/JsonService.java Tue Mar 10 11:55:47 2015 @@ -23,12 +23,12 @@ import java.text.DateFormat; import java.util.Collection; /** - * This class defines methods needed to serialize and deserialize and helper - * methos if needed. + * This class defines custom methods needed to serialize and deserialize and helper + * methods if needed. * * Some methods expect a class parameter. * - * If you want to call theses methods from an environment, where you could only + * If you want to call these methods from an environment, where you could only * provide strings (e.g. velocity context), just wrap the method and call * <code>Class clazz = Class.forName(className);</code> for the parameter. * @@ -137,7 +137,7 @@ public interface JsonService { * the class to which the filtering should be applied * * @param cleanFilter - * the Boolean value, not null If it is <code>true</code>, cleans cache and the custom filter after serialization. + * the Boolean value, not null. If it is <code>true</code>, cleans cache and the custom filter after serialization. * * @param filterAttr * the class bean attributes which should be serialized @@ -160,7 +160,7 @@ public interface JsonService { * same class, just the filterAttributes get applied. If not the * class is filtered out, if found as a property type. * @param cleanFilter - * clean filter (clean cache and custom filter for this filterClass) after serialization. + * if <code>true </code> cleans filter (clean cache and custom filter for this filterClass) after serialization. * * @param filterAttr * the bean attributes which should not be serialized Modified: turbine/fulcrum/trunk/json/jackson2/src/java/org/apache/fulcrum/json/jackson/Jackson2MapperService.java URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/java/org/apache/fulcrum/json/jackson/Jackson2MapperService.java?rev=1665488&r1=1665487&r2=1665488&view=diff ============================================================================== --- turbine/fulcrum/trunk/json/jackson2/src/java/org/apache/fulcrum/json/jackson/Jackson2MapperService.java (original) +++ turbine/fulcrum/trunk/json/jackson2/src/java/org/apache/fulcrum/json/jackson/Jackson2MapperService.java Tue Mar 10 11:55:47 2015 @@ -72,10 +72,11 @@ import com.fasterxml.jackson.databind.se * not supported (e.g filter + mixin or default + filter for the same bean / * object). * - * Note: If using {@link SimpleNameIntrospector}, filters are set by class id, which are cached by default. - * By setting {@link #cacheFilters} to <code>false</code> each filter will be unregistered and the cache cleaned. - * By setting the Boolean parameter clean {@link #filter(Object, Class, PropertyFilter, Boolean, String...)} - * you could filter a class differently for each call. + * By default a filter is defined by its {@link Class#getName()}. + * + * Note: If using {@link SimpleNameIntrospector}, filter caches are set by class id. Caching is enabled by default, if not (a) by setting {@link #cacheFilters} to <code>false</code>. + * By setting (b) the Boolean parameter clean {@link #serializeAllExceptFilter(Object, Class, Boolean, String...)} or {@link #serializeOnlyFilter(Object, Class, Boolean, String...)} + * you could clean the filter. If caching is disabled each filter will be unregistered and the cache cleaned. * * @author <a href="mailto:g...@apache.org">Georg Kallidis</a> * @version $Id$ @@ -100,7 +101,10 @@ public class Jackson2MapperService exten private Map<String, FilterProvider> filters; private String dateFormat; - final String DEFAULTDATEFORMAT = "MM/dd/yyyy"; + /** + * Default dateformat is <code>MM/dd/yyyy</code>, could be overwritten in {@link #setDateFormat(DateFormat)}. + */ + public final String DEFAULTDATEFORMAT = "MM/dd/yyyy"; final boolean defaultType = false; public boolean cacheFilters = true; // true -> this is by default true in jackson, if not using @@ -465,6 +469,9 @@ public class Jackson2MapperService exten module.addDeserializer(type, deSer); } + /** + * Defalut Dateformt: {@link #DEFAULTDATEFORMAT} + */ @Override public void setDateFormat(final DateFormat df) { mapper.setDateFormat(df); Modified: turbine/fulcrum/trunk/json/jackson2/src/java/org/apache/fulcrum/json/jackson/SimpleNameIntrospector.java URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/java/org/apache/fulcrum/json/jackson/SimpleNameIntrospector.java?rev=1665488&r1=1665487&r2=1665488&view=diff ============================================================================== --- turbine/fulcrum/trunk/json/jackson2/src/java/org/apache/fulcrum/json/jackson/SimpleNameIntrospector.java (original) +++ turbine/fulcrum/trunk/json/jackson2/src/java/org/apache/fulcrum/json/jackson/SimpleNameIntrospector.java Tue Mar 10 11:55:47 2015 @@ -24,7 +24,6 @@ import java.util.concurrent.CopyOnWriteA import com.fasterxml.jackson.databind.introspect.Annotated; import com.fasterxml.jackson.databind.introspect.AnnotatedClass; -import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; import com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector; import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; @@ -47,7 +46,7 @@ public class SimpleNameIntrospector exte public List<String> externalFilterExcludeClasses = new CopyOnWriteArrayList<String>(); /** - * Filtering on method types + * Filtering on method types, cft. @link * */ @Override Modified: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/DefaultServiceTest.java URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/DefaultServiceTest.java?rev=1665488&r1=1665487&r2=1665488&view=diff ============================================================================== --- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/DefaultServiceTest.java (original) +++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/DefaultServiceTest.java Tue Mar 10 11:55:47 2015 @@ -104,7 +104,8 @@ public class DefaultServiceTest extends } public void testSerializeDate() throws Exception { - final SimpleDateFormat MMddyyyy = new SimpleDateFormat("MM/dd/yyyy"); + // non default date format + final SimpleDateFormat MMddyyyy = new SimpleDateFormat("MM-dd-yyyy"); Map<String, Object> map = new HashMap<String, Object>(); map.put("date", Calendar.getInstance().getTime()); @@ -112,7 +113,7 @@ public class DefaultServiceTest extends String serJson = sc.ser(map); System.out.println("serJson:" + serJson); assertTrue("Serialize with Adapater failed ", - serJson.matches("\\{\"date\":\"\\d\\d/\\d\\d/\\d{4}\"\\}")); + serJson.matches("\\{\"date\":\"\\d\\d-\\d\\d-\\d{4}\"\\}")); } // jackson serializes size too