Skip to content

Commit

Permalink
Merge pull request #251 from kasramp/master
Browse files Browse the repository at this point in the history
Minor clean up
  • Loading branch information
elaatifi authored Dec 19, 2017
2 parents 1040957 + a048c18 commit 8397520
Show file tree
Hide file tree
Showing 26 changed files with 78 additions and 112 deletions.
12 changes: 6 additions & 6 deletions core/src/main/java/ma/glasnost/orika/BoundMapperFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,28 +80,28 @@ public interface BoundMapperFacade<A, B> extends MappedTypePair<A, B> {
* Maps properties (in place) from the instance of 'A' to the provided
* instance of 'B'
*
* @param source
* @param instanceA
* @param instanceB
* @param context
* @param destination
*/
B map(A instanceA, B instanceB, MappingContext context);

/**
* Maps properties (in place) from the instance of 'B' to the provided
* instance of 'A'
*
* @param destination
* @param source
* @param instanceB
* @param instanceA
*/
A mapReverse(B instanceB, A instanceA);

/**
* Maps properties (in place) from the instance of 'B' to the provided
* instance of 'A'
*
* @param destination
* @param instanceB
* @param instanceA
* @param context
* @param source
*/
A mapReverse(B instanceB, A instanceA, MappingContext context);

Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/ma/glasnost/orika/DefaultFieldMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@ public interface DefaultFieldMapper {
* @return a suggested optional mapping name for the given property,
* or <code>null</code> if no suggestion for the given property
*/
public String suggestMappedField(String fromProperty, Type<?> fromPropertyType);

String suggestMappedField(String fromProperty, Type<?> fromPropertyType);
}
12 changes: 6 additions & 6 deletions core/src/main/java/ma/glasnost/orika/Filter.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public interface Filter<A, B> extends MappedTypePair<A, B> {
* the destination property
* @return true if this Filter applies
*/
public boolean appliesTo(Property source, Property destination);
boolean appliesTo(Property source, Property destination);

/**
* Called at code generation time to determine whether this filter modifies
Expand All @@ -55,7 +55,7 @@ public interface Filter<A, B> extends MappedTypePair<A, B> {
* @return true if this Filter should be called to filter the source value
* the mapping results
*/
public boolean filtersSource();
boolean filtersSource();

/**
* Called at code generation time to determine whether this filter modifies
Expand All @@ -68,7 +68,7 @@ public interface Filter<A, B> extends MappedTypePair<A, B> {
* @return true if this Filter should be called to filter the destination of
* the mapping results
*/
public boolean filtersDestination();
boolean filtersDestination();

/**
* This method is called at runtime to determine whether the mapping implied
Expand All @@ -91,7 +91,7 @@ public interface Filter<A, B> extends MappedTypePair<A, B> {
* the current mapping context
* @return true if the fields represented by these types and names
*/
public <S extends A, D extends B> boolean shouldMap(Type<S> sourceType, String sourceName, S source, Type<D> destType, String destName,
<S extends A, D extends B> boolean shouldMap(Type<S> sourceType, String sourceName, S source, Type<D> destType, String destName,
D dest, MappingContext mappingContext);

/**
Expand All @@ -116,7 +116,7 @@ public <S extends A, D extends B> boolean shouldMap(Type<S> sourceType, String s
* the current mapping context
* @return the filtered output value
*/
public <D extends B> D filterDestination(D destinationValue, Type<?> sourceType, String sourceName, Type<D> destType, String destName,
<D extends B> D filterDestination(D destinationValue, Type<?> sourceType, String sourceName, Type<D> destType, String destName,
MappingContext mappingContext);

/**
Expand All @@ -142,7 +142,7 @@ public <D extends B> D filterDestination(D destinationValue, Type<?> sourceType,
* the current mapping context
* @return the filtered output value
*/
public <S extends A> S filterSource(S sourceValue, Type<S> sourceType, String sourceName, Type<?> destType, String destName,
<S extends A> S filterSource(S sourceValue, Type<S> sourceType, String sourceName, Type<?> destType, String destName,
MappingContext mappingContext);

}
4 changes: 0 additions & 4 deletions core/src/main/java/ma/glasnost/orika/MapperFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,6 @@ public interface MapperFacade {
* the Array from which to map
* @param destinationClass
* the type of elements to be contained in the returned Set.
* @param context
* the context from the current mapping request
* @return a new Array containing elements of type
* <code>destinationClass</code> mapped from the elements of
* <code>source</code>.
Expand Down Expand Up @@ -494,7 +492,6 @@ public interface MapperFacade {
* the type of the source elements
* @param destinationType
* the type of the new object to return
* @param context
* the current mapping context
* @return a new List containing elements of type
* <code>destinationType</code> mapped from the elements of
Expand Down Expand Up @@ -583,7 +580,6 @@ public interface MapperFacade {
* the type of the source elements
* @param destinationType
* the type of the new object to return
* @param context
* the current mapping context
* @return the destination Array mapped from the elements of
* <code>source</code>.
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/ma/glasnost/orika/MappingContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public void beginMapping() {
* the destination object being mapped into
* @deprecated This variant exists for backwards compatibility only; if
* overriding, override
* {@link #beginMapping(Type, String, Object, Type, String, Object)}
* {@link #beginMapping(Type, Object, Type, String, Object)}
* instead.
*/
@Deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ public interface MappingContextFactory {
*
* @return an instance of MappingContext
*/
public MappingContext getContext();
MappingContext getContext();

/**
* Allows for implementations that reuse objects to clean-up/clear any resources
* associated with the particular context instance once it is no longer needed.
*
* @param context the context to be recycled
*/
public void release(MappingContext context);
void release(MappingContext context);


/**
* @return a reference to the global properties map for this mapping context factory; any properties
* set here are available from any individual MappingContext created by this factory.
*/
public Map<Object, Object> getGlobalProperties();
Map<Object, Object> getGlobalProperties();
}
7 changes: 4 additions & 3 deletions core/src/main/java/ma/glasnost/orika/MappingHint.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@
public interface MappingHint {

/**
* @param sourceExpression
* @param fromProperty
* @param fromPropertyType
* @return a suggested optional mapping name for the given property,
* or <code>null</code> if no suggestion for the given property
*/
public String suggestMappedField(String fromProperty, Class<?> fromPropertyType);
String suggestMappedField(String fromProperty, Class<?> fromPropertyType);


/**
Expand All @@ -46,7 +47,7 @@ public interface MappingHint {
*
* @author [email protected]
*/
public static class DefaultFieldMappingConverter implements DefaultFieldMapper {
class DefaultFieldMappingConverter implements DefaultFieldMapper {

private MappingHint delegate;
public DefaultFieldMappingConverter(MappingHint delegate) {
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/ma/glasnost/orika/MappingStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public interface MappingStrategy extends MappedTypePair<Object, Object> {
* @param context the current mapping context
* @return the mapping result
*/
public Object map(Object sourceObject, Object destinationObject, MappingContext context);
Object map(Object sourceObject, Object destinationObject, MappingContext context);

/**
* MappingStrategyKey defines the minimum information necessary to cache a
Expand All @@ -49,7 +49,7 @@ public interface MappingStrategy extends MappedTypePair<Object, Object> {
* @author [email protected]
*
*/
public static final class Key {
final class Key {

private final Class<?> rawSourceType;
private final java.lang.reflect.Type sourceType;
Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/ma/glasnost/orika/Properties.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ public enum Properties {
UNENHANCE_STRATEGY,
FILTERS,
CAPTURE_FIELD_CONTEXT
;
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class PropertyNotFoundException extends MappingException {

/**
* @param message
* @param type
*/
public PropertyNotFoundException(String message) {
super(message);
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/ma/glasnost/orika/StateReporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ private StateReporter() {}
*
* @param out
* @param mapperFactory
* @param mapperFacade
*/
public static void reportCurrentState(StringBuilder out, MapperFactory mapperFactory) {
ConverterFactory converterFactory = mapperFactory.getConverterFactory();
Expand Down Expand Up @@ -56,7 +55,7 @@ public static String humanReadableSizeInMemory(Object...objects) {
* @author mattdeboer
*
*/
public static interface Reportable {
public interface Reportable {

/**
* Writes details of the current state of this object to the provided
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public class ConstructorParameterResolver {
* TODO: this isn't a correct mapping, as
*
* @param type
* @param dynamicPropertyExpression
* @return the property (of any format)
*/
public Map<String, Set<Property>> getProperties(java.lang.reflect.Type type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public interface ConstructorResolverStrategy {
*
* @param <T>
*/
public static class ConstructorMapping<T> {
class ConstructorMapping<T> {

private Constructor<T> constructor;
private List<FieldMap> mappedFields;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public interface ConverterFactory {
* Sets the MapperFactory which will be used by this ConverterFactory to obtain
* a MapperFacade needed by it's registered converters.
*
* @param mapperfactory
* @param mapperFacade
*/
void setMapperFacade(MapperFacade mapperFacade);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public MappingException newMappingException(Throwable cause) {
}

/**
* @param e
* @param me
* @return
*/
public MappingException decorate(MappingException me) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ enum Position {
*
* @param mapperFactory the MapperFactory to apply
*/
public void setMapperFactory(MapperFactory mapperFactory);
void setMapperFactory(MapperFactory mapperFactory);

/**
* Convenience method to add a specification at a relative position with respect to
Expand All @@ -58,12 +58,12 @@ enum Position {
* @param relativePosition the relative position
* @param relativeSpec the other relative spec (for Positions BEFORE, AFTER, or IN_PLACE_OF)
*/
public void addSpecification(Specification spec, Position relativePosition, Class<? extends Specification> relativeSpec);
void addSpecification(Specification spec, Position relativePosition, Class<? extends Specification> relativeSpec);

/**
* @return the defined specifications
*/
public List<Specification> getSpecifications();
List<Specification> getSpecifications();

/**
* Convenience method to add an AggregateSpecification at a relative position with respect to
Expand All @@ -73,10 +73,10 @@ enum Position {
* @param relativePosition the relative position
* @param relativeSpec the other relative spec (for Positions BEFORE, AFTER, or IN_PLACE_OF)
*/
public void addAggregateSpecification(AggregateSpecification spec, Position relativePosition, Class<AggregateSpecification> relativeSpec);
void addAggregateSpecification(AggregateSpecification spec, Position relativePosition, Class<AggregateSpecification> relativeSpec);

/**
* @return the defined aggregate specifications
*/
public List<AggregateSpecification> getAggregateSpecifications();
List<AggregateSpecification> getAggregateSpecifications();
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,7 @@

package ma.glasnost.orika.impl.generator;

import static java.lang.String.format;
import static ma.glasnost.orika.impl.Specifications.aMultiOccurrenceElementMap;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;

import ma.glasnost.orika.BoundMapperFacade;
import ma.glasnost.orika.Converter;
import ma.glasnost.orika.Filter;
import ma.glasnost.orika.MapEntry;
import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.MappingContext;
import ma.glasnost.orika.*;
import ma.glasnost.orika.Properties;
import ma.glasnost.orika.converter.ConverterFactory;
import ma.glasnost.orika.impl.AggregateFilter;
Expand All @@ -54,6 +31,13 @@
import ma.glasnost.orika.metadata.*;
import ma.glasnost.orika.property.PropertyResolverStrategy;

import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicInteger;

import static java.lang.String.format;
import static ma.glasnost.orika.impl.Specifications.aMultiOccurrenceElementMap;

/**
* SourceCodeContext contains the state information necessary while generating
* source code for a given mapping object; it also houses various utility
Expand Down Expand Up @@ -237,8 +221,7 @@ public String toSourceFile() {
* source and/or class files to be written.
*
* @return the (generated) compiled class
* @throws CannotCompileException
* @throws IOException
* @throws SourceCodeGenerationException
*/
protected Class<?> compileClass() throws SourceCodeGenerationException {
try {
Expand All @@ -250,8 +233,7 @@ protected Class<?> compileClass() throws SourceCodeGenerationException {

/**
* @return a new instance of the (generated) compiled class
* @throws CannotCompileException
* @throws IOException
* @throws SourceCodeGenerationException
* @throws InstantiationException
* @throws IllegalAccessException
*/
Expand Down Expand Up @@ -523,7 +505,6 @@ public static VariableRef entrySetRef(VariableRef s) {
* @param dest
* @param srcNodes
* @param destNodes
* @param mappings
* any relevant declared field mappings
* @return a code snippet suitable to use as an equality comparison test for
* the provided source and destination nodes
Expand Down Expand Up @@ -856,7 +837,8 @@ private static String varPath(VariableRef var) {
* Proxies the destination property as necessary for filters that filter
* destination values.
*
* @param destinationProperty
* @param src
* @param dest
* @param filter
* @return
*/
Expand Down Expand Up @@ -892,7 +874,8 @@ protected String setter() {
* Proxies the source property as necessary for filters that filter source
* values.
*
* @param sourceProperty
* @param src
* @param dest
* @param filter
* @return
*/
Expand Down
Loading

0 comments on commit 8397520

Please sign in to comment.