Skip to content

Commit

Permalink
WW-4996 Renames and moves class to proper package to better expose it…
Browse files Browse the repository at this point in the history
…s meaning
  • Loading branch information
lukaszlenart committed Jan 3, 2019
1 parent 243a8c8 commit 6adfbed
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.conversion.StrutsTypeConverterHolder;
import org.apache.struts2.conversion.StrutsTypeConverterCreator;

import java.util.*;
Expand Down Expand Up @@ -259,7 +260,7 @@ protected Container createBootstrapContainer(List<ContainerProvider> providers)
builder.factory(ConversionFileProcessor.class, DefaultConversionFileProcessor.class, Scope.SINGLETON);
builder.factory(ConversionAnnotationProcessor.class, DefaultConversionAnnotationProcessor.class, Scope.SINGLETON);
builder.factory(TypeConverterCreator.class, StrutsTypeConverterCreator.class, Scope.SINGLETON);
builder.factory(TypeConverterHolder.class, DefaultTypeConverterHolder.class, Scope.SINGLETON);
builder.factory(TypeConverterHolder.class, StrutsTypeConverterHolder.class, Scope.SINGLETON);

builder.factory(XWorkBasicConverter.class, Scope.SINGLETON);
builder.factory(TypeConverter.class, StrutsConstants.STRUTS_CONVERTER_COLLECTION, CollectionConverter.class, Scope.SINGLETON);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
import com.opensymphony.xwork2.conversion.impl.DefaultConversionPropertiesProcessor;
import com.opensymphony.xwork2.conversion.impl.DefaultObjectTypeDeterminer;
import org.apache.struts2.conversion.StrutsTypeConverterCreator;
import com.opensymphony.xwork2.conversion.impl.DefaultTypeConverterHolder;
import org.apache.struts2.conversion.StrutsTypeConverterHolder;
import com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler;
import com.opensymphony.xwork2.conversion.impl.NumberConverter;
import com.opensymphony.xwork2.conversion.impl.StringConverter;
Expand Down Expand Up @@ -159,7 +159,7 @@ public void register(ContainerBuilder builder, LocatableProperties props)
.factory(ConversionFileProcessor.class, DefaultConversionFileProcessor.class, Scope.SINGLETON)
.factory(ConversionAnnotationProcessor.class, DefaultConversionAnnotationProcessor.class, Scope.SINGLETON)
.factory(TypeConverterCreator.class, StrutsTypeConverterCreator.class, Scope.SINGLETON)
.factory(TypeConverterHolder.class, DefaultTypeConverterHolder.class, Scope.SINGLETON)
.factory(TypeConverterHolder.class, StrutsTypeConverterHolder.class, Scope.SINGLETON)

.factory(FileManager.class, "system", DefaultFileManager.class, Scope.SINGLETON)
.factory(FileManagerFactory.class, DefaultFileManagerFactory.class, Scope.SINGLETON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void setContainer(Container container) {

public TypeConverter buildConverter(Class<? extends TypeConverter> converterClass, Map<String, Object> extraContext) throws Exception {
LOG.debug("Creating converter of type [{}]", converterClass.getCanonicalName());
return container.getInstance(converterClass);
return container.inject(converterClass);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.opensymphony.xwork2.conversion.TypeConverter;
import com.opensymphony.xwork2.conversion.TypeConverterCreator;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.ognl.XWorkTypeConverterWrapper;

/**
* Default implementation of {@link TypeConverterCreator}
Expand All @@ -39,7 +38,7 @@ public void setObjectFactory(ObjectFactory objectFactory) {
public TypeConverter createTypeConverter(String className) throws Exception {
Class<?> classInstance = objectFactory.getClassInstance(className);

if (classInstance.isAssignableFrom(TypeConverter.class)) {
if (TypeConverter.class.isAssignableFrom(classInstance)) {
Class<? extends TypeConverter> converterClass = (Class<? extends TypeConverter>) classInstance;
return objectFactory.buildConverter(converterClass, null);
} else {
Expand All @@ -48,7 +47,7 @@ public TypeConverter createTypeConverter(String className) throws Exception {
}

public TypeConverter createTypeConverter(Class<?> clazz) throws Exception {
if (clazz.isAssignableFrom(TypeConverter.class)) {
if (TypeConverter.class.isAssignableFrom(clazz)) {
Class<? extends TypeConverter> converterClass = (Class<? extends TypeConverter>) clazz;
return objectFactory.buildConverter(converterClass, null);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package com.opensymphony.xwork2.conversion.impl;
package org.apache.struts2.conversion;

import com.opensymphony.xwork2.conversion.TypeConverter;
import com.opensymphony.xwork2.conversion.TypeConverterHolder;
Expand All @@ -28,7 +28,7 @@
/**
* Default implementation of {@link TypeConverterHolder}
*/
public class DefaultTypeConverterHolder implements TypeConverterHolder {
public class StrutsTypeConverterHolder implements TypeConverterHolder {

/**
* Record class and its type converter mapping.
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/struts-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<bean type="com.opensymphony.xwork2.conversion.ConversionFileProcessor" name="struts" class="com.opensymphony.xwork2.conversion.impl.DefaultConversionFileProcessor" />
<bean type="com.opensymphony.xwork2.conversion.ConversionAnnotationProcessor" name="struts" class="com.opensymphony.xwork2.conversion.impl.DefaultConversionAnnotationProcessor" />
<bean type="com.opensymphony.xwork2.conversion.TypeConverterCreator" name="struts" class="org.apache.struts2.conversion.StrutsTypeConverterCreator" />
<bean type="com.opensymphony.xwork2.conversion.TypeConverterHolder" name="struts" class="com.opensymphony.xwork2.conversion.impl.DefaultTypeConverterHolder" />
<bean type="com.opensymphony.xwork2.conversion.TypeConverterHolder" name="struts" class="org.apache.struts2.conversion.StrutsTypeConverterHolder" />

<bean class="com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter" />

Expand Down

0 comments on commit 6adfbed

Please sign in to comment.