Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.update.core.model
Class ModelObject

    java.lang.Object
      org.eclipse.core.runtime.PlatformObject
          org.eclipse.update.core.model.ModelObject

All Implemented Interfaces:
  IAdaptable

Direct Known Subclasses:
  ArchiveReferenceModel, CategoryModel, ContentEntryModel, FeatureModel, FeatureReferenceModel, ImportModel, InstallHandlerEntryModel, SiteModel, URLEntryModel

public abstract class ModelObject
extends PlatformObject

Root model object. Extended by all model objects.

This class cannot be instantiated and must be subclassed.

Note: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.

Constructor Summary
`protected` | `ModelObject()` Creates a base model object.

Method Summary
`protected Object[]` | `arrayTypeFor(List l)` Returns a concrete array type for the elements of the specified list.
`protected Object[]` | `arrayTypeFor(Set s)` Returns a concrete array type for the elements of the specified set.
`protected void` | `assertIsWriteable()` Checks that this model object is writeable.
`protected String` | `getPropertyName()` Method getPropertyName.
`protected ResourceBundle` | `getResourceBundle(URL url)` Helper method to access resouce bundle for feature.
`boolean` | `isReadOnly()` Returns whether or not this model object is read-only.
`protected void` | `markListReferenceReadOnly(ModelObject[] o)` Delegate setting of read-only
`void` | `markReadOnly()` Sets this model object and all of its descendents to be read-only.
`protected void` | `markReferenceReadOnly(ModelObject o)` Delegate setting of read-only
`void` | `resolve(URL base, URL bundleURL)` Resolve the model element.
`protected void` | `resolveListReference(ModelObject[] o, URL url, URL bundleURL)` Delegate resolution to list of referenced models
`protected String` | `resolveNLString(URL bundleURL, String string)` Returns a resource string corresponding to the given argument value and bundle.
`protected void` | `resolveReference(ModelObject o, URL url, URL bundleURL)` Delegate resolution to referenced model
`protected URL` | `resolveURL(URL context, URL bundleURL, String urlString)` Resolve a URL based on context

Methods inherited from class org.eclipse.core.runtime.PlatformObject
`getAdapter`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ModelObject

    protected ModelObject()

  Creates a base model object.

Since:
  2.0

Method Detail

### assertIsWriteable

    protected final void assertIsWriteable()

  Checks that this model object is writeable. A runtime exception is thrown if it is not.

  Since:
    2.0

### markReadOnly

    public void markReadOnly()

  Sets this model object and all of its descendents to be read-only. Subclasses may extend this implementation.

  Since:
    2.0
  See Also:
    `isReadOnly()`

### isReadOnly

    public boolean isReadOnly()

  Returns whether or not this model object is read-only.

  Returns:
    `true` if this model object is read-only, `false` otherwise
  Since:
    2.0
  See Also:
    `markReadOnly()`

### markReferenceReadOnly

    protected void markReferenceReadOnly(ModelObject o)

  Delegate setting of read-only

  Parameters:
    `o` - object to delegate to. Must be of type ModelObject.
  Since:
    2.0
  See Also:
    `isReadOnly()`

### markListReferenceReadOnly

    protected void markListReferenceReadOnly(ModelObject[] o)

  Delegate setting of read-only

  Parameters:
    `o` - object array to delegate to. Each element must be of type ModelObject.
  Since:
    2.0
  See Also:
    `isReadOnly()`

### resolve

    public void resolve(URL base,
                        URL bundleURL)
                 throws MalformedURLException

  Resolve the model element. This method allows any relative URL strings to be resolved to actual URL. It also allows any translatable strings to be localized. Subclasses need to override this method to perform the actual resolution.

  Parameters:
    `base` - base URL.
    `bundleURL` - resource bundle URL.
  Throws:
    `MalformedURLException`
  Since:
    2.0

### resolveReference

    protected void resolveReference(ModelObject o,
                                    URL url,
                                    URL bundleURL)
                             throws MalformedURLException

  Delegate resolution to referenced model

  Parameters:
    `o` - object to delegate to. Must be of type ModelObject.
    `url` - base URL.
    `bundleURL` - resource bundle URL.
  Throws:
    `MalformedURLException`
  Since:
    2.0

### resolveListReference

    protected void resolveListReference(ModelObject[] o,
                                        URL url,
                                        URL bundleURL)
                                 throws MalformedURLException

  Delegate resolution to list of referenced models

  Parameters:
    `o` - object array to delegate to. Each element must be of type ModelObject.
    `url` - base URL.
    `bundleURL` - resource bundle URL.
  Throws:
    `MalformedURLException`
  Since:
    2.0

### resolveURL

    protected URL resolveURL(URL context,
                             URL bundleURL,
                             String urlString)
                      throws MalformedURLException

  Resolve a URL based on context

  Parameters:
    `context` - base URL.
    `bundleURL` - resource bundle URL.
    `urlString` - url string from model.
  Returns:
    URL, or `null`.
  Throws:
    `MalformedURLException`
  Since:
    2.0

### resolveNLString

    protected String resolveNLString(URL bundleURL,
                                     String string)

  Returns a resource string corresponding to the given argument value and bundle. If the argument value specifies a resource key, the string is looked up in the given resource bundle. If the argument does not specify a valid key, the argument itself is returned as the resource string. The key lookup is performed against the specified resource bundle. If a resource string corresponding to the key is not found in the resource bundle the key value, or any default text following the key in the argument value is returned as the resource string. A key is identified as a string begining with the "%" character. Note that the "%" character is stripped off prior to lookup in the resource bundle.

  For example, assume resource bundle plugin.properties contains name = Project Name

           resolveNLString(b,"Hello World") returns "Hello World"
           resolveNLString(b,"%name") returns "Project Name"
           resolveNLString(b,"%name Hello World") returns "Project Name"
           resolveNLString(b,"%abcd Hello World") returns "Hello World"
           resolveNLString(b,"%abcd") returns "%abcd"
           resolveNLString(b,"%%name") returns "%name"

  Parameters:
    `bundleURL` - resource bundle url.
    `string` - translatable string from model
  Returns:
    string, or `null`
  Since:
    2.0

### arrayTypeFor

    protected Object[] arrayTypeFor(List l)

  Returns a concrete array type for the elements of the specified list. The method assumes all the elements of the list are the same concrete type as the first element in the list.

  Parameters:
    `l` - list
  Returns:
    concrete array type, or `null` if the array type could not be determined (the list is `null` or empty)
  Since:
    2.0

### arrayTypeFor

    protected Object[] arrayTypeFor(Set s)

  Returns a concrete array type for the elements of the specified set. The method assumes all the elements of the set are the same concrete type as the first element in the set.

  Parameters:
    `s` - set
  Returns:
    concrete array type, or `null` if the array type could not be determined (the set is `null` or empty)
  Since:
    2.0

### getResourceBundle

    protected ResourceBundle getResourceBundle(URL url)

  Helper method to access resouce bundle for feature. The default implementation attempts to load the appropriately localized feature.properties file.

  Parameters:
    `url` - base URL used to load the resource bundle.
  Returns:
    resource bundle, or `null`.
  Since:
    2.0

### getPropertyName

    protected String getPropertyName()

  Method getPropertyName.

  Returns:
    String

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.