Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2008, 2010 VMware Inc. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at Contributors: VMware Inc. - initial contribution /
The default implementation of This implementation creates names based on the following pattern:

<domain>:type=Model,artifact-type=<type>,name=<name>,version=<version> Concurrent Semantics

     private static final String ARTIFACTS_FORMAT = "%s:type=Model,*";
     private static final String ARTIFACTS_OF_TYPE_FORMAT = "%s:type=Model,artifact-type=%s,*";
     private static final String ARTIFACTS_OF_TYPE_AND_NAME_FORMAT = "%s:type=Model,artifact-type=%s,name=%s,*";
     private static final String ARTIFACT_FORMAT = "%s:type=Model,artifact-type=%s,name=%s,version=%s";
     private static final String KEY_TYPE = "artifact-type";
     private static final String KEY_NAME = "name";
     private static final String KEY_VERSION = "version";
     private final String domain;
         this. = domain;

     public ObjectName create(@NonNull Artifact artifact) {
         return create(artifact.getType(), artifact.getName(), artifact.getVersion());

     public ObjectName create(String typeString nameVersion version) {
         return createObjectName(String.format(this.typenameversion));

     public ObjectName createArtifactsOfTypeQuery(String type) {
         return createObjectName(String.format(this.type));

     public ObjectName createArtifactVersionsQuery(String typeString name) {
         return createObjectName(String.format(this.typename));

     public ObjectName createArtifactsQuery() {
         return createObjectName(String.format(this.));

     public String getType(ObjectName objectName) {
         return objectName.getKeyProperty();

    public String getName(ObjectName objectName) {
        return objectName.getKeyProperty();

    public String getVersion(ObjectName objectName) {
        return objectName.getKeyProperty();
    private ObjectName createObjectName(String objectName) {
        try {
            return new ObjectName(objectName);
        } catch (MalformedObjectNameException e) {
            throw new RuntimeException(String.format("Unable to create object name '%s'"objectName), e);
        } catch (NullPointerException e) {
            throw new RuntimeException(String.format("Unable to create object name '%s'"objectName), e);
New to GrepCode? Check out our FAQ X