feat(jdk8): move files to new folder to avoid resources compiled.
This commit is contained in:
64
jdkSrc/jdk8/com/sun/tools/internal/xjc/outline/Aspect.java
Normal file
64
jdkSrc/jdk8/com/sun/tools/internal/xjc/outline/Aspect.java
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.internal.xjc.outline;
|
||||
|
||||
import com.sun.tools.internal.xjc.generator.bean.ImplStructureStrategy;
|
||||
|
||||
/**
|
||||
* Sometimes a single JAXB-generated bean spans across multiple Java classes/interfaces.
|
||||
* We call them "aspects of a bean".
|
||||
*
|
||||
* <p>
|
||||
* This is an enumeration of all possible aspects.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*
|
||||
* TODO: move this to the model package
|
||||
*/
|
||||
public enum Aspect {
|
||||
/**
|
||||
* The exposed part of the bean.
|
||||
* <p>
|
||||
* This corresponds to the content interface when we are geneting one.
|
||||
* This would be the same as the {@link #IMPLEMENTATION} when we are
|
||||
* just generating beans.
|
||||
*
|
||||
* <p>
|
||||
* This could be an interface, or it could be a class.
|
||||
*
|
||||
* We don't have any other {@link ImplStructureStrategy} at this point,
|
||||
* but generally you can't assume anything about where this could be
|
||||
* or whether that's equal to {@link #IMPLEMENTATION}.
|
||||
*/
|
||||
EXPOSED,
|
||||
/**
|
||||
* The part of the bean that holds all the implementations.
|
||||
*
|
||||
* <p>
|
||||
* This is always a class, never an interface.
|
||||
*/
|
||||
IMPLEMENTATION
|
||||
}
|
||||
125
jdkSrc/jdk8/com/sun/tools/internal/xjc/outline/ClassOutline.java
Normal file
125
jdkSrc/jdk8/com/sun/tools/internal/xjc/outline/ClassOutline.java
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Use is subject to the license terms.
|
||||
*/
|
||||
package com.sun.tools.internal.xjc.outline;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.codemodel.internal.JClass;
|
||||
import com.sun.codemodel.internal.JDefinedClass;
|
||||
import com.sun.tools.internal.xjc.model.CClassInfo;
|
||||
import com.sun.tools.internal.xjc.model.CPropertyInfo;
|
||||
import com.sun.istack.internal.NotNull;
|
||||
|
||||
/**
|
||||
* Outline object that provides per-{@link CClassInfo} information
|
||||
* for filling in methods/fields for a bean.
|
||||
*
|
||||
* This interface is accessible from {@link Outline}
|
||||
*
|
||||
* @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public abstract class ClassOutline {
|
||||
|
||||
/**
|
||||
* A {@link Outline} that encloses all the class outlines.
|
||||
*/
|
||||
public abstract @NotNull Outline parent();
|
||||
|
||||
/**
|
||||
* {@link PackageOutline} that contains this class.
|
||||
*/
|
||||
public @NotNull PackageOutline _package() {
|
||||
return parent().getPackageContext(ref._package());
|
||||
}
|
||||
|
||||
/**
|
||||
* This {@link ClassOutline} holds information about this {@link CClassInfo}.
|
||||
*/
|
||||
public final @NotNull CClassInfo target;
|
||||
|
||||
/**
|
||||
* The exposed aspect of the a bean.
|
||||
*
|
||||
* implClass is always assignable to this type.
|
||||
* <p>
|
||||
* Usually this is the public content interface, but
|
||||
* it could be the same as the implClass.
|
||||
*/
|
||||
public final @NotNull JDefinedClass ref;
|
||||
|
||||
/**
|
||||
* The implementation aspect of a bean.
|
||||
* The actual place where fields/methods should be generated into.
|
||||
*/
|
||||
public final @NotNull JDefinedClass implClass;
|
||||
|
||||
/**
|
||||
* The implementation class that shall be used for reference.
|
||||
* <p>
|
||||
* Usually this field holds the same value as the {@link #implClass} method,
|
||||
* but sometimes it holds the user-specified implementation class
|
||||
* when it is specified.
|
||||
* <p>
|
||||
* This is the type that needs to be used for generating fields.
|
||||
*/
|
||||
public final @NotNull JClass implRef;
|
||||
|
||||
|
||||
|
||||
|
||||
protected ClassOutline( CClassInfo _target, JDefinedClass exposedClass, JClass implRef, JDefinedClass _implClass) {
|
||||
this.target = _target;
|
||||
this.ref = exposedClass;
|
||||
this.implRef = implRef;
|
||||
this.implClass = _implClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the {@link FieldOutline}s newly declared
|
||||
* in this class.
|
||||
*/
|
||||
public final FieldOutline[] getDeclaredFields() {
|
||||
List<CPropertyInfo> props = target.getProperties();
|
||||
FieldOutline[] fr = new FieldOutline[props.size()];
|
||||
for( int i=0; i<fr.length; i++ )
|
||||
fr[i] = parent().getField(props.get(i));
|
||||
return fr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the super class of this class, if it has the
|
||||
* super class and it is also a JAXB-bound class.
|
||||
* Otherwise null.
|
||||
*/
|
||||
public final ClassOutline getSuperClass() {
|
||||
CClassInfo s = target.getBaseClass();
|
||||
if(s==null) return null;
|
||||
return parent().getClazz(s);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.internal.xjc.outline;
|
||||
|
||||
import com.sun.codemodel.internal.JDefinedClass;
|
||||
import com.sun.tools.internal.xjc.model.CElementInfo;
|
||||
|
||||
/**
|
||||
* Outline object that provides per-{@link CElementInfo} information
|
||||
* for filling in methods/fields for a bean.
|
||||
*
|
||||
* This interface is accessible from {@link Outline}. This object is
|
||||
* not created for all {@link CElementInfo}s.
|
||||
* It is only for those {@link CElementInfo} that has a class.
|
||||
* (IOW, {@link CElementInfo#hasClass()}
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public abstract class ElementOutline {
|
||||
|
||||
/**
|
||||
* A {@link Outline} that encloses all the class outlines.
|
||||
*/
|
||||
public abstract Outline parent();
|
||||
|
||||
/**
|
||||
* {@link PackageOutline} that contains this class.
|
||||
*/
|
||||
public PackageOutline _package() {
|
||||
return parent().getPackageContext(implClass._package());
|
||||
}
|
||||
|
||||
/**
|
||||
* This {@link ElementOutline} holds information about this {@link CElementInfo}.
|
||||
*/
|
||||
public final CElementInfo target;
|
||||
|
||||
/**
|
||||
* The implementation aspect of a bean.
|
||||
* The actual place where fields/methods should be generated into.
|
||||
*/
|
||||
public final JDefinedClass implClass;
|
||||
|
||||
|
||||
protected ElementOutline(CElementInfo target, JDefinedClass implClass) {
|
||||
this.target = target;
|
||||
this.implClass = implClass;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.internal.xjc.outline;
|
||||
|
||||
import com.sun.codemodel.internal.JEnumConstant;
|
||||
import com.sun.tools.internal.xjc.generator.bean.BeanGenerator;
|
||||
import com.sun.tools.internal.xjc.model.CEnumConstant;
|
||||
import com.sun.tools.internal.xjc.model.CEnumLeafInfo;
|
||||
|
||||
/**
|
||||
* Outline object that provides per-{@link CEnumConstant} information.
|
||||
*
|
||||
* This object can be obtained from {@link EnumOutline}
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public abstract class EnumConstantOutline {
|
||||
/**
|
||||
* This {@link EnumOutline} holds information about this {@link CEnumLeafInfo}.
|
||||
*/
|
||||
public final CEnumConstant target;
|
||||
|
||||
/**
|
||||
* The generated enum constant.
|
||||
*/
|
||||
public final JEnumConstant constRef;
|
||||
|
||||
/**
|
||||
* Reserved for {@link BeanGenerator}.
|
||||
*/
|
||||
protected EnumConstantOutline(CEnumConstant target, JEnumConstant constRef) {
|
||||
this.target = target;
|
||||
this.constRef = constRef;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.internal.xjc.outline;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.codemodel.internal.JDefinedClass;
|
||||
import com.sun.tools.internal.xjc.model.CEnumLeafInfo;
|
||||
import com.sun.istack.internal.NotNull;
|
||||
|
||||
/**
|
||||
* Outline object that provides per-{@link CEnumLeafInfo} information
|
||||
* for filling in methods/fields for a bean.
|
||||
*
|
||||
* This object can be obtained from {@link Outline}
|
||||
*
|
||||
* @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public abstract class EnumOutline {
|
||||
|
||||
/**
|
||||
* This {@link EnumOutline} holds information about this {@link CEnumLeafInfo}.
|
||||
*/
|
||||
public final CEnumLeafInfo target;
|
||||
|
||||
/**
|
||||
* The generated enum class.
|
||||
*/
|
||||
public final JDefinedClass clazz;
|
||||
|
||||
/**
|
||||
* Constants.
|
||||
*/
|
||||
public final List<EnumConstantOutline> constants = new ArrayList<EnumConstantOutline>();
|
||||
|
||||
/**
|
||||
* {@link PackageOutline} that contains this class.
|
||||
*/
|
||||
public @NotNull
|
||||
PackageOutline _package() {
|
||||
return parent().getPackageContext(clazz._package());
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link Outline} that encloses all the class outlines.
|
||||
*/
|
||||
public abstract @NotNull Outline parent();
|
||||
|
||||
protected EnumOutline(CEnumLeafInfo target, JDefinedClass clazz) {
|
||||
this.target = target;
|
||||
this.clazz = clazz;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.internal.xjc.outline;
|
||||
|
||||
import com.sun.codemodel.internal.JBlock;
|
||||
import com.sun.codemodel.internal.JExpression;
|
||||
import com.sun.codemodel.internal.JVar;
|
||||
import com.sun.tools.internal.xjc.model.CPropertyInfo;
|
||||
|
||||
/**
|
||||
* Encapsulates the access on a field.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface FieldAccessor {
|
||||
|
||||
/**
|
||||
* Dumps everything in this field into the given variable.
|
||||
*
|
||||
* <p>
|
||||
* This generates code that accesses the field from outside.
|
||||
*
|
||||
* @param block
|
||||
* The code will be generated into this block.
|
||||
* @param $var
|
||||
* Variable whose type is {@link FieldOutline#getRawType()}
|
||||
*/
|
||||
void toRawValue( JBlock block, JVar $var );
|
||||
|
||||
/**
|
||||
* Sets the value of the field from the specified expression.
|
||||
*
|
||||
* <p>
|
||||
* This generates code that accesses the field from outside.
|
||||
*
|
||||
* @param block
|
||||
* The code will be generated into this block.
|
||||
* @param uniqueName
|
||||
* Identifier that the caller guarantees to be unique in
|
||||
* the given block. When the callee needs to produce additional
|
||||
* variables, it can do so by adding suffixes to this unique
|
||||
* name. For example, if the uniqueName is "abc", then the
|
||||
* caller guarantees that any identifier "abc.*" is unused
|
||||
* in this block.
|
||||
* @param $var
|
||||
* The expression that evaluates to a value of the type
|
||||
* {@link FieldOutline#getRawType()}.
|
||||
*/
|
||||
void fromRawValue( JBlock block, String uniqueName, JExpression $var );
|
||||
|
||||
/**
|
||||
* Generates a code fragment to remove any "set" value
|
||||
* and move this field to the "unset" state.
|
||||
*
|
||||
* @param body
|
||||
* The code will be appended at the end of this block.
|
||||
*/
|
||||
void unsetValues( JBlock body );
|
||||
|
||||
/**
|
||||
* Return an expression that evaluates to true only when
|
||||
* this field has a set value(s).
|
||||
*
|
||||
* @return null
|
||||
* if the isSetXXX/unsetXXX method does not make sense
|
||||
* for the given field.
|
||||
*/
|
||||
JExpression hasSetValue();
|
||||
|
||||
/**
|
||||
* Gets the {@link FieldOutline} from which
|
||||
* this object is created.
|
||||
*/
|
||||
FieldOutline owner();
|
||||
|
||||
/**
|
||||
* Short for <tt>owner().getPropertyInfo()</tt>
|
||||
*/
|
||||
CPropertyInfo getPropertyInfo();
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.internal.xjc.outline;
|
||||
|
||||
import com.sun.codemodel.internal.JExpression;
|
||||
import com.sun.codemodel.internal.JType;
|
||||
import com.sun.tools.internal.xjc.model.CPropertyInfo;
|
||||
|
||||
/**
|
||||
* Representation of a field of {@link ClassOutline}.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface FieldOutline {
|
||||
|
||||
/**
|
||||
* Gets the enclosing {@link ClassOutline}.
|
||||
*/
|
||||
ClassOutline parent();
|
||||
|
||||
/** Gets the corresponding model object. */
|
||||
CPropertyInfo getPropertyInfo();
|
||||
|
||||
/**
|
||||
* Gets the type of the "raw value".
|
||||
*
|
||||
* <p>
|
||||
* This type can represent the entire value of this field.
|
||||
* For fields that can carry multiple values, this is an array.
|
||||
*
|
||||
* <p>
|
||||
* This type allows the client of the outline to generate code
|
||||
* to set/get values from a property.
|
||||
*/
|
||||
JType getRawType();
|
||||
|
||||
/**
|
||||
* Creates a new {@link FieldAccessor} of this field
|
||||
* for the specified object.
|
||||
*
|
||||
* @param targetObject
|
||||
* Evaluates to an object, and the field on this object
|
||||
* will be accessed.
|
||||
*/
|
||||
FieldAccessor create( JExpression targetObject );
|
||||
}
|
||||
133
jdkSrc/jdk8/com/sun/tools/internal/xjc/outline/Outline.java
Normal file
133
jdkSrc/jdk8/com/sun/tools/internal/xjc/outline/Outline.java
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.internal.xjc.outline;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.sun.codemodel.internal.JClass;
|
||||
import com.sun.codemodel.internal.JClassContainer;
|
||||
import com.sun.codemodel.internal.JCodeModel;
|
||||
import com.sun.codemodel.internal.JPackage;
|
||||
import com.sun.codemodel.internal.JType;
|
||||
import com.sun.tools.internal.xjc.ErrorReceiver;
|
||||
import com.sun.tools.internal.xjc.model.CClassInfo;
|
||||
import com.sun.tools.internal.xjc.model.CClassInfoParent;
|
||||
import com.sun.tools.internal.xjc.model.CElementInfo;
|
||||
import com.sun.tools.internal.xjc.model.CEnumLeafInfo;
|
||||
import com.sun.tools.internal.xjc.model.CPropertyInfo;
|
||||
import com.sun.tools.internal.xjc.model.CTypeRef;
|
||||
import com.sun.tools.internal.xjc.model.Model;
|
||||
import com.sun.tools.internal.xjc.util.CodeModelClassFactory;
|
||||
|
||||
/**
|
||||
* Root of the outline. Captures which code is generated for which model component.
|
||||
*
|
||||
* <p>
|
||||
* This object also provides access to varioues utilities, such as
|
||||
* error reporting etc, for the convenience of code that builds the outline.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public interface Outline
|
||||
{
|
||||
/**
|
||||
* This outline is for this model.
|
||||
*/
|
||||
Model getModel();
|
||||
|
||||
/**
|
||||
* Short for {@code getModel().codeModel}.
|
||||
*/
|
||||
JCodeModel getCodeModel();
|
||||
|
||||
/** Gets the object that wraps the generated field for a given {@link CPropertyInfo}. */
|
||||
FieldOutline getField( CPropertyInfo fu );
|
||||
|
||||
/**
|
||||
* Gets per-package context information.
|
||||
*
|
||||
* This method works for every visible package
|
||||
* (those packages which are supposed to be used by client applications.)
|
||||
*
|
||||
* @return
|
||||
* If this grammar doesn't produce anything in the specified
|
||||
* package, return null.
|
||||
*/
|
||||
PackageOutline getPackageContext( JPackage _Package );
|
||||
|
||||
/**
|
||||
* Returns all the {@link ClassOutline}s known to this object.
|
||||
*/
|
||||
Collection<? extends ClassOutline> getClasses();
|
||||
|
||||
/**
|
||||
* Obtains per-class context information.
|
||||
*/
|
||||
ClassOutline getClazz( CClassInfo clazz );
|
||||
|
||||
/**
|
||||
* If the {@link CElementInfo} generates a class,
|
||||
* returns such a class. Otherwise return null.
|
||||
*/
|
||||
ElementOutline getElement(CElementInfo ei);
|
||||
|
||||
EnumOutline getEnum(CEnumLeafInfo eli);
|
||||
|
||||
/**
|
||||
* Gets all the {@link EnumOutline}s.
|
||||
*/
|
||||
Collection<EnumOutline> getEnums();
|
||||
|
||||
/** Gets all package-wise contexts at once. */
|
||||
Iterable<? extends PackageOutline> getAllPackageContexts();
|
||||
|
||||
/**
|
||||
* Gets a reference to
|
||||
* <code>new CodeModelClassFactory(getErrorHandler())</code>.
|
||||
*/
|
||||
CodeModelClassFactory getClassFactory();
|
||||
|
||||
/**
|
||||
* Any error during the back-end proccessing should be
|
||||
* sent to this object.
|
||||
*/
|
||||
ErrorReceiver getErrorReceiver();
|
||||
|
||||
JClassContainer getContainer(CClassInfoParent parent, Aspect aspect );
|
||||
|
||||
/**
|
||||
* Resolves a type reference to the actual (possibly generated) type.
|
||||
*
|
||||
* Short for {@code resolve(ref.getType(),aspect)}.
|
||||
*/
|
||||
JType resolve(CTypeRef ref,Aspect aspect);
|
||||
|
||||
/**
|
||||
* Copies the specified class into the user's package and returns
|
||||
* a reference to it.
|
||||
*/
|
||||
JClass addRuntime(Class clazz);
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.internal.xjc.outline;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlNsForm;
|
||||
import javax.xml.bind.annotation.XmlSchema;
|
||||
|
||||
import com.sun.codemodel.internal.JDefinedClass;
|
||||
import com.sun.codemodel.internal.JPackage;
|
||||
import com.sun.tools.internal.xjc.generator.bean.ObjectFactoryGenerator;
|
||||
|
||||
/**
|
||||
* Outline object that provides per-package information.
|
||||
*
|
||||
* This interface is accessible from {@link Outline}.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface PackageOutline {
|
||||
|
||||
/**
|
||||
* The exposed package this context is representing.
|
||||
*
|
||||
* <p>
|
||||
* An exposed package is a package visible to users, a package
|
||||
* supposed to be used by client applications. Sometime
|
||||
* we have another parallel package that's not visible to users.
|
||||
*/
|
||||
JPackage _package();
|
||||
|
||||
/**
|
||||
* Generated ObjectFactory from package.
|
||||
*
|
||||
* This method allows a caller to obtain a reference to such
|
||||
* ObjectFactory from its package.
|
||||
*
|
||||
* Must not be null.
|
||||
*/
|
||||
JDefinedClass objectFactory();
|
||||
|
||||
/**
|
||||
* Generates an ObjectFactory class for this package.
|
||||
*/
|
||||
ObjectFactoryGenerator objectFactoryGenerator();
|
||||
|
||||
/**
|
||||
* Gets {@link ClassOutline}s whose {@link ClassOutline#_package()}
|
||||
* points to this object.
|
||||
*
|
||||
* @return can be empty but never null.
|
||||
*/
|
||||
Set<? extends ClassOutline> getClasses();
|
||||
|
||||
/**
|
||||
* The namespace URI most commonly used in classes in this package.
|
||||
* This should be used as the namespace URI for {@link XmlSchema#namespace()}.
|
||||
*
|
||||
* <p>
|
||||
* Null if no default
|
||||
*/
|
||||
public String getMostUsedNamespaceURI();
|
||||
|
||||
/**
|
||||
* The element form default for this package.
|
||||
* <p>
|
||||
* The value is computed by examining what would yield the smallest generated code.
|
||||
*/
|
||||
public XmlNsForm getElementFormDefault();
|
||||
|
||||
/**
|
||||
* The attribute form default for this package.
|
||||
* <p>
|
||||
* The value is computed by examining what would yield the smallest generated code.
|
||||
*/
|
||||
public XmlNsForm getAttributeFormDefault();
|
||||
}
|
||||
Reference in New Issue
Block a user