io.mateu.dtos.GenericComponent Maven / Gradle / Ivy
The newest version!
package io.mateu.dtos;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* A component inside a view part/layout. E.g. form, card, directory, stepper, ... There is a
* specific implementation for cruds
*
* @param metadata The metadata to be used to paint the component
* @param id The component targetId
* @param attributes Attributes for this component. Not data, but to be used to change this
* component behaviour/appearance
* @param data Pure data for this component
* @param childComponentIds Child componentIds. This is used for layouts
*/
public record GenericComponent(
ComponentMetadata metadata,
String id,
String className,
Map attributes,
Map data,
List childComponentIds)
implements Component {
public GenericComponent {
attributes = Collections.unmodifiableMap(attributes);
data = Collections.unmodifiableMap(data);
childComponentIds = Collections.unmodifiableList(childComponentIds);
}
@Override
public Map attributes() {
return Collections.unmodifiableMap(attributes);
}
@Override
public Map data() {
return Collections.unmodifiableMap(data);
}
@Override
public List childComponentIds() {
return Collections.unmodifiableList(childComponentIds);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy