Untyped Collections vs. Typed Arrays for public API

hi,
I'm just courious about hearing any tips or advice from you ragarding how to design a public API of a program that uses collections (like collections of Date-objects for example). In a first thought I'd go and implement it using the Collection-Framework by defining public accessor methods that take in a Collection of the desired objects, as well as (for the getters) return some Collection (for example here a concrete TreeSet when data is returned sorted). So far so good, but then I always end up using downcasts to the object I expected (checked using "instanceof" to avoid ClassCastException's). As I'd like to make the public part of the API as robust as possible I don't like to force the users to read the methods' javadocs in full detail in order to know what dsired objects to put in the collection they pass in, or to what interface-types they can downcast when fetching objects from such a collection from an accessor method.
The other idea might be - to overcome this untyped API - to use arrays here (as they're typed and bound during compile-time), but in the Java Tutorial I read that array-based interfaces are mostly legacy things and should be avoided (by using collections) in new systems. Personally I like the Collection-Framework very much, since it offers a lot of things like sorting, easy iteration, etc. Generally speaking I like them as they feel more like objects than arrays do. But it also always feels like they're untyped by using downcasts everywhere, which are only checked at runtime (of course) so that it is a potentially hard to detect risk of error for the API users. Even when subclassing the Collections (i.e. implementing java.util.Collection in an own collection-like class) we gain no compile-type checks here, since we have to implement the methods accepting and returning java.lang.Object's. I understand that the idea of the Collection-Framework is to keep things very general, but when using this generality we loose type-checks at compile-time yielding towards loosing robustness.
There are several good books out there with general recommendations and tips about how to write good, nice, and robust code, including ideoms and coding-styles, but none of them (at least none of mine) has covered this. The essence of what I could get out of them is that code (especially a public API) should be robust and we should re-use the wheel (like the Collections-Framework in java.util), but what about the thing of "Untyped Collections vs. Typed Arrays" when comparing code-reuse and interoperability with other collecion-based APIs against the robustness of compile-time checks of data-types in arrays.
Suppose you were about to use some API, what kind of interface (and for what reason) would you like? Typed Arrays which are not so nice to handle/use, or Untyped Collections where you've always got to read the API's docs about what to put in and what to downcast to... I know that it's easy (using the static convenience methods of java.util.Collections and java.util.Arrays) to convert between both, but what would you natively prefer?
Thank you very much for your answers, and I really look forward to any thoughts on this, as I personally have not decided on this...
X-Post from "Java Collections Framework" forum since I think it does not only belong to Collection Framework details, as it is more a general API-design topic...

Typically speaking, I prefer the Collections API to using arrays as well, although the specific needs often dictate the best choice. When developing type safe collections, I would suggest one of two design options:
1) extend SDK Collection classes to become type safe. For example, extend ArrayList with DateList and then over-ride all the add methods so that a ClassCastException is thrown when the argument is not assignable to java.util.Date. This design has less development over-head, since you inherit the collection management logic from the super class, but the type checks are obviously completed at run time, not compile time
2) make your own class that implement the Collections API. Basically, I would create one abstract class that manages the collection logic, holding an array of Objects that can be resized and then have your subclasses provide type-specific add methods to that array. Here you gain compile-time type checks, but have a higher development over-head.

