This is a minor code smell, concentrate exception allocation to
get rid of it.
Change-Id: I3343b5dd844e4796cd781ef478412dd40e980152
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
e53b093fd60311d1ee4f5013aac1e8b69162553d)
@Override
public Optional<String> getDescription() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
@Override
public Optional<String> getReference() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
@Override
public Status getStatus() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
}
@Override
public TypeComment getComment() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
@Override
public String getDescription() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
@Override
public String getReference() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
@Override
public Iterable<QName> getSchemaPath() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
@Override
public String getModuleName() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
@Override
public Optional<YangSourceDefinition> getYangSourceDefinition() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
}
+
+ static UnsupportedOperationException unsupported() {
+ return new UnsupportedOperationException("Not available at runtime");
+ }
}
@Override
public Restrictions getRestrictions() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
@Override
public GeneratedProperty getSUID() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
@Override
public String getDescription() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
@Override
public String getReference() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
@Override
public Iterable<QName> getSchemaPath() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
@Override
public String getModuleName() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
+ }
+
+ private static UnsupportedOperationException unsupported() {
+ return new UnsupportedOperationException("Not available at runtime");
}
}
}
@Override
public String getDescription() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
@Override
public String getReference() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
@Override
public Iterable<QName> getSchemaPath() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
}
@Override
public String getModuleName() {
- throw new UnsupportedOperationException("Not available at runtime");
+ throw unsupported();
+ }
+
+ private static UnsupportedOperationException unsupported() {
+ return new UnsupportedOperationException("Not available at runtime");
}
}
}