/*
 * Copyright 2014-2015 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
package org.lastaflute.di.core.assembler;

import java.lang.reflect.Field;

import org.lastaflute.di.core.ComponentDef;
import org.lastaflute.di.core.util.BindingUtil;
import org.lastaflute.di.helper.beans.PropertyDesc;
import org.lastaflute.di.helper.log.LaLogger;

/**
 * @author modified by jflute (originated in Seasar)
 */
public class BindingTypeShouldDef extends AbstractBindingTypeDef {

    private static final LaLogger logger = LaLogger.getLogger(BindingTypeShouldDef.class);

    protected BindingTypeShouldDef(String name) {
        super(name);
    }

    protected void doBindProperty(ComponentDef componentDef, PropertyDesc propertyDesc, Object component) {
        if (!bindAutoProperty(componentDef, propertyDesc, component)
                && BindingUtil.isPropertyAutoBindable(propertyDesc.getPropertyType())) {
            logger.log("WSSR0008",
                    new Object[] { BindingUtil.getComponentClass(componentDef, component).getName(), propertyDesc.getPropertyName() });
        }
    }

    protected void doBindResourceField(ComponentDef componentDef, Field field, Object component) {
        if (!bindAutoResourceField(componentDef, field, component) && BindingUtil.isFieldAutoBindable(field.getType())) {
            logger.log("WSSR0008", new Object[] { BindingUtil.getComponentClass(componentDef, component).getName(), field.getName() });
        }
    }

    @Override
    public String toString() {
        return "shouldDef:{" + name + "}";
    }
}

@@ -762,127 +762,33 @@
 .di.
-core.util.BindingUtil;%0Aimport org.lastaflute.di.helper.beans.PropertyDesc;%0Aimport org.lastaflute.di.helper.log.LaLogger
+helper.beans.PropertyDesc
 ;%0A%0A/
@@ -919,100 +919,8 @@
  %7B%0A%0A
-    private static final LaLogger logger = LaLogger.getLogger(BindingTypeShouldDef.class);%0A%0A
     
@@ -1101,32 +1101,75 @@
 nent) %7B%0A        
+// unneeded warning so remove it%0A        //
 if (!bindAutoPro
@@ -1213,32 +1213,34 @@
 ponent)%0A        
+//
         && Bindi
@@ -1304,32 +1304,34 @@
 e())) %7B%0A        
+//
     logger.log(%22
@@ -1341,32 +1341,34 @@
 R0008%22,%0A        
+//
             new 
@@ -1479,34 +1479,101 @@
 e() %7D);%0A        
+//
 %7D%0A
+        bindAutoProperty(componentDef, propertyDesc, component);%0A
     %7D%0A%0A    prote
@@ -1670,16 +1670,59 @@
         
+// unneeded warning so remove it%0A        //
 if (!bin
@@ -1831,24 +1831,26 @@
 ) %7B%0A        
+//
     logger.l
@@ -1973,17 +1973,82 @@
         
-%7D
+//%7D%0A        bindAutoResourceField(componentDef, field, component);
 %0A    %7D%0A%0A

remove property DI warning because of unneeded