Package com.google.i18n.pseudolocalization.message.impl

Source Code of com.google.i18n.pseudolocalization.message.impl.AbstractVariantFragment

/*
* Copyright 2011 Google Inc.
*
* 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 com.google.i18n.pseudolocalization.message.impl;

import com.google.i18n.pseudolocalization.message.MessageFragmentVisitor;
import com.google.i18n.pseudolocalization.message.VariantFragment;
import com.google.i18n.pseudolocalization.message.VariantFragmentVisitor;
import com.google.i18n.pseudolocalization.message.VariantSelector;
import com.google.i18n.pseudolocalization.message.VisitorContext;

/**
* A base for {@link VariantFragment} implementations that implements the basic
* visitor API.
*/
public abstract class AbstractVariantFragment implements VariantFragment {

  public void accept(VisitorContext ctx, MessageFragmentVisitor mfv) {
    VariantFragmentVisitor vfv = mfv.visitVariantFragment(ctx, this);
    if (vfv != null) {
      for (VariantSelector selector : getSelectors()) {
        selector.accept(ctx, vfv);
      }
      vfv.endVariantFragment(ctx, this);
    }
  }

  /**
   * Get the list of {@link VariantSelector}s for this fragment.
   *
   * @return variant selectors
   */
  protected abstract Iterable<VariantSelector> getSelectors();
}
TOP

Related Classes of com.google.i18n.pseudolocalization.message.impl.AbstractVariantFragment

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.