Development docs
  • Introduction
  • General information
    • Development Ecosystem
    • Documentation
    • Testing
    • Continuous Integration
    • Code Style
    • Paradigms
    • Design Patterns
    • Architecture
    • Refactoring
    • Date Formats
  • Various
    • Technologies and services
      • Travis
      • GitHub
    • Databases
      • Database Kinds
      • Style Guide
      • Joins
    • Web
      • Template View
      • Interactive View
      • Open Graph
      • Twitter Card
    • Parsers
    • Regular Expression
    • File Formats
      • Properties
    • Logging
  • git
    • Configuration files
      • gitignore
      • gitattributes
    • Gitflow
    • Tools
  • Web
    • REST
    • SOAP
  • Architecture
    • SOA
  • Object Oriented Programming
    • Returns
  • Jenkins
    • Pipeline
      • Steps
      • Environment
      • Notifications
      • Scripts
  • Java
    • Environment
      • Development Ecosystem
      • IDE
    • General
    • Interfaces and Generics for a Service
      • Dependencies
      • Type Errors
      • Nested Type Errors
    • Creating New Instances Dynamically
      • Using Classes
      • Using Providers
Powered by GitBook
On this page
  • Model
  • Component

Was this helpful?

  1. Java

Creating New Instances Dynamically

Sometimes the type of an object is decided at runtime.

In this example the model consists of a single interface, and no implementation. The user is expected to choose the actual implementation to use.

Model

public interface ModelObject {

   public String getName();

   public void setName(final String name);

}

Component

public interface ModelObjectBuilder<V extends ModelObject> {

   public V getModelObject(final String name);

}
PreviousNested Type ErrorsNextUsing Classes

Last updated 6 years ago

Was this helpful?