325N/A/*
325N/A * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
325N/A *
325N/A * This code is free software; you can redistribute it and/or modify it
325N/A * under the terms of the GNU General Public License version 2 only, as
325N/A * published by the Free Software Foundation. Oracle designates this
325N/A * particular file as subject to the "Classpath" exception as provided
325N/A * by Oracle in the LICENSE file that accompanied this code.
325N/A *
325N/A * This code is distributed in the hope that it will be useful, but WITHOUT
325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
325N/A * version 2 for more details (a copy is included in the LICENSE file that
325N/A * accompanied this code).
325N/A *
325N/A * You should have received a copy of the GNU General Public License version
325N/A * 2 along with this work; if not, write to the Free Software Foundation,
325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
325N/A *
325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
325N/A * or visit www.oracle.com if you need additional information or have any
325N/A * questions.
325N/A */
325N/A
325N/Apackage com.sun.tools.internal.xjc.outline;
325N/A
325N/Aimport com.sun.codemodel.internal.JBlock;
325N/Aimport com.sun.codemodel.internal.JExpression;
325N/Aimport com.sun.codemodel.internal.JVar;
325N/Aimport com.sun.tools.internal.xjc.model.CPropertyInfo;
325N/A
325N/A/**
325N/A * Encapsulates the access on a field.
325N/A *
325N/A * @author
325N/A * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
325N/A */
325N/Apublic interface FieldAccessor {
325N/A
325N/A /**
325N/A * Dumps everything in this field into the given variable.
325N/A *
325N/A * <p>
325N/A * This generates code that accesses the field from outside.
325N/A *
325N/A * @param block
325N/A * The code will be generated into this block.
325N/A * @param $var
325N/A * Variable whose type is {@link FieldOutline#getRawType()}
325N/A */
325N/A void toRawValue( JBlock block, JVar $var );
325N/A
325N/A /**
325N/A * Sets the value of the field from the specified expression.
325N/A *
325N/A * <p>
325N/A * This generates code that accesses the field from outside.
325N/A *
325N/A * @param block
325N/A * The code will be generated into this block.
325N/A * @param uniqueName
325N/A * Identifier that the caller guarantees to be unique in
325N/A * the given block. When the callee needs to produce additional
325N/A * variables, it can do so by adding suffixes to this unique
325N/A * name. For example, if the uniqueName is "abc", then the
325N/A * caller guarantees that any identifier "abc.*" is unused
325N/A * in this block.
325N/A * @param $var
325N/A * The expression that evaluates to a value of the type
325N/A * {@link FieldOutline#getRawType()}.
325N/A */
325N/A void fromRawValue( JBlock block, String uniqueName, JExpression $var );
325N/A
325N/A /**
325N/A * Generates a code fragment to remove any "set" value
325N/A * and move this field to the "unset" state.
325N/A *
325N/A * @param body
325N/A * The code will be appended at the end of this block.
325N/A */
325N/A void unsetValues( JBlock body );
325N/A
325N/A /**
325N/A * Return an expression that evaluates to true only when
325N/A * this field has a set value(s).
325N/A *
325N/A * @return null
325N/A * if the isSetXXX/unsetXXX method does not make sense
325N/A * for the given field.
325N/A */
325N/A JExpression hasSetValue();
325N/A
325N/A /**
325N/A * Gets the {@link FieldOutline} from which
325N/A * this object is created.
325N/A */
325N/A FieldOutline owner();
325N/A
325N/A /**
325N/A * Short for <tt>owner().getPropertyInfo()</tt>
325N/A */
325N/A CPropertyInfo getPropertyInfo();
325N/A}