Similar Messages

  • [svn] 4662: Refactoring to reflect new FXG utils package names to com.adobe .fxg.* for public APIs and com.adobe.internal.fxg. * for internal APIs not guaranteed to remain constant.

    Revision: 4662
    Author: [email protected]
    Date: 2009-01-25 16:05:12 -0800 (Sun, 25 Jan 2009)
    Log Message:
    Refactoring to reflect new FXG utils package names to com.adobe.fxg.* for public APIs and com.adobe.internal.fxg.* for internal APIs not guaranteed to remain constant.
    QA: No
    Doc: No
    Checkintests Pass
    Modified Paths:
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/fxg/TextFXGGraphics.java
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/fxg/TextHelper.java
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/media/FXGTranscoder.java
    Added Paths:
    flex/sdk/trunk/modules/fxgutils/src/java/com/
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/fxg/
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/fxg/FXGConstants.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/fxg/FXGException.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/AbstractFXGNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/AbstractShapeNode.jav a
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/BitmapGraphicNode.jav a
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/DefinitionNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/DelegateNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/EllipseNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/FXGNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/FillNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/FilterNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/GradientEntryNode.jav a
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/GraphicContentNode.ja va
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/GraphicContext.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/GraphicNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/GroupDefinitionNode.j ava
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/GroupNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/LibraryNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/LineNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/MaskPropertyNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/MaskableNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/MaskingNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/PathNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/PlaceObjectNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/RectNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/ScalableGradientNode. java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/StrokeNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/TextGraphicNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/TextNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/TransformNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/fills/
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/fills/AbstractFillNod e.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/fills/BitmapFillNode. java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/fills/LinearGradientF illNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/fills/RadialGradientF illNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/fills/SolidColorFillN ode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/filters/
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/filters/AbstractFilte rNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/filters/BevelFilterNo de.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/filters/BlurFilterNod e.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/filters/ColorMatrixFi lterNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/filters/DropShadowFil terNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/filters/GlowFilterNod e.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/filters/GradientBevel FilterNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/filters/GradientGlowF ilterNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/strokes/
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/strokes/AbstractStrok eNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/strokes/LinearGradien tStrokeNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/strokes/RadialGradien tStrokeNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/strokes/SolidColorStr okeNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/text/
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/text/AbstractCharacte rTextNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/text/AbstractTextNode .java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/text/BRNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/text/CDATANode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/text/ParagraphNode.ja va
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/text/SpanNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/transforms/
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/transforms/AbstractTr ansformNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/transforms/ColorTrans formNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/transforms/MatrixNode .java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/types/
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/types/BevelType.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/types/BlendMode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/types/Caps.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/types/InterpolationMe thod.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/types/Joints.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/types/Kerning.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/types/LineBreak.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/types/MaskType.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/types/ScaleMode.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/types/ScalingGrid.jav a
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/types/SpreadMethod.ja va
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/types/WhiteSpaceColla pse.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/types/Winding.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/sax/
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/sax/FXGSAXScanner.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/swf/
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/swf/AbstractFXGGraphics.j ava
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/swf/FXGGraphics.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/swf/ImageHelper.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/swf/ShapeHelper.java
    flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/swf/TypeHelper.java
    Removed Paths:
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/FXGConstants.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/FXGException.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/AbstractFXGNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/AbstractShapeNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/BitmapGraphicNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/DefinitionNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/DelegateNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/EllipseNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/FXGNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/FillNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/FilterNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/GradientEntryNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/GraphicContentNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/GraphicContext.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/GraphicNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/GroupDefinitionNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/GroupNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/LibraryNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/LineNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/MaskPropertyNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/MaskableNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/MaskingNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/PathNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/PlaceObjectNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/RectNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/ScalableGradientNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/StrokeNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/TextGraphicNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/TextNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/TransformNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/fills/AbstractFillNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/fills/BitmapFillNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/fills/LinearGradientFillNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/fills/RadialGradientFillNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/fills/SolidColorFillNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/filters/AbstractFilterNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/filters/BevelFilterNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/filters/BlurFilterNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/filters/ColorMatrixFilterNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/filters/DropShadowFilterNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/filters/GlowFilterNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/filters/GradientBevelFilterNode.ja va
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/filters/GradientGlowFilterNode.jav a
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/strokes/AbstractStrokeNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/strokes/LinearGradientStrokeNode.j ava
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/strokes/RadialGradientStrokeNode.j ava
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/strokes/SolidColorStrokeNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/text/AbstractCharacterTextNode.jav a
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/text/AbstractTextNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/text/BRNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/text/CDATANode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/text/ParagraphNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/text/SpanNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/transforms/AbstractTransformNode.j ava
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/transforms/ColorTransformNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/transforms/MatrixNode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/types/BevelType.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/types/BlendMode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/types/Caps.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/types/InterpolationMethod.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/types/Joints.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/types/Kerning.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/types/LineBreak.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/types/MaskType.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/types/ScaleMode.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/types/ScalingGrid.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/types/SpreadMethod.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/types/WhiteSpaceCollapse.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/dom/types/Winding.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/sax/FXGSAXScanner.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/swf/AbstractFXGGraphics.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/swf/FXGGraphics.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/swf/ImageHelper.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/swf/ShapeHelper.java
    flex/sdk/trunk/modules/fxgutils/src/java/flash/fxg/swf/TypeHelper.java

    The problem with submitting a bug report is I don't know how to replicate it.
    The java file showed up on the "Referenced Libraries". I removed it from there and it fixed the problem.
    If I return it to the classpath via Eclipse it doesn't demonstrate the problem.
    I don't know how it got into the classpath to cause this problem. I even tried editing the classpath (which I'm fairly certain was not how the problem was caused) but that didn't replicate the problem.
    I didn't check the .classpath to see what the entry was before I removed it via eclipse so I don't know what the entry looked like. The problem wasn't in the version is SVN so I don't know how to find what changes were made.
    If you sill want a bug report I can enter one but with out any instructions on how to replicate it.

  • Using OSB for Public API (REST)

    Hi there,
    Is it a good practice to use Oracle Service Bus to expose a PUBLIC REST API?
    The idea is to have a separeted OSB instance which will be in the WEB so that other partners and applications (Native Mobile, for instance) can access some of our services. The application layer will have many different applications, like SAP, JEE systems, Cobol and others. But the public API will be design in a more RESTful fashion.
    What about security?
    What about performance? (Parsing JMS, XML and others into JSON will probably create extra load into the OSB).
    What are be the advantages of using OSB instead of a more traditional Service Layer?
    P.S.: We are being careful with the design of our API, sometimes the underlying system doesn't help, so some transformation has to happen (more load!) in order to make the API elegant and meaningful.
    Cheers

    Personally, I'd prefer Collections as they are nice to work with. Their only annoying issue is certainly the constant casting as soon as you retrieve Objects from them.
    I do not consider the documentation of what those Collection include too big a problem. Just include a line for each Collection parameter stating "Set of Strings" or the like. I wouldn't even check the type through instanceof, I'd just cast. If a ClassCastException is thrown, I think that's the proper thing to do.
    As you might have noticed, there is a proposal of "Generics" for Java, which would adopt something like those template classes known in C++. There is even a beta implementation available, so you can go ahead and code your Set<String>. Time will tell if this proposal finds its way into the official Java standard, the drawback being a more complex syntax. If you want to know more about it, check out those links:
    http://forum.java.sun.com/forum.jsp?forum=316
    http://www.jcp.org/jsr/detail/14.jsp
    http://developer.java.sun.com/developer/earlyAccess/adding_generics

  • Public API's to create delivery for each delivery line

    I've requirement to create unique delivery for each delivery line using API. Can any body use public API to meet this requirement. Please ! any idea and thought !
    R12.
    Thanks in Advance,
    Ramana

    Try the WSH_DELIVERIES_PUB.Create_Update_Delivery API. The API creates a new delivery record or updates an existing delivery record in WSH_NEW_DELIVERIES table. The DELIVERY_ID, NAME and return status of a new delivery are passed as OUT parameters, while the DELIVERY_ID or NAME of an existing delivery for update is passed as an IN parameter.
    Pass IN parameter p_action_code value UPDATE ---> incase you want to update existing delivery.
    Pass IN parameter p_action_code value CREATE --> incase you want to create a new dleivery.
    Parameter Usage Type Required
    p_api_version_number IN Number x
    p_init_msg_list IN Varchar2 -
    x_return_status OUT Varchar2 -
    x_msg_count OUT Number -
    x_msg_data OUT Varchar2 -
    p_action_code IN Varchar2 x
    p_delivery_info IN OUT Record x
    p_delivery_name IN Varchar2 -
    x_delivery_id OUT Number -
    x_name OUT Varchar2 -
    I hope all this infor. comes handy.
    -Dhawang

  • Public API for - Power BI for Office 365

    Hello,
    Where could I find the Public API for - Power BI for Office 365? Is there any related documents?
    Thanks,
    Bob

    Paul,
    The APIs at http://msdn.microsoft.com/en-us/powerbi/dn874029.aspx only
    seem to work for the new Power BI and not Power BI for Office 365. Am I correct in saying this?
    Can I find an API for Power BI for Office 365?
    Thanks,
    Tom

  • PIM Public API for Business rules

    In Oracle PIM, Is there Public API to call the business rules (Assignment and Validation business rules) ?
    If there is no Public API, what is the alternate ?

    Please note that this forum is for Data Quality questions.

  • Public APIs for Adobe Central Pro Server

    Hi,
    Can anyone point me to the Public APIs that are available with the Adobe Central Pro Server e.g. I would want my application to dynamically add or remove steps in the job db, or change the target printer. Also, is it possible to invoke the preview functionality that comes with the Adobe Designer and integrate with an existing application
    Here what we are trying to do is add the printing (template merging) facility to an existing application and would want access to the public API for these products.
    Thanks in anticipation!
    Regards,

    I'm not sure you can do what you describe in the manner that you appear to be wanting to do it. I know of no APIs that are provided. There are ways to get the job done, though.<br /><br />The job management data base is an ascii text file that can easily be changed programatically. Parts of our application use it for building a drop-down list of printers for the user to select from. Changing it doesn't automatically cause Central to use the new file. Central must be told to reload it before it will be using the modified file. This can be done by placing a certain "command" file in Central's control folder, but it would not run until after the current job completes - if the current job is the one that just changed the file and further steps of the same job are for the processing of the data, then that would be too late. Once a job starts, all the parameters and tasks from the job management database and on the original ^job statement is what will be used. This goes for changing anything about the job, whether it be adding/deleting steps, changing the printer, or any other parameters.<br /><br />We accomplish pretty much what you want by doing several things. <br /><br />*First, we define all of the various configurations of jobs that we need. For example, our main printing job has four tasks; it is not uncommon to need to restart a job someplace besides the first task. Therefore, we have four different jobs defined, each one starting further down the list of tasks. We do the same thing when the processing of the data has to vary in some manner - we have jobs pre-defined for each specific set of tasks and the source of the data sets the ^job name as required for the specific tasks that have to be done.<br /><br />*For modifying the printer, we use the -z<printer> and -asp<driver> parameters on the ^job statement and the source of the file sets the values as necessary. The source of the file will also set the job name so that the desired job is ran. <br /><br />*We also have built into our custom agents the capability to recognize when a "soft" failure is occurring (such as can't reach our database) and it will put the job back in for processing after changing the job name to run the correct job for restarting at the proper step. <br /><br />*One of our steps is to check a control file to see if there is a redirection for the specified printer to a substitute printer (say, the original printer is down for maintenance). This agent will put the job back in for processing, changing not only the job name but the printer parameters. It has to be put back in, instead of just changing the parameters and passing the file on to JFMERGE, because Central uses the parameters on the original ^job line, it doesn't use the parameters that might be on the ^job line when JFMERGE starts.<br /><br />*We have also created our own agent for running as the JFERROR task. This task runs when one of the agents supplied with Central encounter a failure. Our agent analyzes the failure and determines if it was "hard" or "soft". If it was a "soft" failure, this agent requeues the job, changing the name and parameters as necessary.<br /><br />So far we have been unable to determine how to get our VB6 agents to set the ErrorLevel to notify Central that the agent failed (we came up with a workaround instead of spending a lot of time trying to get the ErrorLevel to work). This is necessary to prevent Central's agents from processing when a predicessor custom agent fails. Since we couldn't set the ErrorLevel, we just set up all of our agents to always create an output file for input to the next task. When one of our agents fail, it only outputs a modified ^job line with no following data. This modified ^job line is recognized by our custom agents as an indication that a failure is in process so it skips any processing except to pass the file to the next task. Since there is no data or form commands in the file, once it gets to JFMERGE, it just terminates without producing any output or error condition.<br /><br />Previewing is accomplished by running the JFPVMRG agent to create a PDF and then JFPVSEND to send it to the originating IP# for receipt by the View Manager which will then load it into Adobe Reader. At this point, the job running on Central will be finished - it could have produced hard-copy output or not depending on its design. Once the user receives the PDF, they can do whatever they want with it (save, print, etc).<br /><br />We use the above capability for our users to view an "archive" image of forms, after it has been processed normally. I know of others that use it to create the PDF as part of the normal processing, allowing the user to then print from Adobe Reader it if they wish.<br /><br />What we do is to drop a DAT file into Central's input folder that runs the above two agents. Our application that is running on the user's PC then watches for Adobe Reader to load and when it does it forces it to be the top-most task (we do this because we have a problem that it will often open behind other windows).

  • BEA public API (WLS6.1)for programatically updating default security realm?

    Hi,
    Does anyone know how to use BEA's public API to programmatically add/update WLS
    6.1 user credentials in the default security realm? The API would of course
    automatically persist the updates to $WLS/config/mydomain/fileRealm.properties.
    Is there a way to do such updates by programmatically engaging the WLS security
    realm related Mbeans? I basically need to do (from a deployed application component)
    what is easily done from the WLS Console's [security->User->Add User/Change
    Password] screen. Ideally, I could use the same API that the weblogic.security.acl.internal.FileRealm
    command line utility (or wlshell also) uses to make updates. But I doubt that
    the classes used by these tools are in BEA's public API for WLS 6.1. Especially
    important to me would be the BEA API mechanism that takes a clear-text password
    and hashes it to the encrypted format written in fileRealm.properties (and synchronized
    w/ SerializedSystemIni.dat). Ultimately, I am trying to replicate a large
    Oracle table of (*user, clear-text -password, group) records into the default
    WLS security realm. Thanks for any insights.
    Ben

    Thanks to another's post, I have found the answer to my problem in the Girdley/Woollen/Emerson
    book "J2EE Applications and BEA WebLogic Server" pp. 496-498:
    Note: this code segment is for WLS 6.1 and this API is said to be deprecated
    in WLS 7+
    //Roughly outlined, assuming session w/ userName, groupName, password Strings
    in HTTP Post request
    weblogic.security.acl.CachingRealm realm = (weblogic.security.acl.CachingRealm)
    weblogic.security.acl.Security.getRealm();
    weblogic.security.acl.User u;
    weblogic.security.acl.Group g;
    u = realm.newUser(userName, password, null);
    g = realm.getGroup(groupName); // use g = realm.newGroup(groupName) if groupName
    does not exist in realm
    g.addMember(u);
    //log in the new user
    int rc = weblogic..servlet.security.ServletAuthentication.weak(userName, password,
    httpSession);
    // use realm.deleteUser(u), realm.deleteGroup(g) as appropriate, etc.
    "Ben Cotton" <[email protected]> wrote:
    >
    >
    Hi,
    Does anyone know how to use BEA's public API to programmatically add/update
    WLS
    6.1 user credentials in the default security realm? The API would of
    course
    automatically persist the updates to $WLS/config/mydomain/fileRealm.properties.
    Is there a way to do such updates by programmatically engaging the
    WLS security
    realm related Mbeans? I basically need to do (from a deployed application
    component)
    what is easily done from the WLS Console's [security->User->Add User/Change
    Password] screen. Ideally, I could use the same API that the weblogic.security.acl.internal.FileRealm
    command line utility (or wlshell also) uses to make updates. But I
    doubt that
    the classes used by these tools are in BEA's public API for WLS 6.1.
    Especially
    important to me would be the BEA API mechanism that takes a clear-text
    password
    and hashes it to the encrypted format written in fileRealm.properties
    (and synchronized
    w/ SerializedSystemIni.dat). Ultimately, I am trying to replicate
    a large
    Oracle table of (*user, clear-text -password, group) records into the
    default
    WLS security realm. Thanks for any insights.
    Ben

  • Any Public API's used for Punch Machine in OTL

    Hi,
    Could you let me know if there are any Public API's used for Punch Machine in OTL
    Thanks.

    Could you let me know if there are any Public API's used for Punch Machine in OTLPlease see these docs.
    Would like Punch In or Out Time to be Used to Worked Day Determination. [ID 1350155.1]
    Oracle Time and Labor (OTL) Implementation and User Guide, Release 12 [ID 1070930.1]
    Thanks,
    Hussein

  • [svn:osmf:] 11069: Minor API change: Use Vector not Array for MediaElement. get traitTypes.

    Revision: 11069
    Author:   [email protected]
    Date:     2009-10-21 16:52:10 -0700 (Wed, 21 Oct 2009)
    Log Message:
    Minor API change: Use Vector not Array for MediaElement.get traitTypes.  Approved by dev team. Should be no impact to sample apps, unit tests, or test apps.
    Modified Paths:
        osmf/trunk/framework/MediaFramework/org/osmf/media/MediaElement.as
        osmf/trunk/framework/MediaFramework/org/osmf/proxies/ProxyElement.as

    Revision: 11069
    Author:   [email protected]
    Date:     2009-10-21 16:52:10 -0700 (Wed, 21 Oct 2009)
    Log Message:
    Minor API change: Use Vector not Array for MediaElement.get traitTypes.  Approved by dev team. Should be no impact to sample apps, unit tests, or test apps.
    Modified Paths:
        osmf/trunk/framework/MediaFramework/org/osmf/media/MediaElement.as
        osmf/trunk/framework/MediaFramework/org/osmf/proxies/ProxyElement.as

  • Public API for contract group change

    Hi,
    Does anyone know of a public API to change contract grouping? The only one I found is a private API: OKC_CGC_PVT.update_row.
    TIA,
    Alka.

    Thanks Nagamohan. I did look at the package, but did not notice "update_contract_grpngs" procedure in it.....need to pay more attention :-)

  • How can I use a 1 double array for this

    I would like to use one double array where I am using 2 single arrays, can this be done?
    thanks
    import java.text.NumberFormat;
    import java.util.Locale;
    class Mortgage3
              public static void main(String[]argv)
              //Variables
              //allows for currency format
              NumberFormat formatter = NumberFormat.getCurrencyInstance(Locale.US);
              double prin;                              
              double month_payments;
              double monthlyinterest;   
                    //standard integer
              int months;     
                    //array for the different interest rates
                    double[] interest = {0.0535,0.055,0.0575};
              //array for the different terms
                    int[] term = {7, 15, 30};
                    for (int i = 0; i < 3; i++)
              //values for the variables
              prin = 200000;        //principle amount of the mortgage
                    monthlyinterest = (interest[i] / 12);          //monthly interest
              months = (term[i] * 12);               //total amount of months in the 30 yr term
              //monthly payment calculation
              month_payments = (prin * monthlyinterest) / (1-Math.pow(1 + monthlyinterest, - months));           
              System.out.println("\n\n\t For a loan amount of " + formatter.format(prin));
              System.out.println("\t With an annual interest rate of " +interest[i] * 100+ "%,");
              System.out.println("\t your payments will be " +formatter.format(month_payments)+ " per month");
                    System.out.println("\t for a term of "+term[i]+ " years or " +months+" months.");
    }

    I would like to use one double array where I am using 2 single arrays, can this be done?It can, but why not write a Rate class or other data structure more suited to the purpose?

  • Public API/Interface name to import the payment information against invoice

    Hi,
    I want to get the Oracle supported Public API/Interface name to import the payment information against invoices(because there is a need to importing payment data against closed invoices from 11.5.5 to R12). Since I am not getting any standard oracle supported method, I am using the API AP_PAY_INVOICE_PKG.AP_PAY_INVOICE but while running it I am getting the following error:-
    Payment API Error =ORA-20001: APP-SQLAP-10000: ORA-28115: policy with check option violation
    occurred in
    AP_AIP_TABLE_HANDLER_PKG.Insert_Row <-AP_PAY_INVOICE_PKG.ap_pay_insert_invoice_payments<-AP_PAY_INVOICE_PKG.ap_pay_invoice<-.
    Regards,

    The below query will meet your requirement, but payment amount won't matches with some cases see below .
    1) Check Payment/EFT Payment for more than one invoice we will pay that time invoice amount is
    not equal to payment amount, Payment amount is greater than Invoice Amount.  This will be controlled in Report level.
    if you develop report using this query, there you can control this issue.
    SELECT aia.vendor_id, aps.vendor_name, aia.invoice_id, aia.invoice_num,
           aia.invoice_date, aia.invoice_currency_code, aia.payment_currency_code,
           aia.invoice_amount, aia.amount_paid, aia.payment_method_lookup_code,
           aia.payment_method_code, aia.SOURCE, aia.invoice_type_lookup_code,
           aia.voucher_num, aca.amount payment, aca.bank_account_name,
           aca.check_id, aca.check_number, aca.currency_code,
           aca.payment_method_lookup_code, aipa.accrual_posted_flag,
           aipa.cash_posted_flag, aipa.posted_flag
      FROM ap_invoices_all aia,
           ap_checks_all aca,
           ap_invoice_payments_all aipa,
           ap_suppliers aps
    WHERE aia.invoice_id = aipa.invoice_id
       AND aca.check_id = aipa.check_id
       AND aia.vendor_id = aps.vendor_id
    if it's meet your requirement pls check the Correct/Helpful Answer for your question.
    you can modify this query here and there as per your required fields.
    Thanks
    Hari

  • App rejected due to non-public api's

    Hi,
              My App rejected due to non-public api's.
    Apple's Comments: 
    2.5: Apps that use non-public
                                      "We found that your app uses one or more non-public APIs, which is not in compliance with the App Store Review Guidelines. The use of non-public APIs is not permissible because it can lead to a poor user experience should these APIs change.
    We found the following non-public API/s in your app:
    _updateView (I have the method name like "_updateView" in my source, can I change the name of the method. Is it works ? )
    If you have defined methods in your source code with the same names as the above-mentioned APIs, we suggest altering your method names so that they no longer collide with Apple's private APIs to avoid your application being flagged in future submissions.
    Additionally, one or more of the above-mentioned APIs may reside in a static library included with your application. If you do not have access to the library's source, you may be able to search the compiled binary using "strings" or "otool" command line tools. The "strings" tool can output a list of the methods that the library calls and "otool -ov" will output the Objective-C class structures and their defined methods. These techniques can help you narrow down where the problematic code resides."
                                    And in my application, I am using the FBConnect, SDWebImage library,  and Twitter+oAuth api's. These are non-public api's ? Now, can I integrate Jira (Crash Reporter) to my application? Can anybody solve my issue......
    Thanks & Regards,
    Rajesh Kumar Yandamuri

    I have the same problem what to do with below points from the apple.
    Requires help plz help me my app rejected two times with this points.
    We found that your app uses one or more non-public APIs, which is not in compliance with the App Store Review Guidelines. The use of non-public APIs is not permissible because it can lead to a poor user experience should these APIs change.
    We found the following non-public API/s in your app:
    _tearDown
    If you have defined methods in your source code with the same names as the above-mentioned APIs, we suggest altering your method names so that they no longer collide with Apple's private APIs to avoid your application being flagged in future submissions.
    Additionally, one or more of the above-mentioned APIs may reside in a static library included with your application. If you do not have access to the library's source, you may be able to search the compiled binary using "strings" or "otool" command line tools. The "strings" tool can output a list of the methods that the library calls and "otool -ov" will output the Objective-C class structures and their defined methods. These techniques can help you narrow down where the problematic code resides.
    We appreciate that you may have made the precautions in your code for using non-public APIs, however, there is no way to accurately or completely predict how an API may be modified and what effects those modifications may have. For this reason, we do not permit the use of non-public APIs in App Store apps.
    If there are no alternatives for providing the functionality your app requires, we encourage you to file an enhancement request. Or, try working with the Apple Developer Technical Support team to explore alternative solutions. 
    On occasion, there may be apps on the App Store that don't appear to be in compliance with the App Store Review Guidelines. We work hard to ensure that the apps on the App Store are in compliance and we try to identify any apps currently on the App Store that may not be. It takes time to identify these occurrences but another app being out of compliance is not a reason for your app to be.
    For discrete code-level questions, you may wish to consult with Apple Developer Technical Support. Please be sure to:
    - include the complete details of your rejection issues
    - prepare any symbolicated crash logs, screenshots, and steps to reproduce the issues for when the DTS engineer follows up.
    For information on how to symbolicate and read a crash log, please see Tech Note TN2151 Understanding and Analyzing iPhone OS Application Crash Reports.
    If you have difficulty reproducing this issue, please try testing the workflow as described in  <https://developer.apple.com/library/ios/qa/qa1764/>Testing Workflow with Xcode's Archive feature".

  • Java Card 2.2.2 draft is out for public review

    A draft for the upcoming release of the Java Card Specification is available for public review.
    The Java Card 2.2.2 Specification will provide numerous enhancements to the award-winning Java Card platform. In particular it will include specific support for contactless communication and ID cards :
    * enhancements to ease the management and increase interoperability of contactless cards.
    * additional cryptography and security features
    * utility APIs for memory-efficient applet development
    Java Card technology v2.2.2 is ready for the next generations of smart card standards, and is fully backward-compatible with previous versions.
    New features in Java Card 2.2.2 :
    * Utility APIs for TLV, BCD, short, int
    * ISO7816-based Extended length APDU support
    * Support for up to 20 logical channels
    * External memory access API
    * Multiple Interfaces management
    * Additional cryptography algorithms : HMAC-MD5, HMAC-SHA1, SHA-256 and Korean Seed
    * Signature with message recovery
    * Partial message digest
    * Standardized Biometrics API
    Please direct your comments on this draft at [email protected] Feedback received before December 15th will be considered for the final version of the specification. For more information on the Java Card Platform Specification v2.2.2, Public Review Draft, refer to the release notes on http://java.sun.com/products/javacard/RELEASENOTES_jcspecsp.html

    The Installer and the Applet Deletion Manager are implemented in the JCRE and GlobalPlatform. On-card the Card Manager manages the content management, communication and the related security. JCRE specifies how it has to handle installation and deletion, but leaves room for different implementations. To the outside world, on a GP card, the Installer/ADM is the Card Manager with a specific AID.
    Installer and ADM are optional. For instance a Java Card Static product does not need an Installer/ADM.
    JCOP cards have the Installer/ADM fully implemented. It uses the GP functionality. The CM has to be selected to install or delete a package/applet.

Maybe you are looking for

  • How can I convert my specific file content in the Receiver Adapter(XI 7.0)?

    Hi all, I have a document structure as below: <MT_MATERIAL>    <MATERIAL>          <WERKS>1000</WERKS>          <MATNR>HAD_00001</MATNR>          <MAKTX>CHEMICAL MATERIAL</MAKTX>    </MATERIAL> </MT_MATERIAL> This document structure is the file conte

  • When we create a contract in which tables conditions are updated.

    When we create a contract using ME31K & matains conditions in which table conditions are updated. Please guide in which table i'll find all prices. In EKKO also no  document condition is generated. Please its urgent.

  • Whitelist a domain

    Hello, I need to whitelist a domain on 10.10 server: sudo serveradmin settings mail:postfix:add_whitelist_domain = "domain.com" but for this i get result: mail:postfix:add_whitelist_domain = _empty_array What should I correct? Is there any documentat

  • Timeout Error When Trying to View a History

    In Source Control 3, my entire department gets a timeout expired error whenever we try to view a file's history. Below is the stack trace: Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IM

  • Progress bar does not display

    Hello. I have a class which display a progreess bar progresssing when run from main. But same class when run from another class it does not display. When the progress is over then it displays. The same prob i had with my splash. run from main everyth