Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * #%L
   * BroadleafCommerce Framework
   * %%
   * Copyright (C) 2009 - 2013 Broadleaf Commerce
   * %%
   * 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.
  * #L%
  */
 package org.broadleafcommerce.core.catalog.service.dynamic;
 
 
 
 
     private Sku delegate;
     private Money retailPrice;
     private Money salePrice;
     
         this. = sku;
         try {
             Field retail = getSingleField(.getClass(), "retailPrice");
             retail.setAccessible(true);
             Object retailVal = retail.get();
              = retailVal==null?null:new Money((BigDecimalretailVal);
             Field sale = getSingleField(.getClass(), "salePrice");
             sale.setAccessible(true);
             Object saleVal = sale.get();
              = saleVal==null?null:new Money((BigDecimalsaleVal);
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
     }

    
This is used with SkuBundleItem to allow the bundle override price.

Parameters:
sku
salePriceOverride
 
     public DefaultDynamicSkuPricingInvocationHandler(Sku skuBigDecimal salePriceOverride) {
         this(sku);
 
         if (salePriceOverride != null) {
              = new Money(salePriceOverride);
         }
     }
    
This is used with SkuBundleItem to allow the bundle override price.

Parameters:
sku
salePriceOverride
 
     public DefaultDynamicSkuPricingInvocationHandler(BigDecimal salePriceOverride) {
         this(new SkuImpl());
 
         if (salePriceOverride != null) {
              = new Money(salePriceOverride);
         }
     }
    
Used to add ProductOptionValue price adjustments to the proxy Sku

Parameters:
sku
adjustments - the sum total of the ProductOptionValue price adjustments. If null, this functions the same as the default constructor. This value is added to both the salePrice and retailPrice
 
     public DefaultDynamicSkuPricingInvocationHandler(Sku skuMoney adjustments) {
         this(sku);
 
         if (adjustments != null) {
              = ( == null) ? adjustments : .add(adjustments);
              = ( == null) ? adjustments : .add(adjustments);
         }
     }
     
     private Field getSingleField(Class<?> clazzString fieldNamethrows IllegalStateException {
         try {
             return clazz.getDeclaredField(fieldName);
         } catch (NoSuchFieldException nsf) {
             // Try superclass
            if (clazz.getSuperclass() != null) {
                return getSingleField(clazz.getSuperclass(), fieldName);
            }
            return null;
        }
    }
    
    @Override
    public Object invoke(Object proxyMethod methodObject[] argsthrows Throwable {
        if (method.getName().equals("getRetailPrice")) {
            return ;
        } else if (method.getName().equals("getSalePrice")) {
            return ;
        } else {
            return method.invoke(args);
        }
    }
    public void reset() {
         = null;
         = null;
         = null;
    }
New to GrepCode? Check out our FAQ X